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

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.sys.document.validation.impl.KfsMaintenanceDocumentRuleBase
              extended by org.kuali.kfs.coa.document.validation.impl.GlobalDocumentRuleBase
                  extended by org.kuali.kfs.coa.document.validation.impl.DelegateGlobalRule
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 DelegateGlobalRule
extends GlobalDocumentRuleBase

This class executes specific rules for the DelegateGlobalMaintenanceDocument


Nested Class Summary
 
Nested classes/interfaces inherited from class org.kuali.kfs.coa.document.validation.impl.GlobalDocumentRuleBase
GlobalDocumentRuleBase.CheckOnlyOneChartResult
 
Field Summary
protected static String DELEGATE_GLOBALS_PREFIX
           
protected static org.apache.log4j.Logger LOG
           
protected  AccountDelegateGlobal newDelegateGlobal
           
protected static org.kuali.rice.kns.util.KualiDecimal ZERO
           
 
Fields inherited from class org.kuali.kfs.sys.document.validation.impl.KfsMaintenanceDocumentRuleBase
financialSystemUserService, personService
 
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, priorErrorPath, roleService, workflowDocumentService
 
Constructor Summary
DelegateGlobalRule()
           
 
Method Summary
 boolean checkAccountDetails(AccountGlobalDetail dtl)
          This checks to make sure that each AccountGlobalDetail has a valid Account
 boolean checkAccountDetails(List<AccountGlobalDetail> details)
          This checks to see if there are any accounts in the details collection if there are then it calls checkAccountDetails(AccountGlobalDetail)
protected  boolean checkDelegateDocumentTypeCode(String documentTypeCode, FinancialSystemDocumentTypeService documentService)
          Validates the document type code for the delegate, to make sure it is a Financial System document type code
protected  boolean checkDelegateFromAmtGreaterThanEqualZero(org.kuali.rice.kns.util.KualiDecimal fromAmount, int lineNum, boolean add)
          This method checks to see if the from amount is greater than zero
protected  boolean checkDelegateToAmtGreaterThanFromAmt(org.kuali.rice.kns.util.KualiDecimal fromAmount, org.kuali.rice.kns.util.KualiDecimal toAmount, int lineNum, boolean add)
          This method checks to see if the to Amount is greater than the from amount
protected  boolean checkDelegateUserRules(org.kuali.rice.kns.document.MaintenanceDocument document, AccountDelegateGlobalDetail delegateGlobal, int lineNum, boolean add)
          This checks that the delegate for this Account exists and is valid (active and a professional)
protected  boolean checkForPrimaryDelegateAllLines()
          This method will check through each delegate referenced in the DelegateGlobal to ensure that there is one and only primary for each account and doctype
protected  Integer checkPrimaryRoutePerDocType(AccountDelegateGlobalDetail delegateGlobalToTest, List<AccountDelegateGlobalDetail> delegateGlobals, Integer testLineNum)
          This method validates the rule that says there can be only one PrimaryRoute delegate for each given docType.
protected  boolean checkPrimaryRouteRules(List<AccountDelegateGlobalDetail> delegateGlobals, AccountDelegateGlobalDetail delegateGlobalToTest, Integer lineNum, boolean add)
          This checks that the primary routing for delegates is correct, specifically that - there is not already a primary route delegate setup for this Account
protected  boolean checkSimpleRulesAllLines(org.kuali.rice.kns.document.MaintenanceDocument document)
          This method checks the simple rules for all lines at once and gets called on save, submit, etc.
 boolean processCustomAddCollectionLineBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document, String collectionName, org.kuali.rice.kns.bo.PersistableBusinessObject bo)
          This checks that when a new line is added (either AccountGlobalDetail or DelegateGlobalDetail) that the appropriate rules are run on the new lines being added on AccountGlobalDetail: - make sure that the account number and chart are entered checkAccountDetails(AccountGlobalDetail) on DelegateGlobalDetail checkDelegateFromAmtGreaterThanEqualZero(KualiDecimal, int, boolean) DelegateGlobalRule#checkDelegateForNullToAmount(KualiDecimal, KualiDecimal, int, boolean) checkDelegateToAmtGreaterThanFromAmt(KualiDecimal, KualiDecimal, int, boolean) DelegateGlobalRule#checkDelegateUserRules(DelegateGlobalDetail, int, boolean) DelegateGlobalRule#checkPrimaryRouteRules(List, DelegateGlobalDetail, Integer, boolean)
protected  boolean processCustomApproveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          This checks some basic rules for document approval Specifically it calls the following: DelegateGlobalRule#checkSimpleRulesAllLines() GlobalDocumentRuleBase.checkOnlyOneChartErrorWrapper(List) checkForPrimaryDelegateAllLines() fails if any rules fail
protected  boolean processCustomRouteDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          This checks some basic rules for document routing Specifically it calls the following: DelegateGlobalRule#checkSimpleRulesAllLines() checkAccountDetails(List) checkForPrimaryDelegateAllLines() fails if any rules fail
protected  boolean processCustomSaveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          This checks some basic rules for document saving Specifically it calls the following: DelegateGlobalRule#checkSimpleRulesAllLines() GlobalDocumentRuleBase.checkOnlyOneChartErrorWrapper(List) checkForPrimaryDelegateAllLines() fails if any rules fail
 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.kfs.coa.document.validation.impl.GlobalDocumentRuleBase
checkOnlyOneChart, checkOnlyOneChartAddLine, checkOnlyOneChartAddLineErrorWrapper, checkOnlyOneChartErrorWrapper
 
Methods inherited from class org.kuali.kfs.sys.document.validation.impl.KfsMaintenanceDocumentRuleBase
getFinancialSystemUserService, getKfsUserService
 
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, 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

