org.kuali.kfs.coa.document.validation.impl
Class SubAccountRule

java.lang.Object
  extended by org.kuali.rice.kns.rules.DocumentRuleBase
      extended by org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
          extended by org.kuali.kfs.coa.document.validation.impl.SubAccountRule
All Implemented Interfaces:
org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRule, org.kuali.rice.kns.rule.AddAdHocRoutePersonRule, org.kuali.rice.kns.rule.AddAdHocRouteWorkgroupRule, org.kuali.rice.kns.rule.AddCollectionLineRule, org.kuali.rice.kns.rule.AddNoteRule, org.kuali.rice.kns.rule.ApproveDocumentRule, org.kuali.rice.kns.rule.BusinessRule, org.kuali.rice.kns.rule.RouteDocumentRule, org.kuali.rice.kns.rule.SaveDocumentRule, org.kuali.rice.kns.rule.SendAdHocRequestsRule

public class SubAccountRule
extends org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase

This class implements the business rules specific to the SubAccount Maintenance Document.


Field Summary
protected static org.apache.log4j.Logger LOG
           
protected  SubAccount newSubAccount
           
protected  SubAccount oldSubAccount
           
 
Fields inherited from class org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
boDictionaryService, boService, businessObjectAuthorizationService, configService, ddService, dictionaryValidationService, DOCUMENT_ERROR_PREFIX, documentHelperService, MAINTAINABLE_ERROR_PATH, MAINTAINABLE_ERROR_PREFIX, maintDocDictionaryService, persistenceService, persistenceStructureService, personService, priorErrorPath, roleService, workflowDocumentService
 
Constructor Summary
SubAccountRule()
           
 
Method Summary
protected  boolean checkCgCostSharingIsEmpty()
          This method tests if all fields in the Cost Sharing section are empty.
protected  boolean checkCgCostSharingRules()
          This checks that if the cost share information is filled out that it is valid and exists, or if fields are missing (such as the chart of accounts code and account number) an error is recorded
protected  boolean checkCgIcrIsEmpty()
          This method tests if all fields in the ICR section are empty.
protected  boolean checkCgIcrRules()
          This checks that if the ICR information is entered that it is valid for this fiscal year and that all of its fields are valid as well (such as account)
protected  boolean checkCgRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          This checks to make sure that if cgAuthorized is false it succeeds immediately, otherwise it checks that all the information for CG is correctly entered and identified including: If the SubFundGroup isn't for Contracts and Grants then check to make sure that the cost share and ICR fields are not empty If it isn't a child of CG, then the SubAccount must be of type ICR
protected  boolean checkForPartiallyEnteredReportingFields()
          This checks that the reporting fields are entered altogether or none at all
protected  boolean disallowAnyValues(String value, String fieldName)
          This method tests the value entered, and if there is anything there it logs a new error, and returns false.
protected  boolean disallowChangedValues(String oldValue, String newValue, String fieldName)
          This method tests the two values entered, and if there is any change between the two, it logs an error, and returns false.
protected  String getDisplayName(String propertyName)
          This method retrieves the label name for a specific property
protected  boolean isFieldValueChanged(String oldValue, String newValue)
          This compares two string values to see if the newValue has changed from the oldValue
protected  boolean processCustomApproveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          This performs rules checks on document approve SubAccountRule#setCgAuthorized(boolean) checkForPartiallyEnteredReportingFields() checkCgRules(MaintenanceDocument) This rule fails on business rule failures
protected  boolean processCustomRouteDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          This performs rules checks on document route SubAccountRule#setCgAuthorized(boolean) checkForPartiallyEnteredReportingFields() checkCgRules(MaintenanceDocument) This rule fails on business rule failures
protected  boolean processCustomSaveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          This performs rules checks on document save SubAccountRule#setCgAuthorized(boolean) checkForPartiallyEnteredReportingFields() checkCgRules(MaintenanceDocument) This rule does not fail on business rule failures
 void setupConvenienceObjects()
          This method sets the convenience objects like newAccount and oldAccount, so you have short and easy handles to the new and old objects contained in the maintenance document.
 
Methods inherited from class org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
apcRuleFails, applyApcRule, checkEmptyBOField, checkEmptyDocumentField, checkEmptyValue, checkForPartiallyFilledOutReferenceForeignKeys, clearErrorPath, consolidateFieldNames, dataDictionaryValidate, errorAlreadyExists, getBoDictionaryService, getBoService, getBusinessObjectAuthorizationService, getConfigService, getDateTimeService, getDdService, getDictionaryValidationService, getDocumentHelperService, getFieldLabel, getFieldLabel, getHumanReadablePrimaryKeyFieldNames, getMaintDocDictionaryService, getNewBo, getOldBo, getPersistenceService, getPersistenceStructureService, getPersonService, getRoleService, getWorkflowDocumentService, isCorrectMaintenanceClass, isDocumentInactivatingBusinessObject, isDocumentValidForSave, primaryKeyCheck, processAddCollectionLineBusinessRules, processApproveDocument, processCustomAddCollectionLineBusinessRules, processGlobalApproveDocumentBusinessRules, processGlobalRouteDocumentBusinessRules, processGlobalSaveDocumentBusinessRules, processInactivationBlockChecking, processInactivationBlockChecking, processRouteDocument, processSaveDocument, putDocumentError, putDocumentError, putFieldError, putFieldError, putFieldError, putFieldErrorWithShortLabel, putGlobalError, putGlobalError, putGlobalError, putGlobalsError, putGlobalsError, putInactivationBlockingErrorOnPage, resumeErrorPath, setBoDictionaryService, setBoService, setBusinessObjectAuthorizationService, setConfigService, setDdService, setDictionaryValidationService, setDocumentHelperService, setMaintDocDictionaryService, setNewBo, setPersistenceService, setPersistenceStructureService, setPersonService, setupBaseConvenienceObjects, setWorkflowDocumentService, showErrorMap, validateDocumentStructure, validateDuplicateIdentifierInDataDictionary, validateGlobalBusinessObjectPersistable, validateMaintenanceDocument
 
