Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.6.0)

E10653-07

oracle.jbo.rules
Class JboAbstractValidator

java.lang.Object
  extended by oracle.jbo.common.NamedObjectImpl
      extended by oracle.jbo.rules.AbstractValidator
          extended by oracle.jbo.rules.JboAbstractValidator
All Implemented Interfaces:
DefPersistable, PersistentDefinition, JboValidatorHints, JboValidatorInterface, ValidatorConstants, VariableManagerOwner, VariableManagerOwnerBase
Direct Known Subclasses:
JboCompareValidator, JboExistsValidator, JboExpressionValidator, JboLengthValidator, JboListValidator, JboMandatoryAttrValHelper, JboMethodValidator, JboNonNullValidator, JboPrecisionScaleValidator, JboRangeValidator, JboRegExpValidator, JboRequiredValidator, JboUniqueKeyValidator, JboValidationBean, JboVCItemRequiredValidator

public abstract class JboAbstractValidator
extends AbstractValidator
implements JboValidatorHints

The superclass for all pre-defined validators.

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.

Since:
Jdeveloper 3.0

Field Summary
protected  AttributeDef mValidatingAttr
           
 
Fields inherited from class oracle.jbo.rules.AbstractValidator
mbInverse, mDescription, mErrorMessageClass, mMsgExpr, mMsgId, mMsgIds, mResourceBundleId, mTriggeringAttributeNames, mTriggeringAttributes, mValidatingAttrName
 
Fields inherited from class oracle.jbo.common.NamedObjectImpl
mFullName, mObjName, mParent, mProperties, RES_ID_SUFFIX
 
Fields inherited from interface oracle.jbo.rules.ValidatorConstants
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_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, SEVERITY_VETOABLE_WARNING, SEVERITY_WARNING, SQL, SQL_STR, VALIDATION_XMLNS, VALIDATOR_MSG_ID_PREFIX, VO, VO_STR, VO_USAGE, VO_USAGE_STR
 
Fields inherited from interface oracle.jbo.mom.xml.DefPersistable
XML_STATEMENT
 
Constructor Summary
JboAbstractValidator()
           
 
Method Summary
 JboValidatorHints applyValidatorPersonalization(JboValidatorHints orgVal)
           
 java.lang.Object clone()
           
 void closeObject()
           
abstract  java.lang.String getDefXMLElementTag()
           
 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)
           
 java.lang.String getName()
          Get the name of this object.
 DefPersistable getOrigObject()
           
 AttributeDef[] getTriggeringAttributeDefs()
          Returns an array of attribute defs for those attributes whose change in value, should trigger this validation rule to execute.
 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 isForPersonalization()
           
 boolean isReadOnly()
           
 void loadXMLContents(DefElement elem)
           
 void raiseException(java.lang.Exception e, JboValidatorContext evObj, java.lang.String msgId, int severity)
           
 void resolve(ValidationManager owner, StructureDef structDef, PersistableDefObject defObj)
           
 void setForPersonalization(boolean b)
           
protected  void setInitialized()
           
 void setName(java.lang.String name)
          Name this object.
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 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
 
Methods inherited from class oracle.jbo.rules.AbstractValidator
applyValidatorPersonalization, convertToJava, copyErrorMsgInfo, createException, createExprValueSupplier, ensureVariableManager, getDescription, getErrorMessageClass, getErrorMsgExpressions, getErrorMsgIds, getExprValueSupplierType, getInverse, getMessageBundleClass, getOnCondition, getOwner, getResourceBundleDef, getResourceBundleId, getSeverity, getTriggeringAttributeNames, getValidatorSubType, getVariableManager, hasErrorMsg, hasValidationCondition, hasVariables, initErrMsgParms, initTriggeringAttributeDefs, initValidatorProperties, isDirty, isMovedToAttrLevel, isNew, isTransactionLevel, isTransactionLevel, isValidatable, loadVariables, parseSeverityStr, prepareException, raiseException, readStringArrayList, readTransientExpression, readUserObject, readUserObject, readUserObjectTrim, readUserObjectTrim, readUserStringElementsMap, setDefaultDescription, setDescription, setDirty, setErrorMessageClass, setErrorMsgExpressions, setErrorMsgId, setErrorMsgIds, setExprValueSupplierType, setInverse, setNew, setOnCondition, setResourceBundleDef, setResourceBundleId, setSeverity, setTransactionLevel, setTriggeringAttributeNames, setValidatingAttributeName, writeChildren
 
