public abstract class JboAbstractValidator extends AbstractValidator implements JboValidatorHints, ComponentOperationsManager
 This class implements the basic functionality of storing the value
 of either an attribute to be validated, or the entity or application module
 reference on which validation is to be invoked.
 Subclasses must provide validateValue, which performs the actual
 validation test.
ValidatorConstants.MessageFlavor| Modifier and Type | Field and Description | 
|---|---|
protected AttributeDef | 
mValidatingAttr  | 
mbInverse, mDescription, mErrorMessageClass, mIsObjectResolved, mMsgId, mMsgIds, mResourceBundleId, mTriggeringAttributeNames, mTriggeringAttributes, mValidatingAttrNamemFullName, mObjName, mParent, mProperties, RES_ID_SUFFIX, RESID_SUFFIXATTR, ATTR_STR, BETWEEN, EO, EO_STR, EQUALTO, EXPR, EXPR_STR, GREATERTHAN, GREATERTHANEQUALTO, JBO, JBO_STR, LESSTHAN, LESSTHANEQUALTO, LITERAL, LITERAL_STR, MANDATORY_STR, mCompOperTypeVals, mRhsTypeVals, mSeverityVals, NOTEQUALTO, PNAME_CompareLength, PNAME_CompareType, PNAME_CompareValue, PNAME_DataType, PNAME_Description, PNAME_ErrorMessageExpressions, PNAME_ErrorMessageId, PNAME_ErrorMessageIds, PNAME_Exposed, PNAME_ExprValueSupplier, PNAME_ForPersonalization, PNAME_Inverse, PNAME_MessageFlavor, PNAME_Name, PNAME_OnAttribute, PNAME_OnAttributes, PNAME_OnCondition, PNAME_OperandType, PNAME_Severity, PNAME_Subtype, PNAME_TransactionLevel, PNAME_TransientExpression, PNAME_Trigger, PNAME_ValidationBeanClass, PNAME_ValName, PNAME_xmlns, PRECISION_SCALE_STR, SEVERITY_ERROR, SEVERITY_RECOVERABLE_ERROR_INDEX, SEVERITY_VETOABLE_WARNING, SEVERITY_WARNING, SQL, SQL_STR, TRIGGER_SUBTYPE_PREFIX, VALIDATION_XMLNS, VALIDATOR_MSG_ID_PREFIX, VO, VO_STR, VO_USAGE, VO_USAGE_STRFLAG_DIRTY, FLAG_EDITABLE, FLAG_FROM_TIP, FLAG_LOAD_BASE, FLAG_LOAD_HL_DEFS, FLAG_MAJOR_VERSION_CHANGED, FLAG_MINOR_VERSION_CHANGED, FLAG_NEW, FLAG_NEW_RECURSE, FLAG_SKIP_WRITE, XML_STATEMENT| Constructor and Description | 
|---|
JboAbstractValidator()  | 
| Modifier and Type | Method and Description | 
|---|---|
JboValidatorHints | 
applyValidatorPersonalization(JboValidatorHints orgVal)  | 
java.lang.Object | 
clone()  | 
void | 
closeObject()  | 
ValidationException | 
createException(java.lang.Exception e,
               JboValidatorContext evObj,
               java.lang.String msgId,
               AttributeDef attrDef,
               java.lang.Object value,
               java.lang.String methodName,
               int severity)  | 
DifferDetails | 
diffContents(DiffMergeable docDef,
            DiffMergeable orgDef,
            DifferDetails difDetails)
Performs diff of scalar values. 
 | 
ExprCodeSource | 
editCodeSource(ExprCodeSource codeSource)
Notify that ComponentOperationsManager that the client expects to
 edit the CodeSource. 
 | 
ExprCodeSource | 
ensureCodeSource(ExprDef exprDef)
Ensure a named code source in the operations manager. 
 | 
DefinitionManager | 
getDefManager()  | 
int | 
getDefScope()  | 
java.lang.String | 
getDefXMLNameSpace()  | 
java.lang.String | 
getErrorMsgId()  | 
protected AttributeDef | 
getErrorReportAttrDef(JboValidatorContext evObj)  | 
java.lang.String | 
getFullName()
Gets this object's fully-qualified name. 
 | 
