org.kuali.kfs.sys.document.validation.impl
Class AccountingLineValueAllowedValidation

java.lang.Object
  extended by org.kuali.kfs.sys.document.validation.ParameterizedValidation
      extended by org.kuali.kfs.sys.document.validation.GenericValidation
          extended by org.kuali.kfs.sys.document.validation.impl.AccountingLineValueAllowedValidation
All Implemented Interfaces:
Validation
Direct Known Subclasses:
JournalVoucherAccountingLineObjectTypeValueAllowedValidation, TransferOfFundsObjectCodeValueAllowedValidation, TransferOfFundsObjectSubTypeValueAllowedValidation

public class AccountingLineValueAllowedValidation
extends GenericValidation

A validation which uses parameters to determine if a value on an accounting line is valid.


Field Summary
protected  AccountingDocument accountingDocumentForValidation
           
protected  AccountingLine accountingLineForValidation
           
protected  org.kuali.rice.kns.service.ParameterService parameterService
           
protected  String parameterToCheckAgainst
           
protected  String propertyPath
           
protected  String responsibleProperty
           
 
Constructor Summary
AccountingLineValueAllowedValidation()
           
 
Method Summary
protected  Queue<String> convertPathToQueue(String path)
          Creates a Queue which represents a FIFO path of what properties to visit, based on the given property path
 AccountingDocument getAccountingDocumentForValidation()
          Gets the accountingDocumentForValidation attribute.
 AccountingLine getAccountingLineForValidation()
          Gets the accountingLineForValidation attribute.
 org.kuali.rice.kns.service.ParameterService getParameterService()
          Gets the parameterService attribute.
 String getParameterToCheckAgainst()
          Gets the parameterToCheckAgainst attribute.
 String getPropertyPath()
          Gets the propertyPath attribute.
 String getResponsibleProperty()
          Gets the responsibleProperty attribute.
protected  boolean isAccountingLineValueAllowed(Class documentClass, AccountingLine accountingLine, String parameterName, String propertyName, String userEnteredPropertyName)
          Checks that a value on an accounting line is valid, based on parameters, for a document of the given class
 void refreshByPath(AccountingLine line)
          Refreshes a value on the accounting line, using the propertyPath to decided what to refresh
protected  void refreshByQueue(org.kuali.rice.kns.bo.PersistableBusinessObject bo, Queue<String> path)
          Recursively refreshes a property given by the queue path
 void setAccountingDocumentForValidation(AccountingDocument accountingDocumentForValidation)
          Sets the accountingDocumentForValidation attribute value.
 void setAccountingLineForValidation(AccountingLine accountingLineForValidation)
          Sets the accountingLineForValidation attribute value.
 void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
          Sets the parameterService attribute value.
 void setParameterToCheckAgainst(String parameterToCheckAgainst)
          Sets the parameterToCheckAgainst attribute value.
 void setPropertyPath(String refreshPath)
          Sets the propertyPath attribute value.
 void setResponsibleProperty(String responsibleProperty)
          Sets the responsibleProperty attribute value.
 boolean validate(AttributedDocumentEvent event)
          Checks if a value in a given accounting line is allowed, based on system parameters.
 
Methods inherited from class org.kuali.kfs.sys.document.validation.GenericValidation
setQuitOnFail, shouldQuitOnFail, stageValidation
 
Methods inherited from class org.kuali.kfs.sys.document.validation.ParameterizedValidation
getParameterProperties, populateParameterFromEvent, populateParametersFromEvent, setParameterProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propertyPath

protected String propertyPath

parameterToCheckAgainst

protected String parameterToCheckAgainst

parameterService

protected org.kuali.rice.kns.service.ParameterService parameterService

responsibleProperty

protected String responsibleProperty

accountingDocumentForValidation

protected AccountingDocument accountingDocumentForValidation

accountingLineForValidation

protected AccountingLine accountingLineForValidation
Constructor Detail

AccountingLineValueAllowedValidation

public AccountingLineValueAllowedValidation()
Method Detail

validate

