public abstract class JboBaseValidator extends AbstractValidator
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 int |
mBindingStyle |
protected AttributeDefImpl |
mValidatingAttr |
protected java.lang.String |
mValidatingAttrName |
mbInverse, mDescription, mErrorMessageClass, mMsgExpr, mMsgId, mMsgIds, mResourceBundleId, mTriggeringAttributeNames, mTriggeringAttributes
mFullName, mObjName, mParent, mProperties, RES_ID_SUFFIX, RESID_SUFFIX
ATTR, 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, VALIDATION_XMLNS, VALIDATOR_MSG_ID_PREFIX, VO, VO_STR, VO_USAGE, VO_USAGE_STR
Constructor and Description |
---|
JboBaseValidator() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
extractValueToValidate(PropertyChangeEvent evObj) |
int |
getBindingStyle() |
protected void |
initialize() |
void |
loadXMLContents(DefElement elem) |
protected void |
raiseException(java.lang.Exception e,
PropertyChangeEvent evObj) |
void |
resolve(ValidationManager owner,
StructureDef structDef,
PersistableDefObject defObj) |
void |
setBindingStyle(int bindingStyle) |
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 |
setValidatingAttribute(AttributeDefImpl attr)
Sets the validating attribute.
|
void |
setValidatingAttribute(EntityDefImpl beanInfo,
java.lang.String str)
Sets the validating attribute by name.
|
abstract boolean |
validateValue(java.lang.Object value)
Validates an object.
|
void |
vetoableChange(PropertyChangeEvent evObj)
Invokes
validateValue() on a value contained in a constrained property. |
applyDiffChildren, applyDiffContents, applyValidatorPersonalization, clone, convertToJava, copyErrorMsgInfo, createAttributeException, createException, createExprValueSupplier, createRowException, diffChildren, diffContents, diffObjects, ensureDifferDetails, ensureVariableManager, getDefXMLElementTag, getDescription, getErrorMessageClass, getErrorMsgExpressions, getErrorMsgId, getErrorMsgIds, getExprValueSupplierType, getFullName, getInverse, getMessageBundleClass, getName, getOnCondition, getOwner, getResourceBundleDef, getResourceBundleId, getSeverity, getTriggeringAttributeDefs, getTriggeringAttributeNames, getValidatingAttributeName, getValidatorSubType, getVariableManager, hasErrorMsg, hasValidationCondition, hasVariables, initErrMsgParms, initTriggeringAttributeDefs, initValidatorProperties, isDirty, isMovedToAttrLevel, isNew, isTransactionLevel, isTransactionLevel, isValidatable, loadVariables, parseSeverityStr, prepareException, raiseException, raiseException, readStringArrayList, readTransientExpression, readTransientExpression, readUserObject, readUserObject, readUserObjectTrim, readUserObjectTrim, readUserStringElementsMap, setDefaultDescription, setDescription, setDirty, setErrorMessageClass, setErrorMsgExpressions, setErrorMsgId, setErrorMsgIds, setExprValueSupplierType, setInverse, setNew, setOnCondition, setResourceBundleDef, setResourceBundleId, setSeverity, setTransactionLevel, setTriggeringAttributeNames, setValidatingAttributeName, setValidatorSubType, writeChildren, writeContents
allocatePropertyMap, getAllProperties, getParent, getProperties, getPropertiesAsStrings, getPropertiesMap, getProperty, getProperty, getPropertyExpressionsMap, getPropertyMap, getRawPropertyValue, getResourcesFromBundle, getStringFromMessageBundle, isPropertyExpression, mergePropertyMap, refreshProperty, removeProperty, removeProperty, requiresNamePrefixedResId, resolveObjectProperty, resolvePropertyRaw, setFullName, setName, setParent, setPropertiesMap, setPropertiesMap2, setProperty, setProperty, setPropertyExpression, setPropertyMap
protected AttributeDefImpl mValidatingAttr
protected java.lang.String mValidatingAttrName
protected int mBindingStyle
protected void initialize()
protected java.lang.Object extractValueToValidate(PropertyChangeEvent evObj)
public void vetoableChange(PropertyChangeEvent evObj) throws JboException
validateValue()
on a value contained in a constrained property.
.
evObj
- a PropertyChangeEvent
containing a property
to be validated.JboException
- if validation fails, with CSMessageBundle
error code EXC_VAL_ATTR_SET_FAILED
.protected void raiseException(java.lang.Exception e, PropertyChangeEvent evObj)
public abstract boolean validateValue(java.lang.Object value) throws java.lang.Exception
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.protected 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.Exception
public void setValidatingAttribute(AttributeDefImpl attr)
attr
- an attribute.public void setValidatingAttribute(EntityDefImpl 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 int getBindingStyle()
public void setBindingStyle(int bindingStyle)
public void loadXMLContents(DefElement elem)
loadXMLContents
in class AbstractValidator
public void resolve(ValidationManager owner, StructureDef structDef, PersistableDefObject defObj)
resolve
in class AbstractValidator