java.lang.String | 
getImageLoc(boolean bOpen)  | 
ValidatorConstants.MessageFlavor | 
getMessageFlavor()  | 
OperationDefinitions | 
getOperationDefinitions()  | 
DefPersistable | 
getOrigObject()  | 
protected java.lang.String | 
getOwnerName()  | 
OperationDefinitions | 
getRowOperationDefinitions()  | 
OperationDefinitions | 
getScriptOperationDefinitions()  | 
OperationDefinitions | 
getScriptRowOperationDefinitions()  | 
AttributeDef[] | 
getTriggeringAttributeDefs()
Returns an array of attribute defs for those attributes whose change in value, 
 should trigger this validation rule to execute. 
 | 
AttributeDef | 
getValidatingAttrDef()  | 
java.lang.String | 
getValidatingAttributeName()  | 
java.lang.String | 
getValidatorType()  | 
protected java.lang.Object | 
getValueToValidate(JboValidatorContext evObj)  | 
java.lang.String | 
getXMLElementTag()
Returns a piece of static info for the type of object this is invoked
 upon. 
 | 
protected void | 
initialize(JboValidatorContext evObj)  | 
boolean | 
isDynamicCodeSourceEnabled()  | 
boolean | 
isForPersonalization()  | 
boolean | 
isHintBased()  | 
boolean | 
isReadOnly()  | 
void | 
loadXMLContents(DefElement elem)  | 
ExprDef | 
lookupExprDef(OwnerType type,
             java.lang.String path)
Search for an ExprDef in the ComponentOperationsManager's namespace. 
 | 
void | 
raiseException(java.lang.Exception e,
              JboValidatorContext evObj,
              java.lang.String msgId,
              int severity)  | 
void | 
resolve()  | 
void | 
setForPersonalization(boolean b)  | 
void | 
setHintBased(boolean b)  | 
protected void | 
setInitialized()  | 
void | 
setMessageFlavor(ValidatorConstants.MessageFlavor mFlavor)  | 
protected void | 
setNewValue(java.lang.Object newValue)
When the newValue is an Entity, get the attribute's value
 by using the getAttribute method on the entity. 
 | 
void | 
setOrigObject(DefPersistable oldObj)  | 
void | 
setTransient()  | 
void | 
setValidatingAttribute(AttributeDef attr)
Sets the validating attribute. 
 | 
void | 
setValidatingAttribute(StructureDef beanInfo,
                      java.lang.String str)
Sets the validating attribute by name. 
 | 
void | 
validate(JboValidatorContext evObj)
Tests the validity of the object/value as described in the validator context. 
 | 
void | 
validateMany(java.util.ArrayList valCtxs)  | 
abstract boolean | 
validateValue(java.lang.Object value)
Validates a value. 
 | 
boolean | 
validateValueWithContext(JboValidatorContext evObj,
                        java.lang.Object value)
Called internally by the framework with validation OnCondition is true or
 there is no validation OnCondition. 
 | 
void | 
writeContents(DefWriter jos)
Objects should write their persistence output in this method 
 | 
void | 
writeObject(DefWriter jos)
Objects should write their persistence output in this method 
 | 