Methods inherited from class oracle.jbo.common.NamedObjectImpl
allocatePropertyMap, getAllProperties, getParent, getProperties, getPropertiesAsStrings, getPropertiesMap, getProperty, getProperty, getPropertyExpressionsMap, getPropertyMap, getResourcesFromBundle, getStringFromMessageBundle, isPropertyExpression, mergePropertyMap, refreshProperty, removeProperty, removeProperty, requiresNamePrefixedResId, resolveObjectProperty, resolvePropertyRaw, setFullName, setParent, setPropertiesMap, setPropertiesMap2, setProperty, setProperty, setPropertyExpression, setPropertyMap
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.jbo.rules.JboValidatorHints
getTriggeringAttributeNames, initValidatorProperties, isTransactionLevel
 
Methods inherited from interface oracle.jbo.rules.JboValidatorInterface
getDescription, setDescription
 
Methods inherited from interface oracle.jbo.mom.xml.DefPersistable
isDirty, isNew, setDirty, setNew
 
Methods inherited from interface oracle.jbo.mom.xml.PersistentDefinition
writeChildren
 

Field Detail

mValidatingAttr

protected AttributeDef mValidatingAttr
Constructor Detail

JboAbstractValidator

public JboAbstractValidator()
Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class AbstractValidator

getName

public java.lang.String getName()
Description copied from class: NamedObjectImpl
Get the name of this object.

Specified by:
getName in interface JboValidatorHints
Specified by:
getName in interface VariableManagerOwner
Overrides:
getName in class AbstractValidator
Returns:
the name given to this object.

setName

public void setName(java.lang.String name)
Description copied from class: NamedObjectImpl
Name this object.

Specified by:
setName in interface JboValidatorHints
Overrides:
setName in class NamedObjectImpl
Parameters:
name - the name to be given to this object.

getFullName

public java.lang.String getFullName()
Description copied from class: NamedObjectImpl
Gets this object's fully-qualified name.

Specified by:
getFullName in interface DefPersistable
Overrides:
getFullName in class AbstractValidator
Returns:
this object's fully-qualified name; the package name concatenated with the class name.

isReadOnly

public boolean isReadOnly()

closeObject

public void closeObject()

getImageLoc

public java.lang.String getImageLoc(boolean bOpen)

isForPersonalization

public boolean isForPersonalization()
Specified by:
isForPersonalization in interface JboValidatorHints

setForPersonalization

public void setForPersonalization(boolean b)
Specified by:
setForPersonalization in interface JboValidatorHints

setInitialized

protected void setInitialized()

initialize

protected void initialize(JboValidatorContext evObj)

getTriggeringAttributeDefs

public AttributeDef[] getTriggeringAttributeDefs()
Description copied from interface: JboValidatorHints
Returns an array of attribute defs for those attributes whose change in value, should trigger this validation rule to execute.

Specified by:
getTriggeringAttributeDefs in interface JboValidatorHints
Overrides:
getTriggeringAttributeDefs in class AbstractValidator

getErrorMsgId

public java.lang.String getErrorMsgId()
Overrides:
getErrorMsgId in class AbstractValidator

validateValue

public abstract boolean validateValue(java.lang.Object value)
Validates a value.

Subclasses must implement this method.

Parameters:
value - the object to be validated.
Returns:
true if the object is valid.
Throws:
java.lang.Exception - if validation cannot be performed.

validateValueWithContext

public boolean validateValueWithContext(JboValidatorContext evObj,
                                        java.lang.Object value)
