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

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.AccountGlobalRule
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 AccountGlobalRule
extends GlobalDocumentRuleBase

This class represents the business rules for the maintenance of AccountGlobal business objects


Nested Class Summary
 
Nested classes/interfaces inherited from class org.kuali.kfs.coa.document.validation.impl.GlobalDocumentRuleBase
GlobalDocumentRuleBase.CheckOnlyOneChartResult
 
Field Summary
protected static String ENDOWMENT_FUND_CD
           
protected static String GENERAL_FUND_CD
           
protected static org.apache.log4j.Logger LOG
           
protected  AccountGlobal newAccountGlobal
           
protected static String PLANT_FUND_CD
           
protected static String RESTRICTED_CD_RESTRICTED
           
protected static String RESTRICTED_CD_TEMPORARILY_RESTRICTED
           
protected static String RESTRICTED_CD_UNRESTRICTED
           
protected static String RESTRICTED_FUND_CD
           
protected static String SUB_FUND_GROUP_MEDICAL_PRACTICE_FUNDS
           
protected  Timestamp today
           
 
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
AccountGlobalRule()
           
 
Method Summary
protected  boolean areTwoUsersTheSame(org.kuali.rice.kim.bo.Person user1, org.kuali.rice.kim.bo.Person user2)
          This method checks to see if two users are the same Person using their identifiers
 boolean checkAccountDetails(AccountGlobalDetail dtl)
          This method ensures that each AccountGlobalDetail is valid and has a valid account number
 boolean checkAccountDetails(org.kuali.rice.kns.document.MaintenanceDocument document, List<AccountGlobalDetail> details)
          This method loops through the list of AccountGlobalDetails and passes them off to checkAccountDetails for further rule analysis One rule it does check is checkOnlyOneChartErrorWrapper
protected  boolean checkAccountUsers(AccountGlobalDetail detail, org.kuali.rice.kim.bo.Person newFiscalOfficer, org.kuali.rice.kim.bo.Person newManager, org.kuali.rice.kim.bo.Person newSupervisor, int index)
          This method checks that the new users (fiscal officer, supervisor, manager) are not the same individual for the Account being changed (contained in the AccountGlobalDetail)
protected  boolean checkAllAccountUsers(AccountGlobal doc, org.kuali.rice.kim.bo.Person newFiscalOfficer, org.kuali.rice.kim.bo.Person newManager, org.kuali.rice.kim.bo.Person newSupervisor)
          This method checks to make sure that if the users are filled out (fiscal officer, supervisor, manager) that they are not the same individual Only need to check this if these are new users that override existing users on the Account object
protected  boolean checkCgIncomeStreamRequired(AccountGlobal accountGlobals)
          This method checks to see if the contracts and grants income stream account is required
protected  boolean checkContinuationAccount(org.kuali.rice.kns.document.MaintenanceDocument document, Date newExpDate)
          This method validates that a continuation account is required and that the values provided exist
protected  boolean checkContractsAndGrants()
          This method checks to see if any Contracts and Grants business rules were violated
protected  boolean checkEmptyValues()
          This method checks the basic rules for empty reference key values on a continuation account and an income stream account
protected  boolean checkExpirationDate(org.kuali.rice.kns.document.MaintenanceDocument maintenanceDocument)
          This method checks to see if any expiration date field rules were violated Loops through each detail object and calls checkExpirationDate(MaintenanceDocument, AccountGlobalDetail)
protected  boolean checkExpirationDate(org.kuali.rice.kns.document.MaintenanceDocument maintenanceDocument, AccountGlobalDetail detail)
          This method checks to see if any expiration date field rules were violated in relation to the given detail record
protected  boolean checkGeneralRules(org.kuali.rice.kns.document.MaintenanceDocument maintenanceDocument)
          This method checks some of the general business rules associated with this document Such as: valid user for fiscal officer, supervisor or account manager (and not the same individual) are they trying to use an expired continuation account
protected  boolean checkOrganizationValidity(AccountGlobal acctGlobal)
          Validate that the object code on the form (if entered) is valid for all charts used in the detail sections.
protected  boolean isContinuationAccountExpired(AccountGlobal accountGlobals)
          This method tests whether the continuation account entered (if any) has expired or not.
protected  boolean isSupervisorSameAsFiscalOfficer(AccountGlobal accountGlobals)
          This method is a helper method for checking if the supervisor user is the same as the fiscal officer Calls areTwoUsersTheSame(Person, Person)
protected  boolean isSupervisorSameAsManager(AccountGlobal accountGlobals)
          This method is a helper method for checking if the supervisor user is the same as the manager Calls areTwoUsersTheSame(Person, Person)
