org.jaffa.rules.fieldvalidators
Class GenericForeignKeyFieldValidator

java.lang.Object
  extended byorg.jaffa.rules.fieldvalidators.AbstractFieldValidator
      extended byorg.jaffa.rules.fieldvalidators.GenericForeignKeyFieldValidator
All Implemented Interfaces:
IFieldValidator

public class GenericForeignKeyFieldValidator
extends AbstractFieldValidator

This validates a field against a set of valid values for that field, as listed in a database table For eg. Lets assume that there is database table 'VALID_FIELD_VALUE' which holds a set of valid values for certain fields in the system. The structure of this table 'VALID_FIELD_VALUE' in oracle can be like - TABLE_NAME NOT NULL VARCHAR2(20) FIELD_NAME NOT NULL VARCHAR2(30) LEGAL_VALUE NOT NULL VARCHAR2(20) This table can hold values like - TABLE_NAME FIELD_NAME LEGAL_VALUE ========== ========== =========== USER DEPARTMENT ACCOUNTS USER DEPARTMENT ENGINEERING USER DEPARTMENT PERSONNEL ITEM TYPE CONSUMABLE ITEM TYPE NON-CONSUMABLE This way, the table can hold valid values for the different fields The generic implementation provides the ValidFieldValue domain class and its mapping file. Tweak its mapping file to map it to the correct table and fields. Or specify your own domain class. The GenericForeignKeyFieldValidator definition in validators.xml requires the appropriate values to be passed in parameters.


Constructor Summary
GenericForeignKeyFieldValidator()
           
 
Method Summary
 String getDomainClassName()
          Getter for property domainClassName.
 String getFieldName()
          Getter for property fieldName.
 String getFieldNameForField()
          Getter for property fieldNameForField.
 String getFieldNameForTable()
          Getter for property fieldNameForTable.
 String getFieldNameForValue()
          Getter for property fieldNameForValue.
 String getTableName()
          Getter for property tableName.
 void setDomainClassName(String domainClassName)
          Setter for property domainClassName.
 void setFieldName(String fieldName)
          Setter for property fieldName.
 void setFieldNameForField(String fieldNameForField)
          Setter for property fieldNameForField.
 void setFieldNameForTable(String fieldNameForTable)
          Setter for property fieldNameForTable.
 void setFieldNameForValue(String fieldNameForValue)
          Setter for property fieldNameForValue.
 void setTableName(String tableName)
          Setter for property tableName.
 void validate()
          The RulesEngine will invoke this method to perform the field validation.
 
Methods inherited from class org.jaffa.rules.fieldvalidators.AbstractFieldValidator
cleanup, getLabelToken, getUow, getValue, init, setLabelToken, setUow, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericForeignKeyFieldValidator

public GenericForeignKeyFieldValidator()
Method Detail

getDomainClassName

public String getDomainClassName()
Getter for property domainClassName.

Returns:
Value of property domainClassName.

setDomainClassName

public void setDomainClassName(String domainClassName)
Setter for property domainClassName.

Parameters:
domainClassName - New value of property domainClassName.

getFieldNameForTable

public String getFieldNameForTable()
Getter for property fieldNameForTable.

Returns:
Value of property fieldNameForTable.

setFieldNameForTable

public void setFieldNameForTable(String fieldNameForTable)
Setter for property fieldNameForTable.

Parameters:
fieldNameForTable - New value of property fieldNameForTable.

getFieldNameForField

public String getFieldNameForField()
Getter for property fieldNameForField.

Returns:
Value of property fieldNameForField.

setFieldNameForField

public void setFieldNameForField(String fieldNameForField)
Setter for property fieldNameForField.

Parameters:
fieldNameForField - New value of property fieldNameForField.

getFieldNameForValue

public String getFieldNameForValue()
Getter for property fieldNameForValue.

Returns:
Value of property fieldNameForValue.

setFieldNameForValue

public void setFieldNameForValue(String fieldNameForValue)
Setter for property fieldNameForValue.

Parameters:
fieldNameForValue - New value of property fieldNameForValue.

getTableName

public String getTableName()
Getter for property tableName.

Returns:
Value of property tableName.

setTableName

public void setTableName(String tableName)
Setter for property tableName.

Parameters:
tableName - New value of property tableName.

getFieldName

public String getFieldName()
Getter for property fieldName.

Returns:
Value of property fieldName.

setFieldName

public void setFieldName(String fieldName)
Setter for property fieldName.

Parameters:
fieldName - New value of property fieldName.

validate

public void validate()
              throws ValidationException,
                     FrameworkException
The RulesEngine will invoke this method to perform the field validation.

Specified by:
validate in interface IFieldValidator
Specified by:
validate in class AbstractFieldValidator
Throws:
ValidationException - if any validation rule fails.
FrameworkException - if any framework error occurs.


Copyright © 2002-2004 JAFFA Project.