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

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.AccountDelegateModelRule
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 AccountDelegateModelRule
extends org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase

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


Field Summary
 
Fields inherited from class org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
boDictionaryService, boService, businessObjectAuthorizationService, configService, ddService, dictionaryValidationService, DOCUMENT_ERROR_PREFIX, documentHelperService, LOG, MAINTAINABLE_ERROR_PATH, MAINTAINABLE_ERROR_PREFIX, maintDocDictionaryService, persistenceService, persistenceStructureService, personService, priorErrorPath, roleService, workflowDocumentService
 
Constructor Summary
AccountDelegateModelRule()
          Constructs a AccountDelegateModelRule
 
Method Summary
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 checkDelegateFromAmountPositive(AccountDelegateModelDetail delegateModel)
          Checks that if approval from amount is not null, then it is positive
protected  boolean checkDelegateToAmountGreaterThanFromAmount(AccountDelegateModelDetail delegateModel)
          Checks that if approval from amount is null, that approval to this amount is null or zero; and then checks that approval to amount is greater than or equal to approval from amount.
protected  boolean checkDelegateUserRules(org.kuali.rice.kns.document.MaintenanceDocument document, AccountDelegateModelDetail delegateModel)
          Checks that the account delegate listed exists in the system, and that user has an active status and is a professional type
protected  boolean checkModelNameHasAtLeastOneActiveModel(AccountDelegateModel globalDelegateTemplate)
          This method checks that the account delegate model has at least one active "model" within it.
protected  boolean checkModelNameHasAtLeastOneModel(AccountDelegateModel globalDelegateTemplate)
          This method makes certain that the collection of account delegates in the "mo itdel" has at least one account delegate template in it.
protected  boolean checkPrimaryRoutePerDocType(AccountDelegateModel globalDelegateTemplate, AccountDelegateModelDetail delegateModel)
          This method validates the rule that says there can be only one PrimaryRoute delegate for each given docType.
protected  boolean checkSimpleRules(org.kuali.rice.kns.document.MaintenanceDocument document, AccountDelegateModel globalDelegateTemplate)
          Checks the given rules against the entire Organization Routing Model parent.
protected  boolean checkSimpleRulesForOrganizationRoutingModel(org.kuali.rice.kns.document.MaintenanceDocument document, AccountDelegateModel globalDelegateTemplate, AccountDelegateModelDetail delegateModel, FinancialSystemDocumentTypeService documentService)
          This method checks a series of basic rules for a single org routing model.
 boolean processCustomAddCollectionLineBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document, String collectionName, org.kuali.rice.kns.bo.PersistableBusinessObject line)
          This method calls AccountDelegateModelRule#checkSimpleRulesForOrganizationRoutingModel(OrganizationRoutingModelName, OrganizationRoutingModel)
protected  boolean processCustomApproveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          This performs rules checks on document approve AccountDelegateModelRule#checkSimpleRules(OrganizationRoutingModelName) This rule fails on business rule failures
protected  boolean processCustomRouteDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          This performs rules checks on document route AccountDelegateModelRule#checkSimpleRules(OrganizationRoutingModelName) This rule fails on business rule failures
protected  boolean processCustomSaveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          This performs rules checks on document save AccountDelegateModelRule#checkSimpleRules(OrganizationRoutingModelName) This rule does not fail on business rule failures
 void setupConvenienceObjects()
          This method sets the convenience objects like model, 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, 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
 

Constructor Detail

AccountDelegateModelRule

public AccountDelegateModelRule()
Constructs a AccountDelegateModelRule

Method Detail

setupConvenienceObjects

public void setupConvenienceObjects()
This method sets the convenience objects like model, 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
See Also:
MaintenanceDocumentRuleBase.setupConvenienceObjects()

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)

processCustomAddCollectionLineBusinessRules

public boolean processCustomAddCollectionLineBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document,
                                                           String collectionName,
                                                           org.kuali.rice.kns.bo.PersistableBusinessObject line)
This method calls

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)

checkSimpleRules

protected boolean checkSimpleRules(org.kuali.rice.kns.document.MaintenanceDocument document,
                                   AccountDelegateModel globalDelegateTemplate)
Checks the given rules against the entire Organization Routing Model parent.

Parameters:
globalDelegateTemplate - the Organization Routing Model parent to check
Returns:
true if document passes all rules, false if otherwise

checkSimpleRulesForOrganizationRoutingModel

protected boolean checkSimpleRulesForOrganizationRoutingModel(org.kuali.rice.kns.document.MaintenanceDocument document,
                                                              AccountDelegateModel globalDelegateTemplate,
                                                              AccountDelegateModelDetail delegateModel,
                                                              FinancialSystemDocumentTypeService documentService)
This method checks a series of basic rules for a single org routing model.

Returns:
true if model passes all the checks, false if otherwise

checkModelNameHasAtLeastOneModel

protected boolean checkModelNameHasAtLeastOneModel(AccountDelegateModel globalDelegateTemplate)
This method makes certain that the collection of account delegates in the "mo itdel" has at least one account delegate template in it.

Parameters:
globalDelegateTemplate - the account delegate model to check
Returns:
true if account delegate model has at least one account delegate template in it

checkModelNameHasAtLeastOneActiveModel

protected boolean checkModelNameHasAtLeastOneActiveModel(AccountDelegateModel globalDelegateTemplate)
This method checks that the account delegate model has at least one active "model" within it.

Parameters:
globalDelegateTemplate - the account delegate model to check
Returns:
true if account delegate model has at least one active model in it.

checkDelegateFromAmountPositive

protected boolean checkDelegateFromAmountPositive(AccountDelegateModelDetail delegateModel)
Checks that if approval from amount is not null, then it is positive

Parameters:
delegateModel - Organization Routing Model to check
Returns:
true if Organization Routing Model passes the checks, false if otherwise

checkDelegateToAmountGreaterThanFromAmount

protected boolean checkDelegateToAmountGreaterThanFromAmount(AccountDelegateModelDetail delegateModel)
Checks that if approval from amount is null, that approval to this amount is null or zero; and then checks that approval to amount is greater than or equal to approval from amount.

Parameters:
delegateModel - Organization Routing Model to check
Returns:
true if the Organization Routing Model passes the checks, false if otherwise

checkDelegateUserRules

protected boolean checkDelegateUserRules(org.kuali.rice.kns.document.MaintenanceDocument document,
                                         AccountDelegateModelDetail delegateModel)
Checks that the account delegate listed exists in the system, and that user has an active status and is a professional type

Parameters:
delegateModel - the Organization Routing Model to check
Returns:
true if delegate user passes the rules described above; false if they fail

checkPrimaryRoutePerDocType

protected boolean checkPrimaryRoutePerDocType(AccountDelegateModel globalDelegateTemplate,
                                              AccountDelegateModelDetail delegateModel)
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:
true if model, delegate template or org routing model is null, or if the primary routing indicator is set to false or the doc type code is empty otherwise it checks to make sure that there is indeed one model marked as the primary route

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


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