org.jaffa.rules
Class RulesEngine

java.lang.Object
  extended byorg.jaffa.rules.RulesEngine

public class RulesEngine
extends Object

This class provides methods to validate a field or a domain object. It will utilise the XML configuration files to determine the rules to invoke for the validations. If the variation has been set for the Thread [for eg. the Portlet Servlet or WebServicesWrapper calling the VariationContext.setVariation()], then that variation will be used to determine the rules.


Constructor Summary
RulesEngine()
           
 
Method Summary
static void doAllValidationsForDomainField(String domainClassName, String fieldName, Object fieldValue, UOW uow)
          This will invoke all the Rules defined for the field.
static void doAllValidationsForDomainObject(Object domainObject, UOW uow)
          This will invoke all the Rules defined for the fields of the Domain object.
static void doMandatoryValidationsForDomainField(String domainClassName, String fieldName, Object fieldValue, UOW uow)
          This will only invoke the 'Mandatory' Rules defined for the field.
static void doMandatoryValidationsForDomainObject(Object domainObject, UOW uow)
          This will only invoke the 'Mandatory' Rules defined for the fields of the Domain object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RulesEngine

public RulesEngine()
Method Detail

doMandatoryValidationsForDomainField

public static void doMandatoryValidationsForDomainField(String domainClassName,
                                                        String fieldName,
                                                        Object fieldValue,
                                                        UOW uow)
                                                 throws ValidationException,
                                                        FrameworkException
This will only invoke the 'Mandatory' Rules defined for the field.

Parameters:
domainClassName - The domain class to which the field belongs.
fieldName - The field to be validated.
fieldValue - The value to be validated.
uow - The UOW.
Throws:
ValidationException - if any validation rule fails.
FrameworkException - if any framework error occurs.

doAllValidationsForDomainField

public static void doAllValidationsForDomainField(String domainClassName,
                                                  String fieldName,
                                                  Object fieldValue,
                                                  UOW uow)
                                           throws ValidationException,
                                                  FrameworkException
This will invoke all the Rules defined for the field.

Parameters:
domainClassName - The domain class to which the field belongs.
fieldName - The field to be validated.
fieldValue - The value to be validated.
uow - The UOW.
Throws:
ValidationException - if any validation rule fails.
FrameworkException - if any framework error occurs.

doMandatoryValidationsForDomainObject

public static void doMandatoryValidationsForDomainObject(Object domainObject,
                                                         UOW uow)
                                                  throws ValidationException,
                                                         FrameworkException
This will only invoke the 'Mandatory' Rules defined for the fields of the Domain object.

Parameters:
domainObject - The domain object to be validated.
uow - The UOW.
Throws:
ValidationException - if any validation rule fails.
FrameworkException - if any framework error occurs.

doAllValidationsForDomainObject

public static void doAllValidationsForDomainObject(Object domainObject,
                                                   UOW uow)
                                            throws ValidationException,
                                                   FrameworkException
This will invoke all the Rules defined for the fields of the Domain object.

Parameters:
domainObject - The domain object to be validated.
uow - The UOW.
Throws:
ValidationException - if any validation rule fails.
FrameworkException - if any framework error occurs.


Copyright © 2002-2004 JAFFA Project.