oracle.clex.process
Class ValidateAttributes

java.lang.Object
  |
  +--oracle.cle.process.Process
        |
        +--oracle.cle.process.GenericProcess
              |
              +--oracle.clex.process.ValidateAttributes
All Implemented Interfaces:
Child, java.lang.Cloneable, ProcessConstants, java.io.Serializable, State

public class ValidateAttributes
extends GenericProcess

Class validates a set of attributes defined in an XML file, based on the corresponding values in the info table. Validation errors are accumulated in a Hashtable which is stored in a result labeled processfeedback. processfeedback is specified as ProcessConstants.PROCESS_FEEDBACK This class should be extended to add functionality, using the runCustomValidation method.

The DTD for this file can be found here: http://xmlns.oracle.com/ias/mvc/cle-validation-rules.dtd

Example1: For conditonal validation <attribute name="lastname" descriptiveName="last name"> <conditionalvalidation value="REQUIRED" message="firstname and SSN have to be entered when lastname is entered"> <dependentAttribute descriptiveName="first name" >firstname</dependentAttribute> <dependentAttribute descriptiveName="SSN" >ssn</dependentAttribute> </conditionalvalidation> <conditionalvalidation value="NULL"> <dependentAttribute descriptiveName="Search Type" >searchtype</dependentAttribute> </conditionalvalidation> <conditionalvalidation value="REQUIRESONE" > <dependentAttribute descriptiveName="first name" >firstname</dependentAttribute> <dependentAttribute descriptiveName="SSN" >ssn</dependentAttribute> </conditionalvalidation> </attribute> Example2: lt&;attribute name="ssn" descriptiveName="ssn"> lt&;datatype message="SSN must be a number">intlt&;/datatype> lt&;mandatory message="SSN is required">Ylt&;/mandatory> lt&;length message="SSN must be a nine digit number">9lt&;/length> lt&;/attribute>

See Also:
Serialized Form

Fields inherited from class oracle.cle.process.GenericProcess
parent
 
Fields inherited from class oracle.cle.process.Process
condition, DEBUG, endState, FAILURE, name, processes, service, stateMachine, SUCCESS, TRANSITION_CONDITION_FAILURE, TRANSITION_CONDITION_SUCCESS
 
Fields inherited from interface oracle.cle.process.ProcessConstants
ALLINFO, BINARYSIZE, CONNECTION_PROVIDER_DTD_NAME, CONNECTION_PROVIDER_VALIDATION_PROPERTY, CONTENTTYPE, CURRENTPAGEID, CURRENTSERVICE, ERRORMESSAGE, GENERICBINARYRESULT, GENERICTEXTRESULT, GETINFO_CHECK_ALL, GETINFO_CHECK_CONTROLLERONLY, GETINFO_CHECK_SERVICEONLY, HTML, HTMLRESULT, JSPRESULT, LOGOFF, NOMESSAGE, PAGEID, PDF, PDFRESULT, PRE_GROUP_DTD_NAME, PRE_GROUP_VALIDATION_PROPERTY, PROCESS_FEEDBACK, RESTART, RESULTTYPE, RULES_DTD_NAME, SERVICE_DESCRIPTOR, SERVICE_DTD_NAME, SERVICE_VALIDATION_PROPERTY, SERVICEINITIALSTATE, SERVICENAME, SESSIONID, SKIP, STACKTRACE, USER, USERROLE, WML, XML, XMLRESULT
 
Constructor Summary
ValidateAttributes(java.lang.String aXMLRuleFileKey)
          Deprecated. This constructor may be changed to behave the same as ValidateAttributes(filename, false) in future releases. Currently, this constructor currently uses the aXMLRuleFileKey to lookup the location of a file from the info table...