applyDiffChildren, applyDiffContents, applyValidatorPersonalization, beginDiffObjects, convertToJava, copyErrorMsgInfo, createAttributeException, createExprValueSupplier, createRowException, diffChildren, diffObjects, ensureDifferDetails, ensureVariableManager, getDefTypeName, getDefXMLElementTag, getDescription, getErrorMessageClass, getErrorMsgExpressionDefs, getErrorMsgExpressions, getErrorMsgIds, getExprIdentifier, getExprValueSupplierType, getIdentificationAttributeName, getInverse, getMergeableFullName, getMergeableName, getMessageBundleClass, getName, getOnCondition, getOnConditionDef, getOwner, getResourceBundleDef, getResourceBundleId, getSeverity, getTriggeringAttributeNames, getTriggerType, getValidatorSubType, getVariableManager, hasErrorMsg, hasValidationCondition, hasVariables, initErrMsgParms, initTriggeringAttributeDefs, initValidatorProperties, isDirty, isMovedToAttrLevel, isNew, isNewRecurse, isSkipWrite, isTransactionLevel, isTransactionLevel, isValidatable, isWriteObject, loadVariables, lookupMessageDef, parseSeverityStr, prepareException, raiseException, readStringArrayList, readTransientExpression, readTransientExpression, readUserObject, readUserObject, readUserObjectTrim, readUserObjectTrim, readUserStringElementsMap, setDefaultDescription, setDescription, setDirty, setErrorMessageClass, setErrorMsgExpressionDefs, setErrorMsgExpressions, setErrorMsgId, setErrorMsgIds, setExprValueSupplierType, setInverse, setName, setNew, setNewRecurse, setOnCondition, setOnConditionDef, setOwner, setResourceBundleDef, setResourceBundleId, setSeverity, setSkipWrite, setTransactionLevel, setTriggeringAttributeNames, setTriggerTypeString, setValidatingAttributeName, setValidatorSubType, writeChildrenallocatePropertyMap, getAllProperties, getParent, getProperties, getPropertiesAsStrings, getPropertiesMap, getProperty, getProperty, getPropertyExpressionDef, getPropertyExpressionsMap, getPropertyExprEval, getPropertyMap, getPropertyNamesSet, getRawPropertyValue, getResourcesFromBundle, getStringFromMessageBundle, hasProperty, isPropertyExpression, mergePropertyMap, refreshProperty, removeProperty, removeProperty, requiresNamePrefixedResId, resolveObjectProperty, resolvePropertyRaw, setFullName, setParent, setPropertiesMap, setPropertiesMap2, setProperty, setProperty, setPropertyExpression, setPropertyExpressionMap, setPropertyMap, setRawPropertyValueequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetName, getTriggeringAttributeNames, initValidatorProperties, isTransactionLevel, setNamegetDescription, setDescriptionisDirty, isNew, isNewRecurse, isSkipWrite, isWriteObject, setDirty, setNew, setNewRecurse, setSkipWritegetDefXMLElementTag, getIdentificationAttributeName, writeChildrengetProperty, removeProperty, setPropertyprotected AttributeDef mValidatingAttr
public java.lang.Object clone()
clone in class AbstractValidatorpublic java.lang.String getFullName()
NamedObjectImplgetFullName in interface ComponentOperationsManagergetFullName in interface DefPersistablegetFullName in class AbstractValidatorprotected java.lang.String getOwnerName()
public OperationDefinitions getOperationDefinitions()
getOperationDefinitions in interface OperationContainerpublic OperationDefinitions getRowOperationDefinitions()
getRowOperationDefinitions in interface OperationContainerpublic OperationDefinitions getScriptOperationDefinitions()
getScriptOperationDefinitions in interface OperationContainerpublic OperationDefinitions getScriptRowOperationDefinitions()
getScriptRowOperationDefinitions in interface OperationContainer@Concealed public ExprCodeSource ensureCodeSource(ExprDef exprDef)
ComponentOperationsManager#updateCodeSource to update the component
 operations manager with any updates that are made to this CodeSource.ensureCodeSource in interface ComponentOperationsManagerexprDef - a null exprDef may be used to indicate the a
    built-in code source.public ExprCodeSource editCodeSource(ExprCodeSource codeSource)
ComponentOperationsManagereditCodeSource in interface ComponentOperationsManagerpublic ExprDef lookupExprDef(OwnerType type, java.lang.String path)
ComponentOperationsManagerlookupExprDef in interface ComponentOperationsManagertype - the OwnerType of the expressionpath - the ExprDef.getPath() of the expressionpublic boolean isDynamicCodeSourceEnabled()
isDynamicCodeSourceEnabled in interface ComponentOperationsManagerpublic int getDefScope()
getDefScope in interface ComponentOperationsManagerpublic DefinitionManager getDefManager()
getDefManager in interface ComponentOperationsManagerpublic boolean isReadOnly()
public void closeObject()
public java.lang.String getImageLoc(boolean bOpen)
public boolean isForPersonalization()
isForPersonalization in interface JboValidatorHintspublic void setForPersonalization(boolean b)
setForPersonalization in interface JboValidatorHintspublic ValidatorConstants.MessageFlavor getMessageFlavor()
public void setMessageFlavor(ValidatorConstants.MessageFlavor mFlavor)
protected void setInitialized()
protected void initialize(JboValidatorContext evObj)
public AttributeDef[] getTriggeringAttributeDefs()
JboValidatorHintsgetTriggeringAttributeDefs in interface JboValidatorHintsgetTriggeringAttributeDefs in class AbstractValidatorpublic java.lang.String getErrorMsgId()
getErrorMsgId in class AbstractValidatorpublic abstract boolean validateValue(java.lang.Object value)
Subclasses must implement this method.
value - the object to be validated.true if the object is valid.java.lang.Exception - if validation cannot be performed.public boolean validateValueWithContext(JboValidatorContext evObj, java.lang.Object value)
public void validate(JboValidatorContext evObj)
JboValidatorInterfacevalidate in interface JboValidatorInterfaceevObj - the validator contextpublic void validateMany(java.util.ArrayList valCtxs)
protected AttributeDef getErrorReportAttrDef(JboValidatorContext evObj)
public void raiseException(java.lang.Exception e,
                           JboValidatorContext evObj,
                           java.lang.String msgId,
                           int severity)