ZERO

protected static final org.kuali.rice.kns.util.KualiDecimal ZERO

newDelegateGlobal

protected AccountDelegateGlobal newDelegateGlobal

DELEGATE_GLOBALS_PREFIX

protected static final String DELEGATE_GLOBALS_PREFIX
See Also:
Constant Field Values
Constructor Detail

DelegateGlobalRule

public DelegateGlobalRule()
Method Detail

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

processCustomApproveDocumentBusinessRules

protected boolean processCustomApproveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
This checks some basic rules for document approval Specifically it calls the following: fails if any rules fail

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 checks some basic rules for document routing Specifically it calls the following: fails if any rules fail

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 checks some basic rules for document saving Specifically it calls the following: fails if any rules fail

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

checkAccountDetails

public boolean checkAccountDetails(List<AccountGlobalDetail> details)
This checks to see if there are any accounts in the details collection if there are then it calls checkAccountDetails(AccountGlobalDetail)

Parameters:
details - - collection of AccountGlobalDetails
Returns:
false if there are no objects in the collection or any one of the AccountGlobalDetail fail

checkAccountDetails

public boolean checkAccountDetails(AccountGlobalDetail dtl)
This checks to make sure that each AccountGlobalDetail has a valid Account

Parameters:
dtl - - the AccountGlobalDetail
Returns:
false if it does not have a valid Account

checkSimpleRulesAllLines

protected boolean checkSimpleRulesAllLines(org.kuali.rice.kns.document.MaintenanceDocument document)
This method checks the simple rules for all lines at once and gets called on save, submit, etc. but not on add Specifically it calls the following:

Returns:

checkForPrimaryDelegateAllLines

protected boolean checkForPrimaryDelegateAllLines()
This method will check through each delegate referenced in the DelegateGlobal to ensure that there is one and only primary for each account and doctype

Returns:
false if there is more than one primary delegate

checkDelegateFromAmtGreaterThanEqualZero

protected boolean checkDelegateFromAmtGreaterThanEqualZero(org.kuali.rice.kns.util.KualiDecimal fromAmount,
                                                           int lineNum,
                                                           boolean add)
This method checks to see if the from amount is greater than zero

Parameters:
fromAmount -
lineNum -
Returns:
false if from amount less than zero

checkDelegateToAmtGreaterThanFromAmt

protected boolean checkDelegateToAmtGreaterThanFromAmt(org.kuali.rice.kns.util.KualiDecimal fromAmount,
                                                       org.kuali.rice.kns.util.KualiDecimal toAmount,
                                                       int lineNum,
                                                       boolean add)
This method checks to see if the to Amount is greater than the from amount

Parameters:
fromAmount -
toAmount -
lineNum -
Returns:
false if to amount less than from amount

checkDelegateDocumentTypeCode

protected boolean checkDelegateDocumentTypeCode(String documentTypeCode,
                                                FinancialSystemDocumentTypeService documentService)
Validates the document type code for the delegate, to make sure it is a Financial System document type code

Parameters:
documentTypeCode - the document type code to check
delegateService - a helpful instance of the delegate service, so new ones don't have to be created all the time
Returns:
true if the document type code is valid, false otherwise

checkPrimaryRoutePerDocType

protected Integer checkPrimaryRoutePerDocType(AccountDelegateGlobalDetail delegateGlobalToTest,
                                              List<AccountDelegateGlobalDetail> delegateGlobals,
                                              Integer testLineNum)
This method validates the rule that says there can be only one PrimaryRoute delegate for each given docType. It checks the delegateGlobalToTest against the list, to determine whether adding this new delegateGlobalToTest would violate any PrimaryRoute business rule violations. If any of the incoming variables is null or empty, the method will do nothing, and return Null. It will only process the business rules if there is sufficient data to do so.

Parameters:
delegateGlobalToTest - A delegateGlobal line that you want to test against the list.
delegateGlobals - A List of delegateGlobal items that is being tested against.
Returns:
Null if the business rule passes, or an Integer value greater than zero, representing the line that the new line is conflicting with

checkPrimaryRouteRules

protected boolean checkPrimaryRouteRules(List<AccountDelegateGlobalDetail> delegateGlobals,
                                         AccountDelegateGlobalDetail delegateGlobalToTest,
                                         Integer lineNum,
                                         boolean add)
This checks that the primary routing for delegates is correct, specifically that - there is not already a primary route delegate setup for this Account

Parameters:
delegateGlobals -
delegateGlobalToTest -
lineNum -
add -
Returns:

checkDelegateUserRules

protected boolean checkDelegateUserRules(org.kuali.rice.kns.document.MaintenanceDocument document,
                                         AccountDelegateGlobalDetail delegateGlobal,
                                         int lineNum,
                                         boolean add)
This checks that the delegate for this Account exists and is valid (active and a professional)

Parameters:
delegateGlobal -
lineNum -
add -
Returns:
false if the delegate for the Account doesn't exist or isn't valid

processCustomAddCollectionLineBusinessRules

public boolean processCustomAddCollectionLineBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document,
                                                           String collectionName,
                                                           org.kuali.rice.kns.bo.PersistableBusinessObject bo)
This checks that when a new line is added (either AccountGlobalDetail or DelegateGlobalDetail) that the appropriate rules are run on the new lines being added on AccountGlobalDetail: - make sure that the account number and chart are entered on DelegateGlobalDetail

Overrides:
processCustomAddCollectionLineBusinessRules in class org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
See Also:
MaintenanceDocumentRuleBase.processCustomAddCollectionLineBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument, java.lang.String, org.kuali.rice.kns.bo.PersistableBusinessObject)


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