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

E10653-01

oracle.jbo.rules
Class AbstractValidator

java.lang.Object
  extended by oracle.jbo.rules.AbstractValidator
All Implemented Interfaces:
ValidatorConstants, VariableManagerOwner, VariableManagerOwnerBase
Direct Known Subclasses:
JboAbstractValidator, JboBaseValidator, JboCustomValidator

public abstract class AbstractValidator
extends java.lang.Object
implements VariableManagerOwner, ValidatorConstants

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  boolean mbInverse
          Internal: Applications should not use these protected members directly.
protected  java.lang.String mDescription
           
protected  java.lang.Class mErrorMessageClass
           
protected  java.util.HashMap mMsgExpr
           
protected  java.lang.String mMsgId
           
protected  java.util.List<java.lang.String> mMsgIds
           
protected  java.lang.String mResourceBundleId
           
protected  java.lang.String[] mTriggeringAttributeNames
           
protected  AttributeDef[] mTriggeringAttributes
           
protected  java.lang.String mValidatingAttrName
           
 
Fields inherited from interface oracle.jbo.rules.ValidatorConstants
ATTR, ATTR_STR, EO, EO_STR, EQUALTO, EXPR, EXPR_STR, GREATERTHAN, GREATERTHANEQUALTO, JBO, JBO_STR, LESSTHAN, LESSTHANEQUALTO, LITERAL, LITERAL_STR, MANDATORY_STR, mCompOperTypeVals, mRhsTypeVals, mSeverityVals, PNAME_CompareLength, PNAME_CompareType, PNAME_CompareValue, PNAME_DataType, PNAME_ErrorMessageExpressions, PNAME_ErrorMessageId, PNAME_ErrorMessageIds, PNAME_Exposed, PNAME_ForPersonalization, PNAME_Inverse, PNAME_Name, PNAME_OnAttribute, PNAME_OnAttributes, PNAME_OnCondition, PNAME_OperandType, PNAME_Severity, PNAME_Subtype, PNAME_TransactionLevel, 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
 
Constructor Summary
AbstractValidator()
           
 
Method Summary
 AbstractValidator applyValidatorPersonalization(AbstractValidator orgVal)
           
 java.lang.Object clone()
           
 java.lang.Object convertToJava(AttributeDef attrDef, java.lang.Object val)
           
 ValidationException createException(java.lang.Exception e, JboValidatorContext evObj, java.lang.String msgId, AttributeDef attrDef, java.lang.Object value, java.lang.String methodName, int severity)
           
protected  ExprValueSupplier createExprValueSupplier(JboValidatorContext ctx)
          For internal framework use only
 VariableValueManager ensureVariableManager()
          Returns this object's Variable Value Manager.
 java.lang.String getDescription()
          Gets the textul description of this validator.
 java.lang.Class getErrorMessageClass()
           
 java.util.Map getErrorMsgExpressions()
           
 java.lang.String getErrorMsgId()
           
 java.lang.String getFullName()
           
 boolean getInverse()
          Reports whether the logic of this validator is inverted.
 java.lang.Class getMessageBundleClass()
           
 java.lang.String getName()
          Returns the name of this Variable Manager Owner.
 java.lang.String getOnCondition()
           
 ValidationManager getOwner()
           
 ResourceBundleDef getResourceBundleDef()
          getResourceBundleDef gets the mResourceBundleDef value
 java.lang.String getResourceBundleId()
           
 int getSeverity()
          Returns severity as one of the constants in oracle.jbo.JboWarning : JboWarning.SEVERITY_ERROR , JboWarning.SEVERITY_WARNING, JboWarning.SEVERITY_VETOABLE_WARNING, or JboWarning.SEVERITY_RECOVERABLE_ERROR
 AttributeDef[] getTriggeringAttributeDefs()
           
 java.lang.String[] getTriggeringAttributeNames()
           
 java.lang.String getValidatingAttributeName()
           
 java.lang.String getValidatorSubType()
           
 VariableValueManager getVariableManager()
          Returns this object's current Variable Value Manager.