protected  boolean isUpdatedExpirationDateInvalid(Account oldAccount, AccountGlobal newAccountGlobal)
          This method checks to see if the updated expiration is not a valid one Only gets checked for specific SubFundGroups
 boolean processCustomAddCollectionLineBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document, String collectionName, org.kuali.rice.kns.bo.PersistableBusinessObject bo)
          This method calls checkAccountDetails checkExpirationDate checkOnlyOneChartAddLineErrorWrapper whenever a new AccountGlobalDetail is added to this global
protected  boolean processCustomRouteDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          This method checks the following rules: checkEmptyValues checkGeneralRules checkContractsAndGrants checkExpirationDate checkOnlyOneChartErrorWrapper checkFiscalOfficerIsValidKualiUser but does fail if any of these rule checks fail
protected  boolean processCustomSaveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          This method checks the following rules: checkEmptyValues checkGeneralRules checkContractsAndGrants checkExpirationDate checkOnlyOneChartErrorWrapper checkFiscalOfficerIsValidKualiUser but does not fail if any of them fail (this only happens on routing)
 void setupConvenienceObjects()
          This method sets the convenience objects like newAccountGlobal 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, processCustomApproveDocumentBusinessRules, 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

GENERAL_FUND_CD

protected static final String GENERAL_FUND_CD
See Also:
Constant Field Values

RESTRICTED_FUND_CD

protected static final String RESTRICTED_FUND_CD
See Also:
Constant Field Values

ENDOWMENT_FUND_CD

protected static final String ENDOWMENT_FUND_CD
See Also:
Constant Field Values

PLANT_FUND_CD

protected static final String PLANT_FUND_CD
See Also:
Constant Field Values

RESTRICTED_CD_RESTRICTED

protected static final String RESTRICTED_CD_RESTRICTED
See Also:
Constant Field Values

RESTRICTED_CD_UNRESTRICTED

protected static final String RESTRICTED_CD_UNRESTRICTED
See Also:
Constant Field Values

RESTRICTED_CD_TEMPORARILY_RESTRICTED

protected static final String RESTRICTED_CD_TEMPORARILY_RESTRICTED
See Also:
Constant Field Values

SUB_FUND_GROUP_MEDICAL_PRACTICE_FUNDS

protected static final String SUB_FUND_GROUP_MEDICAL_PRACTICE_FUNDS
See Also:
Constant Field Values

newAccountGlobal

protected AccountGlobal newAccountGlobal

today

protected Timestamp today
Constructor Detail

AccountGlobalRule

public AccountGlobalRule()
Method Detail

setupConvenienceObjects

public void setupConvenienceObjects()
This method sets the convenience objects like newAccountGlobal 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

processCustomSaveDocumentBusinessRules

protected boolean processCustomSaveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
This method checks the following rules: checkEmptyValues checkGeneralRules checkContractsAndGrants checkExpirationDate checkOnlyOneChartErrorWrapper checkFiscalOfficerIsValidKualiUser but does not fail if any of them fail (this only happens on routing)

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

processCustomRouteDocumentBusinessRules

protected boolean processCustomRouteDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
This method checks the following rules: checkEmptyValues checkGeneralRules checkContractsAndGrants checkExpirationDate checkOnlyOneChartErrorWrapper checkFiscalOfficerIsValidKualiUser but does fail if any of these rule checks fail

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

checkAccountDetails

public boolean checkAccountDetails(org.kuali.rice.kns.document.MaintenanceDocument document,
                                   List<AccountGlobalDetail> details)
This method loops through the list of AccountGlobalDetails and passes them off to checkAccountDetails for further rule analysis One rule it does check is checkOnlyOneChartErrorWrapper

Parameters:
document -
details -
Returns:
true if the collection of AccountGlobalDetails passes the sub-rules

checkAccountDetails

public boolean checkAccountDetails(AccountGlobalDetail dtl)
This method ensures that each AccountGlobalDetail is valid and has a valid account number

Parameters:
dtl -
Returns:
true if the detail object contains a valid account

checkEmptyValues

protected boolean checkEmptyValues()
This method checks the basic rules for empty reference key values on a continuation account and an income stream account

Returns:
true if no empty values or partially filled out reference keys

checkGeneralRules

protected boolean checkGeneralRules(org.kuali.rice.kns.document.MaintenanceDocument maintenanceDocument)
This method checks some of the general business rules associated with this document Such as: valid user for fiscal officer, supervisor or account manager (and not the same individual) are they trying to use an expired continuation account

Parameters:
maintenanceDocument -
Returns:
false on rules violation

checkAllAccountUsers

protected boolean checkAllAccountUsers(AccountGlobal doc,
                                       org.kuali.rice.kim.bo.Person newFiscalOfficer,
                                       org.kuali.rice.kim.bo.Person newManager,
                                       org.kuali.rice.kim.bo.Person newSupervisor)