ValidateAttributes(java.lang.String aXMLRuleFile, boolean lookupFileLocation)
          This constructor provides a mechanism to lookup the xml rule file as a resource (pass the filename for the xml file if the file can be found at the top of the classpath) or based on a URL (i.e.
ValidateAttributes(java.lang.String aXMLRuleFile, boolean lookupFileLocation, boolean complexResults)
          If complexResults is true, then the PROCESS_FEEDBACK result will be a Hashtable of Lists.
 
Method Summary
 java.lang.Object clone()
           
protected  java.util.Hashtable getDependentValues(java.util.Vector dependents)
          Returns all the dependent values from the infoTable as key:valuepairs in a Hashtable.
protected  java.lang.String getParameterValue(java.lang.String name)
          Gets the parameter value from the infotable
protected  TransitionCondition getValidateFailureCondition()
          Get the condition in the event that the validation fails.
protected  TransitionCondition getValidateSuccessCondition()
          Get the condition in the event that the validate is successful.
 java.util.Map loadAttributes(java.lang.String locationOrFile)
          Processes the xml rule file.
protected  java.lang.String lookupPageLocation(java.lang.String key)
          Does the infoTable lookup for an HTML page keyed by the specified String.
protected  void registerInfo()
          Register ProcessResults(PROCESS_FEEDBACK).
protected  boolean runCustomValidation(java.util.Hashtable errorMessages)
          Run validations and add errors to the specified errorMessages Hashtable.
protected  boolean runCustomValidation(java.util.Vector errorMessages)
          Run validations and add errors to the specified errorMessages Vector.
 void start()
          Start method of the process
 
Methods inherited from class oracle.cle.process.GenericProcess
getBooleanInfo, getFloatInfo, getInfo, getInfo, getInfo, getInfoValue, getInfoValue, getInfoValueFromController, getInfoValueFromService, getIntegerInfo, getParameterNamed, getParameters, getParent, getParents, getResultNamed, getResults, getSessionId, getStringInfo, processParameters, processResults, registerBooleanParameter, registerBooleanResult, registerIntegerParameter, registerIntegerResult, registerParameter, registerProcessInfo, registerResult, registerStringArrayParameter, registerStringArrayResult, registerStringParameter, registerStringParameter, registerStringResult, registerStringResult, retrieveStringParameter, runTest, setParent, setResult, setResult, setResult
 
Methods inherited from class oracle.cle.process.Process
addCondition, addProcess, cloneProcess, debug, generateFailureCondition, generateSuccessCondition, getClassname, getCondition, getConditions, getIconName, getImageName, getName, getProcesses, getProcessNamed, getStateMachine, hashCode, isEndState, removeCondition, removeCondition, reportException, returnCondition, setCondition, setCondition, setEndState, setName, setService, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValidateAttributes

public ValidateAttributes(java.lang.String aXMLRuleFileKey)
Deprecated. This constructor may be changed to behave the same as ValidateAttributes(filename, false) in future releases. Currently, this constructor currently uses the aXMLRuleFileKey to lookup the location of a file from the info table...


ValidateAttributes

public ValidateAttributes(java.lang.String aXMLRuleFile,
                          boolean lookupFileLocation)
This constructor provides a mechanism to lookup the xml rule file as a resource (pass the filename for the xml file if the file can be found at the top of the classpath) or based on a URL (i.e. passing in the xml file along with its path via file:/// or http:// protocol). To use this mechanism, set the to lookup argument false. Setting the lookup key to true will cause the process to lookup the location based on an infotable key specified in the constructor (i.e. via seedinfo).
Parameters:
java.lang.String -  
boolean -  

ValidateAttributes

public ValidateAttributes(java.lang.String aXMLRuleFile,
                          boolean lookupFileLocation,
                          boolean complexResults)
If complexResults is true, then the PROCESS_FEEDBACK result will be a Hashtable of Lists. Each Hashtable entry would be keyed by the attribute name (ie. ssn) and the List value would contain all the error messages for that attribute. Otherwise, this Constructor is the same as ValidateAttributes(aXMLRuleFile, boolean lookup)
Parameters:
java.lang.String -  
boolean -  
boolean -  
Method Detail

start

public void start()
Start method of the process
Overrides:
start in class GenericProcess

registerInfo

protected void registerInfo()
Register ProcessResults(PROCESS_FEEDBACK).
Overrides:
registerInfo in class GenericProcess

getParameterValue

protected java.lang.String getParameterValue(java.lang.String name)
Gets the parameter value from the infotable

getDependentValues

protected java.util.Hashtable getDependentValues(java.util.Vector dependents)
Returns all the dependent values from the infoTable as key:valuepairs in a Hashtable.

loadAttributes

public java.util.Map loadAttributes(java.lang.String locationOrFile)
                             throws java.lang.Exception
Processes the xml rule file. This method should lazy load the attributes attribute. By doing this, the default implementation of ValidateAttributes avoids parsing the rules xml file for each request.

NOTE: This method replaces getAttributes() in previous releases


getValidateSuccessCondition

protected TransitionCondition getValidateSuccessCondition()
Get the condition in the event that the validate is successful. This method can be overriden to provide complex logic and be placed here after a successful validation such as setResult, etc... If this method is not overriden, it will return the SUCCESS TransitionCondition
Returns:
oracle.cle.util.statemachine.TransitionCondition

getValidateFailureCondition

protected TransitionCondition getValidateFailureCondition()
Get the condition in the event that the validation fails. This method can be overriden to provide complex logic and be placed here after a failed validation such as setResult, etc... If this method is not overriden, it will return the FAILURE TransitionCondition
Returns:
oracle.cle.util.statemachine.TransitionCondition

lookupPageLocation

protected java.lang.String lookupPageLocation(java.lang.String key)
                                       throws java.lang.Exception
Does the infoTable lookup for an HTML page keyed by the specified String.
Throws:
java.lang.Exception -  

runCustomValidation

protected boolean runCustomValidation(java.util.Vector errorMessages)
Run validations and add errors to the specified errorMessages Vector. Returns true if there are no errors, false otherwise.

runCustomValidation

protected boolean runCustomValidation(java.util.Hashtable errorMessages)
Run validations and add errors to the specified errorMessages Hashtable. Returns true if there are no errors, false otherwise.

clone

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


Copyright © 2003 ORACLE Corp. All Rights Reserved.