protected  boolean hasValidationCondition()
           
 boolean hasVariables()
          Returns a flag indicating whether this object has Variables or not.
 void initErrMsgParms(ValidationException valEx, JboValidatorContext evObj, int severity)
           
 void initTriggeringAttributeDefs(StructureDef strDef)
           
 void initValidatorProperties(java.util.HashMap props)
           
 boolean isMovedToAttrLevel()
           
 boolean isTransactionLevel()
           
 boolean isTransactionLevel(JboValidatorContext valCtx)
           
protected  boolean isValidatable(JboValidatorContext evObj)
           
 void loadVariables(DefElement xmlElement)
           
 void loadXMLContents(DefElement elem)
           
static int parseSeverityStr(java.lang.String severityStr)
          Advanced internal method.
protected  void prepareException(ValidationException valEx, JboValidatorContext evObj, int severity)
           
 void raiseException(java.lang.Exception e, JboValidatorContext evObj)
           
 void raiseException(java.lang.Exception e, JboValidatorContext evObj, java.lang.String msgId, int severity)
           
protected  java.util.ArrayList readStringArrayList(DefElement rootElem, java.lang.String attrName, java.lang.String arrayName, boolean useNameAttr)
           
 java.lang.String readUserObject(DefElement rootElem, java.lang.String attrName)
           
 java.lang.String readUserObjectTrim(DefElement rootElem, java.lang.String attrName)
           
 java.util.HashMap readUserStringElementsMap(DefElement rootElem, java.lang.String elemName)
           
 void resolve(ValidationManager owner, StructureDef structDef, PersistableDefObject defObj)
           
protected  void setDefaultDescription(java.lang.String descId)
          Sets the textul description of this validator using locale message code.
 void setDescription(java.lang.String description)
          Sets the textul description of this validator using a specified string.
 void setErrorMessageClass(java.lang.Class clz)
           
 void setErrorMsgExpressions(java.util.Map map)
           
 void setErrorMsgId(java.lang.String msgId)
           
 void setErrorMsgIds(java.util.List msgIds)
           
 void setInverse(boolean bInverse)
          Allows the logic of this validator to be inverted.
 void setOnCondition(java.lang.String s)
           
 void setResourceBundleDef(ResourceBundleDef resourceBundleDef)
          setResourceBundleDef sets the mResourceBundleDef value
 void setResourceBundleId(java.lang.String bundleId)
           
 void setSeverity(int severity)
          severity should be one of the constants in oracle.jbo.JboWarning - one of: JboWarning.SEVERITY_ERROR , JboWarning.SEVERITY_WARNING, JboWarning.SEVERITY_VETOABLE_WARNING, or JboWarning.SEVERITY_RECOVERABLE_ERROR
 void setTransactionLevel(boolean bTransactionLevel)
           
 void setTriggeringAttributeNames(java.lang.String[] names)
           
 void setValidatingAttributeName(java.lang.String name)
           
 void writeChildren(DefWriter jos)
           
 void writeContents(DefWriter jos)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mbInverse

protected boolean mbInverse
Internal: Applications should not use these protected members directly.


mDescription

protected java.lang.String mDescription

mMsgId

protected java.lang.String mMsgId

mMsgIds

protected java.util.List<java.lang.String> mMsgIds

mMsgExpr

protected java.util.HashMap mMsgExpr

mErrorMessageClass

protected java.lang.Class mErrorMessageClass

mValidatingAttrName

protected java.lang.String mValidatingAttrName

mResourceBundleId

protected java.lang.String mResourceBundleId

mTriggeringAttributeNames

protected java.lang.String[] mTriggeringAttributeNames

mTriggeringAttributes

protected AttributeDef[] mTriggeringAttributes
Constructor Detail

AbstractValidator