Called internally by the framework with validation OnCondition is true or there is no validation OnCondition. This method should not be directly invoked in applications.


validate

public void validate(JboValidatorContext evObj)
Description copied from interface: JboValidatorInterface
Tests the validity of the object/value as described in the validator context.

Specified by:
validate in interface JboValidatorInterface
Parameters:
evObj - the validator context

validateMany

public void validateMany(java.util.ArrayList valCtxs)

getErrorReportAttrDef

protected AttributeDef getErrorReportAttrDef(JboValidatorContext evObj)

raiseException

public void raiseException(java.lang.Exception e,
                           JboValidatorContext evObj,
                           java.lang.String msgId,
                           int severity)
Overrides:
raiseException in class AbstractValidator

setNewValue

protected void setNewValue(java.lang.Object newValue)
                    throws java.lang.Exception
When the newValue is an Entity, get the attribute's value by using the getAttribute method on the entity. Otherwise, newValue should be a value to compare in this validator.

Parameters:
newValue - either the attribute's value or a value to use to compare in the validator.
Throws:
java.lang.Exception

getValueToValidate

protected java.lang.Object getValueToValidate(JboValidatorContext evObj)

setValidatingAttribute

public void setValidatingAttribute(AttributeDef attr)
Sets the validating attribute.

Parameters:
attr - an attribute.

setValidatingAttribute

public void setValidatingAttribute(StructureDef beanInfo,
                                   java.lang.String str)
Sets the validating attribute by name.

This variant is used when the validator is attached to an entity, rather than to an attribute.

Parameters:
beanInfo - the entity containing the attribute.
str - an attribute name as a string.

getValidatingAttributeName

public java.lang.String getValidatingAttributeName()
Overrides:
getValidatingAttributeName in class AbstractValidator

loadXMLContents

public void loadXMLContents(DefElement elem)
Overrides:
loadXMLContents in class AbstractValidator

resolve

public void resolve(ValidationManager owner,
                    StructureDef structDef,
                    PersistableDefObject defObj)
Specified by:
resolve in interface JboValidatorHints
Overrides:
resolve in class AbstractValidator

getOrigObject

public DefPersistable getOrigObject()
Specified by:
getOrigObject in interface DefPersistable

setOrigObject

public void setOrigObject(DefPersistable oldObj)
Specified by:
setOrigObject in interface DefPersistable

writeObject

public void writeObject(DefWriter jos)
Description copied from interface: PersistentDefinition
Objects should write their persistence output in this method

Specified by:
writeObject in interface PersistentDefinition
Parameters:
jos - the Output storage for persistence

writeContents

public void writeContents(DefWriter jos)
Description copied from interface: PersistentDefinition
Objects should write their persistence output in this method

Specified by:
writeContents in interface PersistentDefinition
Overrides:
writeContents in class AbstractValidator
Parameters:
jos - the Output storage for persistence

getDefXMLElementTag

public abstract java.lang.String getDefXMLElementTag()
Specified by:
getDefXMLElementTag in interface PersistentDefinition

getXMLElementTag

public java.lang.String getXMLElementTag()
Description copied from interface: PersistentDefinition
Returns a piece of static info for the type of object this is invoked upon. Examples are PreparedStatements for insert, update, delete, and String containing a base the select statement for retrieving instances of this type through the SQLInputStream

Specified by:
getXMLElementTag in interface PersistentDefinition
Returns:
returns the Statement required to store in Persitent Storage. Incase of XML, it just returns the String. In the case of SQL a JDBC PreparedStatement is returned.

getDefXMLNameSpace

public java.lang.String getDefXMLNameSpace()
Specified by:
getDefXMLNameSpace in interface PersistentDefinition

getValidatorType

public java.lang.String getValidatorType()

applyValidatorPersonalization

public JboValidatorHints applyValidatorPersonalization(JboValidatorHints orgVal)
Specified by:
applyValidatorPersonalization in interface JboValidatorHints

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.6.0)

E10653-07

Copyright © 1997, 2011, Oracle. All rights reserved.