public boolean validate(AttributedDocumentEvent event)
Checks if a value in a given accounting line is allowed, based on system parameters. Expects an accounting document as the first parameter and accounting line as the second

Returns:
true if validation should continue, false otherwise
See Also:
org.kuali.kfs.sys.document.validation.GenericValidation#validate(java.lang.Object[])

isAccountingLineValueAllowed

protected boolean isAccountingLineValueAllowed(Class documentClass,
                                               AccountingLine accountingLine,
                                               String parameterName,
                                               String propertyName,
                                               String userEnteredPropertyName)
Checks that a value on an accounting line is valid, based on parameters, for a document of the given class

Parameters:
documentClass - the class of the document to check
accountingLine - the accounting line to check
parameterName - the name of the parameter to check
propertyName - the name of the property to check
userEnteredPropertyName - the value the user entered on the line
Returns:
true if this passes validation, false otherwise

refreshByPath

public void refreshByPath(AccountingLine line)
Refreshes a value on the accounting line, using the propertyPath to decided what to refresh

Parameters:
line - the accounting line to refresh a property on

convertPathToQueue

protected Queue<String> convertPathToQueue(String path)
Creates a Queue which represents a FIFO path of what properties to visit, based on the given property path

Parameters:
path - the path to convert to a Queue
Returns:
a Queue representing the path

refreshByQueue

protected void refreshByQueue(org.kuali.rice.kns.bo.PersistableBusinessObject bo,
                              Queue<String> path)
Recursively refreshes a property given by the queue path

Parameters:
bo - the business object to refresh
path - the path, in Queue form, of properties to refresh

getPropertyPath

public String getPropertyPath()
Gets the propertyPath attribute. This is the path to the value to check, e. g. "accountNumber.subFundGroup.fundGroupCode"

Returns:
Returns the propertyPath.

setPropertyPath

public void setPropertyPath(String refreshPath)
Sets the propertyPath attribute value. This is the path to the value to check, e. g. "accountNumber.subFundGroup.fundGroupCode"

Parameters:
propertyPath - The propertyPath to set.

getParameterService

public org.kuali.rice.kns.service.ParameterService getParameterService()
Gets the parameterService attribute.

Returns:
Returns the parameterService.

setParameterService

public void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
Sets the parameterService attribute value.

Parameters:
parameterService - The parameterService to set.

getParameterToCheckAgainst

public String getParameterToCheckAgainst()
Gets the parameterToCheckAgainst attribute. This is the name of the parameter which has the values to validate against.

Returns:
Returns the parameterToCheckAgainst.

setParameterToCheckAgainst

public void setParameterToCheckAgainst(String parameterToCheckAgainst)
Sets the parameterToCheckAgainst attribute value. This is the name of the parameter which has the values to validate against.

Parameters:
parameterToCheckAgainst - The parameterToCheckAgainst to set.

getResponsibleProperty

public String getResponsibleProperty()
Gets the responsibleProperty attribute. This is the property on the accounting line to show the error on.

Returns:
Returns the responsibleProperty.

setResponsibleProperty

public void setResponsibleProperty(String responsibleProperty)
Sets the responsibleProperty attribute value. This is the property on the accounting line to show the error on.

Parameters:
responsibleProperty - The responsibleProperty to set.

getAccountingDocumentForValidation

public AccountingDocument getAccountingDocumentForValidation()
Gets the accountingDocumentForValidation attribute.

Returns:
Returns the accountingDocumentForValidation.

setAccountingDocumentForValidation

public void setAccountingDocumentForValidation(AccountingDocument accountingDocumentForValidation)
Sets the accountingDocumentForValidation attribute value.

Parameters:
accountingDocumentForValidation - The accountingDocumentForValidation to set.

getAccountingLineForValidation

public AccountingLine getAccountingLineForValidation()
Gets the accountingLineForValidation attribute.

Returns:
Returns the accountingLineForValidation.

setAccountingLineForValidation

public void setAccountingLineForValidation(AccountingLine accountingLineForValidation)
Sets the accountingLineForValidation attribute value.

Parameters:
accountingLineForValidation - The accountingLineForValidation to set.


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.