public AbstractValidator()
Method Detail

clone

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

getOwner

public ValidationManager getOwner()

getValidatorSubType

public java.lang.String getValidatorSubType()

setErrorMessageClass

public void setErrorMessageClass(java.lang.Class clz)

getErrorMessageClass

public java.lang.Class getErrorMessageClass()

getResourceBundleDef

public ResourceBundleDef getResourceBundleDef()
getResourceBundleDef gets the mResourceBundleDef value

Specified by:
getResourceBundleDef in interface VariableManagerOwnerBase

setResourceBundleDef

public void setResourceBundleDef(ResourceBundleDef resourceBundleDef)
setResourceBundleDef sets the mResourceBundleDef value

Parameters:
resourceBundleDef - ResourceBundleDef

convertToJava

public java.lang.Object convertToJava(AttributeDef attrDef,
                                      java.lang.Object val)

setTransactionLevel

public void setTransactionLevel(boolean bTransactionLevel)

isTransactionLevel

public boolean isTransactionLevel()

isTransactionLevel

public boolean isTransactionLevel(JboValidatorContext valCtx)

setInverse

public void setInverse(boolean bInverse)
Allows the logic of this validator to be inverted.

Parameters:
bInverse - true if the validation result is to be inverted, and false if the validation result is not to be inverted.

getInverse

public boolean getInverse()
Reports whether the logic of this validator is inverted.

Returns:
true if the validation result is inverted, and false if the validation result is not inverted.

getDescription

public java.lang.String getDescription()
Gets the textul description of this validator.

Returns:
a documentation string.

setDescription

public void setDescription(java.lang.String description)
Sets the textul description of this validator using a specified string.

Parameters:
description - a documentation string.

setDefaultDescription

protected void setDefaultDescription(java.lang.String descId)
Sets the textul description of this validator using locale message code.

Parameters:
description - a message code.

getErrorMsgId

public java.lang.String getErrorMsgId()

setErrorMsgId

public void setErrorMsgId(java.lang.String msgId)

getResourceBundleId

public java.lang.String getResourceBundleId()

setResourceBundleId

public void setResourceBundleId(java.lang.String bundleId)

setErrorMsgIds

public void setErrorMsgIds(java.util.List msgIds)

getErrorMsgExpressions

public java.util.Map getErrorMsgExpressions()

setErrorMsgExpressions

public void setErrorMsgExpressions(java.util.Map map)

setValidatingAttributeName

public void setValidatingAttributeName(java.lang.String name)

getValidatingAttributeName

public java.lang.String getValidatingAttributeName()

getTriggeringAttributeNames

public java.lang.String[] getTriggeringAttributeNames()

getTriggeringAttributeDefs

public AttributeDef[] getTriggeringAttributeDefs()

setTriggeringAttributeNames

public void setTriggeringAttributeNames(java.lang.String[] names)

getName

public java.lang.String getName()
Description copied from interface: VariableManagerOwner
Returns the name of this Variable Manager Owner.

Specified by:
getName in interface VariableManagerOwner
Returns:
the name.

getFullName

public java.lang.String getFullName()

hasVariables

public boolean hasVariables()
Description copied from interface: VariableManagerOwnerBase
Returns a flag indicating whether this object has Variables or not.

Specified by:
hasVariables in interface VariableManagerOwnerBase
Returns:
the flag indicating whether this object has Variables.

isMovedToAttrLevel

public boolean isMovedToAttrLevel()

getOnCondition

public java.lang.String getOnCondition()

setOnCondition

public void setOnCondition(java.lang.String s)

ensureVariableManager

public VariableValueManager ensureVariableManager()
Description copied from interface: VariableManagerOwnerBase
Returns this object's Variable Value Manager. If this object current has no Variable Value Manager, it will initialize (create) one.

Specified by:
ensureVariableManager in interface VariableManagerOwnerBase
Returns:
this object's Variable Value Manager. Will create a Variable Value Manager if this object had no Variable Value Manager.

