biz.c24.io.api.data
Class XPathRule

java.lang.Object
  extended by biz.c24.io.api.data.DefaultValidationRule
      extended by biz.c24.io.api.data.XPathRule
All Implemented Interfaces:
ModelComponent, ValidationRule, Validator, Serializable

public class XPathRule
extends DefaultValidationRule

A validation rule which uses an XPath statement to resolve a boolean value which determines whether the rule will pass or fail.

In the case of a failure the errorMessage attribute is passed to the validation mechanism.

Warning: Serialized objects of this class or of a deployed class which is derived from it may not be compatible with future releases of C24 Integreation Objects. The current serialization support is appropriate for short term storage or RMI between applications running the same version of C24 Integreation Objects.

See Also:
DomainConstraintManager, Serialized Form

Constructor Summary
XPathRule()
          Creates a new instance.
 
Method Summary
 String getErrorMessage()
          Returns the error message which is used if the rule fails.
 XPathStatement getStatement()
          Returns the XPath statement which is evaluated to decide if the rule passes or fails.
 void setErrorMessage(String errorMessage)
          Sets the error message which is used if the rule fails.
 void setStatement(XPathStatement statement)
          Sets the XPath statement which is evaluated to decide if the rule passes or fails.
 String toString()
           
 boolean validate(Object object, DataComponent component, ComplexDataObject context, ValidationManager manager)
          Validate the given object.
 
Methods inherited from class biz.c24.io.api.data.DefaultValidationRule
addDependentPredicateCode, getAnnotation, getContextForPredicateChecking, getDependentPredicateCode, getDependentPredicateCodeCount, getErrorCode, getName, getPredicateCode, getSeverity, removeDependentPredicateCode, setAnnotation, setErrorCode, setName, setPredicateCode, setSeverity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XPathRule

public XPathRule()
Creates a new instance.

Method Detail

getStatement

public XPathStatement getStatement()
Returns the XPath statement which is evaluated to decide if the rule passes or fails.

Returns:
The XPath statement.

setStatement

public void setStatement(XPathStatement statement)
Sets the XPath statement which is evaluated to decide if the rule passes or fails.

Parameters:
statement - The statement.

getErrorMessage

public String getErrorMessage()
Returns the error message which is used if the rule fails.

Returns:
The error message.

setErrorMessage

public void setErrorMessage(String errorMessage)
Sets the error message which is used if the rule fails.

Parameters:
errorMessage - The error message.

validate

public boolean validate(Object object,
                        DataComponent component,
                        ComplexDataObject context,
                        ValidationManager manager)
                 throws ValidationException
Description copied from interface: Validator
Validate the given object.

Specified by:
validate in interface Validator
Overrides:
validate in class DefaultValidationRule
Parameters:
object - The object to be validated - commonly a String, Integer, Double, Date etc.
component - The Element or Attribute inside context which defines object.
context - The parent of object - could be null.
manager - The validation manager which is performing this validation.
Returns:
Whether the object is valid if the validation manager is not operating in exception mode.
Throws:
ValidationException - If the object is not valid and the validation maanger is operating in exception mode.

toString

public String toString()
Overrides:
toString in class DefaultValidationRule


C24 Technologies © 2002-2012: All Rights Reserved.