raiseException in class AbstractValidatorpublic ValidationException createException(java.lang.Exception e, JboValidatorContext evObj, java.lang.String msgId, AttributeDef attrDef, java.lang.Object value, java.lang.String methodName, int severity)
createException in class AbstractValidatorprotected void setNewValue(java.lang.Object newValue)
                    throws java.lang.Exception
newValue - either the attribute's value or a value to use to compare
 in the validator.java.lang.Exceptionprotected java.lang.Object getValueToValidate(JboValidatorContext evObj)
public void setValidatingAttribute(AttributeDef attr)
attr - an attribute.public void setValidatingAttribute(StructureDef beanInfo, java.lang.String str)
This variant is used when the validator is attached to an entity, rather than to an attribute.
beanInfo - the entity containing the attribute.str - an attribute name as a string.public AttributeDef getValidatingAttrDef()
public java.lang.String getValidatingAttributeName()
getValidatingAttributeName in class AbstractValidatorpublic void loadXMLContents(DefElement elem)
loadXMLContents in class AbstractValidatorpublic void resolve()
resolve in class AbstractValidatorpublic DefPersistable getOrigObject()
getOrigObject in interface DefPersistablepublic void setOrigObject(DefPersistable oldObj)
setOrigObject in interface DefPersistablepublic void writeObject(DefWriter jos)
PersistentDefinitionwriteObject in interface PersistentDefinitionjos - the Output storage for persistencepublic void writeContents(DefWriter jos)
PersistentDefinitionwriteContents in interface PersistentDefinitionwriteContents in class AbstractValidatorjos - the Output storage for persistencepublic DifferDetails diffContents(DiffMergeable docDef, DiffMergeable orgDef, DifferDetails difDetails)
DiffMergeableorgDef.  Then, help
 methods on DifferBase can be used to diff the attr values
 and accumulate the details of diff in difDetails.
 Here is example code snippet:
    private static final String DIFF_STRING_ELEMS[] =
    {
       "MyStringVal1",
       "MyStringVal2"
    };
    private static final String DIFF_INT_ELEMS[] =
    {
       "MyIntVal",
    }
    public DifferDetails diffContents(DiffMergeable docDef, DiffMergeable orgDef, DifferDetails difDetails)
    {
       <Your-def-class> orgDefImpl = (<Your-def-class>) orgDef;
       final String editStringValues[] =
       {
          this.getMyStringVal1(),
          this.getMyStringVal2()
       };
       String orgStringValues[] = null;
       if (orgDef != null)
       {
          String orgV[] =
          {
             orgDefImpl.getMyStringVal1(),
             orgDefImpl.getMyStringVal2()
          };
          orgStringValues = orgV;
       }
       final int editIntValues[] =
       {
          this.getMyIntVal(),
       };
       int orgIntValues[] = null;
       if (orgDef != null)
       {
          int orgV[] =
          {
             orgDefImpl.getMyIntVal()
          };
          orgIntValues = orgV;
       }
       difDetails = DifferBase.diffStringArray(this, DIFF_STRING_ELEMS, editStringValues, orgStringValues, difDetails);
       difDetails = DifferBase.diffIntArray(this, DIFF_INT_ELEMS, editIntValues, orgIntValues, difDetails);
       return difDetails;
   }
 
 diffContents in interface DiffMergeablediffContents in class AbstractValidatordocDef - the document-level definitionorgDef - the original definition.  It could be
   null if the definition did not exist originallydifDetails - the DifferDetails that accumulate
   the details of diff from the document-level (top-level) defDifferDetails that has all the details
   of diffpublic java.lang.String getXMLElementTag()
PersistentDefinitiongetXMLElementTag in interface PersistentDefinitionpublic java.lang.String getDefXMLNameSpace()
getDefXMLNameSpace in interface PersistentDefinitionpublic java.lang.String getValidatorType()
public JboValidatorHints applyValidatorPersonalization(JboValidatorHints orgVal)
applyValidatorPersonalization in interface JboValidatorHints@Concealed public void setTransient()
public boolean isHintBased()
public void setHintBased(boolean b)