getVariableManager

public VariableValueManager getVariableManager()
Description copied from interface: VariableManagerOwnerBase
Returns this object's current Variable Value Manager. It will return null if Variable Value Manager has been initialized.

When a framework object is first created, its Variable Value Manager may be null. This method does not initialize (create) the Variable Value Manager.

VariableManagerOwnerBase.ensureVariableManager() in contrast, ensures that the Variable Value Manager is initialized (created).

Specified by:
getVariableManager in interface VariableManagerOwnerBase
Returns:
this object's current Variable Value Manager. May return null if one was not yet initialized.

getMessageBundleClass

public java.lang.Class getMessageBundleClass()
Specified by:
getMessageBundleClass in interface VariableManagerOwnerBase

loadVariables

public void loadVariables(DefElement xmlElement)

initValidatorProperties

public void initValidatorProperties(java.util.HashMap props)

initTriggeringAttributeDefs

public void initTriggeringAttributeDefs(StructureDef strDef)

loadXMLContents

public void loadXMLContents(DefElement elem)

writeChildren

public void writeChildren(DefWriter jos)

writeContents

public void writeContents(DefWriter jos)

resolve

public void resolve(ValidationManager owner,
                    StructureDef structDef,
                    PersistableDefObject defObj)

setSeverity

public void setSeverity(int severity)
severity should be one of the constants in oracle.jbo.JboWarning - one of: JboWarning.SEVERITY_ERROR , JboWarning.SEVERITY_WARNING, JboWarning.SEVERITY_VETOABLE_WARNING, or JboWarning.SEVERITY_RECOVERABLE_ERROR


getSeverity

public int getSeverity()
Returns severity as one of the constants in oracle.jbo.JboWarning : JboWarning.SEVERITY_ERROR , JboWarning.SEVERITY_WARNING, JboWarning.SEVERITY_VETOABLE_WARNING, or JboWarning.SEVERITY_RECOVERABLE_ERROR


parseSeverityStr

public static int parseSeverityStr(java.lang.String severityStr)
Advanced internal method.


initErrMsgParms

public void initErrMsgParms(ValidationException valEx,
                            JboValidatorContext evObj,
                            int severity)

prepareException

protected void prepareException(ValidationException valEx,
                                JboValidatorContext evObj,
                                int severity)

createException

public ValidationException createException(java.lang.Exception e,
                                           JboValidatorContext evObj,
                                           java.lang.String msgId,
                                           AttributeDef attrDef,
                                           java.lang.Object value,
                                           java.lang.String methodName,
                                           int severity)

raiseException

public void raiseException(java.lang.Exception e,
                           JboValidatorContext evObj)

raiseException

public void raiseException(java.lang.Exception e,
                           JboValidatorContext evObj,
                           java.lang.String msgId,
                           int severity)

createExprValueSupplier

protected ExprValueSupplier createExprValueSupplier(JboValidatorContext ctx)
For internal framework use only

For internal use only. Application developers should not use this

applyValidatorPersonalization

public AbstractValidator applyValidatorPersonalization(AbstractValidator orgVal)

isValidatable

protected boolean isValidatable(JboValidatorContext evObj)

hasValidationCondition

protected boolean hasValidationCondition()

readUserStringElementsMap

public java.util.HashMap readUserStringElementsMap(DefElement rootElem,
                                                   java.lang.String elemName)

readUserObjectTrim

public java.lang.String readUserObjectTrim(DefElement rootElem,
                                           java.lang.String attrName)

readUserObject

public java.lang.String readUserObject(DefElement rootElem,
                                       java.lang.String attrName)

readStringArrayList

protected java.util.ArrayList readStringArrayList(DefElement rootElem,
                                                  java.lang.String attrName,
                                                  java.lang.String arrayName,
                                                  boolean useNameAttr)

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

E10653-01

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