Methods inherited from class org.kuali.rice.kns.rules.DocumentRuleBase
getDataDictionaryService, getIdentityManagementService, getKualiConfigurationService, getMaxDictionaryValidationDepth, getWorkflowInfoService, isAddHocRoutePersonValid, isAddHocRouteWorkgroupValid, isAdHocRouteRecipientsValid, isDocumentAttributesValid, isDocumentOverviewValid, isNoteValid, processAddAdHocRoutePerson, processAddAdHocRouteWorkgroup, processAddNote, processCustomAddAdHocRoutePersonBusinessRules, processCustomAddAdHocRouteWorkgroupBusinessRules, processCustomAddNoteBusinessRules, processCustomApproveDocumentBusinessRules, processCustomRouteDocumentBusinessRules, processCustomSaveDocumentBusinessRules, processCustomSendAdHocRequests, processSendAdHocRequests, setMaxDictionaryValidationDepth, validateSensitiveDataValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static org.apache.log4j.Logger LOG

oldSubAccount

protected SubAccount oldSubAccount

newSubAccount

protected SubAccount newSubAccount
Constructor Detail

SubAccountRule

public SubAccountRule()
Method Detail

processCustomApproveDocumentBusinessRules

protected boolean processCustomApproveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
This performs rules checks on document approve This rule fails on business rule failures

Overrides:
processCustomApproveDocumentBusinessRules in class org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
See Also:
MaintenanceDocumentRuleBase.processCustomApproveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument)

processCustomRouteDocumentBusinessRules

protected boolean processCustomRouteDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
This performs rules checks on document route This rule fails on business rule failures

Overrides:
processCustomRouteDocumentBusinessRules in class org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
See Also:
MaintenanceDocumentRuleBase.processCustomRouteDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument)

processCustomSaveDocumentBusinessRules

protected boolean processCustomSaveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
This performs rules checks on document save This rule does not fail on business rule failures

Overrides:
processCustomSaveDocumentBusinessRules in class org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
See Also:
MaintenanceDocumentRuleBase.processCustomSaveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument)

setupConvenienceObjects

public void setupConvenienceObjects()
This method sets the convenience objects like newAccount and oldAccount, so you have short and easy handles to the new and old objects contained in the maintenance document. It also calls the BusinessObjectBase.refresh(), which will attempt to load all sub-objects from the DB by their primary keys, if available.

Specified by:
setupConvenienceObjects in interface org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRule
Overrides:
setupConvenienceObjects in class org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
Parameters:
document - - the maintenanceDocument being evaluated

checkForPartiallyEnteredReportingFields

protected boolean checkForPartiallyEnteredReportingFields()
This checks that the reporting fields are entered altogether or none at all

Returns:
false if only one reporting field filled out and not all of them, true otherwise

checkCgRules

protected boolean checkCgRules(org.kuali.rice.kns.document.MaintenanceDocument document)
This checks to make sure that if cgAuthorized is false it succeeds immediately, otherwise it checks that all the information for CG is correctly entered and identified including:

Parameters:
document -
Returns:
true if the user is not authorized to change CG fields, otherwise it checks the above conditions

checkCgCostSharingRules

protected boolean checkCgCostSharingRules()
This checks that if the cost share information is filled out that it is valid and exists, or if fields are missing (such as the chart of accounts code and account number) an error is recorded

Returns:
true if all cost share fields filled out correctly, false if the chart of accounts code and account number for cost share are missing

checkCgIcrRules

protected boolean checkCgIcrRules()
This checks that if the ICR information is entered that it is valid for this fiscal year and that all of its fields are valid as well (such as account)

Returns:
true if the ICR information is filled in and it is valid

checkCgCostSharingIsEmpty

protected boolean checkCgCostSharingIsEmpty()
This method tests if all fields in the Cost Sharing section are empty.

Returns:
true if the cost sharing values passed in are empty, otherwise false.

checkCgIcrIsEmpty

protected boolean checkCgIcrIsEmpty()
This method tests if all fields in the ICR section are empty.

Returns:
true if the ICR values passed in are empty, otherwise false.

disallowAnyValues

protected boolean disallowAnyValues(String value,
                                    String fieldName)
This method tests the value entered, and if there is anything there it logs a new error, and returns false.

Parameters:
value - - String value to be tested
fieldName - - name of the field being tested
Returns:
false if there is any value in value, otherwise true

disallowChangedValues

protected boolean disallowChangedValues(String oldValue,
                                        String newValue,
                                        String fieldName)
This method tests the two values entered, and if there is any change between the two, it logs an error, and returns false. Note that the comparison is done after trimming both leading and trailing whitespace from both strings, and then doing a case-insensitive comparison.

Parameters:
oldValue - - the original String value of the field
newValue - - the new String value of the field
fieldName - - name of the field being tested
Returns:
false if there is any difference between the old and new, true otherwise

isFieldValueChanged

protected boolean isFieldValueChanged(String oldValue,
                                      String newValue)
This compares two string values to see if the newValue has changed from the oldValue

Parameters:
oldValue - - original value
newValue - - new value
Returns:
true if the two fields are different from each other

getDisplayName

protected String getDisplayName(String propertyName)
This method retrieves the label name for a specific property

Parameters:
propertyName - - property to retrieve label for (from the DD)
Returns:
the label


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