This method checks to make sure that if the users are filled out (fiscal officer, supervisor, manager) that they are not the same individual Only need to check this if these are new users that override existing users on the Account object

Parameters:
doc -
newFiscalOfficer -
newManager -
newSupervisor -
Returns:
true if the users are either not changed or pass the sub-rules

checkAccountUsers

protected boolean checkAccountUsers(AccountGlobalDetail detail,
                                    org.kuali.rice.kim.bo.Person newFiscalOfficer,
                                    org.kuali.rice.kim.bo.Person newManager,
                                    org.kuali.rice.kim.bo.Person newSupervisor,
                                    int index)
This method checks that the new users (fiscal officer, supervisor, manager) are not the same individual for the Account being changed (contained in the AccountGlobalDetail)

Parameters:
detail - - where the Account information is stored
newFiscalOfficer -
newManager -
newSupervisor -
index - - for storing the error line
Returns:
true if the new users pass this sub-rule

isSupervisorSameAsFiscalOfficer

protected boolean isSupervisorSameAsFiscalOfficer(AccountGlobal accountGlobals)
This method is a helper method for checking if the supervisor user is the same as the fiscal officer Calls areTwoUsersTheSame(Person, Person)

Parameters:
accountGlobals -
Returns:
true if the two users are the same

isSupervisorSameAsManager

protected boolean isSupervisorSameAsManager(AccountGlobal accountGlobals)
This method is a helper method for checking if the supervisor user is the same as the manager Calls areTwoUsersTheSame(Person, Person)

Parameters:
accountGlobals -
Returns:
true if the two users are the same

areTwoUsersTheSame

protected boolean areTwoUsersTheSame(org.kuali.rice.kim.bo.Person user1,
                                     org.kuali.rice.kim.bo.Person user2)
This method checks to see if two users are the same Person using their identifiers

Parameters:
user1 -
user2 -
Returns:
true if these two users are the same

checkExpirationDate

protected boolean checkExpirationDate(org.kuali.rice.kns.document.MaintenanceDocument maintenanceDocument)
This method checks to see if any expiration date field rules were violated Loops through each detail object and calls checkExpirationDate(MaintenanceDocument, AccountGlobalDetail)

Parameters:
maintenanceDocument -
Returns:
false on rules violation

checkExpirationDate

protected boolean checkExpirationDate(org.kuali.rice.kns.document.MaintenanceDocument maintenanceDocument,
                                      AccountGlobalDetail detail)
This method checks to see if any expiration date field rules were violated in relation to the given detail record

Parameters:
maintenanceDocument -
detail - - the account detail we are investigating
Returns:
false on rules violation

isUpdatedExpirationDateInvalid

protected boolean isUpdatedExpirationDateInvalid(Account oldAccount,
                                                 AccountGlobal newAccountGlobal)
This method checks to see if the updated expiration is not a valid one Only gets checked for specific SubFundGroups

Parameters:
oldAccount -
newAccountGlobal -
Returns:
true if date has changed and is invalid

isContinuationAccountExpired

protected boolean isContinuationAccountExpired(AccountGlobal accountGlobals)
This method tests whether the continuation account entered (if any) has expired or not.

Parameters:
accountGlobals -
Returns:
true if the continuation account has expired

checkContractsAndGrants

protected boolean checkContractsAndGrants()
This method checks to see if any Contracts and Grants business rules were violated

Returns:
false on rules violation

checkCgIncomeStreamRequired

protected boolean checkCgIncomeStreamRequired(AccountGlobal accountGlobals)
This method checks to see if the contracts and grants income stream account is required

Parameters:
accountGlobals -
Returns:
false if it is required (and not entered) or invalid/inactive

processCustomAddCollectionLineBusinessRules

public boolean processCustomAddCollectionLineBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document,
                                                           String collectionName,
                                                           org.kuali.rice.kns.bo.PersistableBusinessObject bo)
This method calls checkAccountDetails checkExpirationDate checkOnlyOneChartAddLineErrorWrapper whenever a new AccountGlobalDetail is added to this global

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)

checkContinuationAccount

protected boolean checkContinuationAccount(org.kuali.rice.kns.document.MaintenanceDocument document,
                                           Date newExpDate)
This method validates that a continuation account is required and that the values provided exist

Parameters:
document - An instance of the maintenance document being validated.
newExpDate - The expiration date assigned to the account being validated for submission.
Returns:
True if the continuation account values are valid for the associated account, false otherwise.

checkOrganizationValidity

protected boolean checkOrganizationValidity(AccountGlobal acctGlobal)
Validate that the object code on the form (if entered) is valid for all charts used in the detail sections.

Parameters:
acctGlobal -
Returns:


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