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

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

This class implements the business rules for OrganizationReversionGlobal


Nested Class Summary
 
Nested classes/interfaces inherited from class org.kuali.kfs.coa.document.validation.impl.GlobalDocumentRuleBase
GlobalDocumentRuleBase.CheckOnlyOneChartResult
 
Field Summary
protected  OrganizationReversionGlobal globalOrganizationReversion
           
protected static org.apache.log4j.Logger LOG
           
protected  ObjectCodeService objectCodeService
           
protected  OrganizationReversionService organizationReversionService
           
 
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
OrganizationReversionGlobalRule()
          Constructs a OrganizationReversionGlobalRule Pseudo-injects services
 
Method Summary
 boolean areAllDetailsValid(OrganizationReversionGlobal globalOrgRev)
          Tests if all of the OrganizationReversionGlobalDetail objects associated with the given global organization reversion are valid.
 boolean areAllOrganizationsValid(OrganizationReversionGlobal globalOrgRev)
          This method tests if all the OrganizationReversionGlobalOrganization objects associated with the given global organization reversion pass all of their tests.
static boolean areContainingSameOrganizations(OrganizationReversionGlobalOrganization orgRevOrgA, OrganizationReversionGlobalOrganization orgRevOrgB)
          This method tests if two OrganizationReversionGlobalOrganization objects are holding the same underlying Organization.
 boolean checkAllObjectCodesForValidity(OrganizationReversionGlobal globalOrgRev, OrganizationReversionGlobalOrganization org)
          This method loops through each of the OrganizationReversionGlobalDetail objects, checking that the entered object codes for each of them are compatible with the OrganizationReversionGlobalOrganization specified.
 boolean checkBudgetReversionAccountPair(OrganizationReversionGlobal globalOrgRev)
          This method makes sure that if one part of the Budget Reversion Chart/Account pair is specified, both are specified, or an error is thrown.
 boolean checkCashReversionAccountPair(OrganizationReversionGlobal globalOrgRev)
          This method makes sure that if one part of the Cash Reversion Chart/Account pair is specified, both are specified, or an error is thrown.
 boolean checkDetailObjectCodeValidity(OrganizationReversionGlobal globalOrgRev, OrganizationReversionGlobalDetail detail)
          For each organization, tests if the object code in the detail exists in the system and is active
 boolean checkDetailObjectReversionCodeValidity(OrganizationReversionGlobalDetail detail)
          Tests if the object reversion code is a valid code.
 boolean checkDetailOrgReversionCategoryValidity(OrganizationReversionGlobalDetail detail)
          Tests if the Organization Reversion Category existed in the database and was active.
 boolean checkOrganizationChartValidity(OrganizationReversionGlobalOrganization org)
          Tests if the the organization of the given OrganizationReversionGlobalOrganization is within the chart of the global organization reversion as a whole.
 boolean checkOrganizationIsNotAmongOrgRevOrganizations(OrganizationReversionGlobal globalOrgRev, OrganizationReversionGlobalOrganization orgRevOrg)
          This method checks if a newly added organization is already among the organizations already listed.
 boolean checkOrganizationReversionForOrganizationExists(OrganizationReversionGlobal globalOrgRev, OrganizationReversionGlobalOrganization org)
          Checks that an organization reversion for the given organization reversion change and organization reversion change organization exist.
 boolean checkOrganizationValidity(OrganizationReversionGlobalOrganization org)
          Tests if the given OrganizationReversionGlobalOrganization's Organization is active and within the system.
 boolean checkSimpleRules(OrganizationReversionGlobal globalOrgRev)
          Convenient convenience method to test all the simple rules in one go.
protected  OrganizationReversionGlobal getGlobalOrganizationReversion()
           
 boolean processCustomAddCollectionLineBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document, String collectionName, org.kuali.rice.kns.bo.PersistableBusinessObject line)
          This performs rules checks whenever a new OrganizationReversionGlobalDetail or OrganizationReversionGlobalOrganization is added
protected  boolean processCustomApproveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          Calls the basic rules check on document approval: checkSimpleRules(OrganizationReversionGlobal) Fails on rules failure
protected  boolean processCustomRouteDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          Calls the basic rules check on document routing: checkSimpleRules(OrganizationReversionGlobal) Fails on rules failure
protected  boolean processCustomSaveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          Calls the basic rules check on document save: checkSimpleRules(OrganizationReversionGlobal) Does not fail on rules failure
 void setObjectCodeService(ObjectCodeService objectCodeService)
           
 void setOrganizationReversionService(OrganizationReversionService organizationReversionService)
           
 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.
 boolean validObjectCode(Integer universityFiscalYear, String chartOfAccountsCode, String objectCode)
          This method checks if an object code with the given primary key fields exists in the database.
 
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

globalOrganizationReversion

protected OrganizationReversionGlobal globalOrganizationReversion

organizationReversionService

protected OrganizationReversionService organizationReversionService

objectCodeService

protected ObjectCodeService objectCodeService
Constructor Detail

OrganizationReversionGlobalRule

public OrganizationReversionGlobalRule()
Constructs a OrganizationReversionGlobalRule Pseudo-injects services

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
Parameters:
document - - the maintenanceDocument being evaluated
See Also:
MaintenanceDocumentRuleBase.setupConvenienceObjects()

processCustomSaveDocumentBusinessRules

protected boolean processCustomSaveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
Calls the basic rules check on document save: Does not fail on rules failure

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

processCustomApproveDocumentBusinessRules

protected boolean processCustomApproveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
Calls the basic rules check on document approval: Fails on rules failure

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)
Calls the basic rules check on document routing: Fails on rules failure

Overrides:
processCustomRouteDocumentBusinessRules in class org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
See Also:
MaintenanceDocumentRuleBase.processCustomRouteDocumentBusinessRules(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 performs rules checks whenever a new OrganizationReversionGlobalDetail or OrganizationReversionGlobalOrganization is added

This includes:

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

public boolean checkSimpleRules(OrganizationReversionGlobal globalOrgRev)
Convenient convenience method to test all the simple rules in one go. Including:

Parameters:
globalOrgRev - the global organization reversion to check
Returns:
true if the new global organization reversion passes all tests, false if it deviates even a tiny little bit

checkBudgetReversionAccountPair

public boolean checkBudgetReversionAccountPair(OrganizationReversionGlobal globalOrgRev)
This method makes sure that if one part of the Budget Reversion Chart/Account pair is specified, both are specified, or an error is thrown.

Parameters:
globalOrgRev - the Global Organization Reversion to check
Returns:
true if budget reversion chart/account pair is specified correctly, false if otherwise

checkCashReversionAccountPair

public boolean checkCashReversionAccountPair(OrganizationReversionGlobal globalOrgRev)
This method makes sure that if one part of the Cash Reversion Chart/Account pair is specified, both are specified, or an error is thrown.

Parameters:
globalOrgRev - the Global Organization Reversion to check
Returns:
true if cash reversion chart/account pair is specified correctly, false if otherwise

areAllDetailsValid

public boolean areAllDetailsValid(OrganizationReversionGlobal globalOrgRev)
Tests if all of the OrganizationReversionGlobalDetail objects associated with the given global organization reversion are valid.

Parameters:
globalOrgRev - the global organization reversion to check
Returns:
true if valid, false otherwise

checkDetailOrgReversionCategoryValidity

public boolean checkDetailOrgReversionCategoryValidity(OrganizationReversionGlobalDetail detail)
Tests if the Organization Reversion Category existed in the database and was active.

Parameters:
detail - OrganizationReversionGlobalDetail to check
Returns:
true if the category is valid, false if otherwise

checkDetailObjectCodeValidity

public boolean checkDetailObjectCodeValidity(OrganizationReversionGlobal globalOrgRev,
                                             OrganizationReversionGlobalDetail detail)
For each organization, tests if the object code in the detail exists in the system and is active

Parameters:
detail - the OrganizationReversionGlobalDetail to check
Returns:
true if it is valid, false if otherwise

checkAllObjectCodesForValidity

public boolean checkAllObjectCodesForValidity(OrganizationReversionGlobal globalOrgRev,
                                              OrganizationReversionGlobalOrganization org)
This method loops through each of the OrganizationReversionGlobalDetail objects, checking that the entered object codes for each of them are compatible with the OrganizationReversionGlobalOrganization specified.

Parameters:
globalOrgRev - the global organization reversion to check
org - the OrganizationReversionGlobalOrganization with a new chart to check against all of the object codes
Returns:
true if there are no conflicts, false if otherwise

validObjectCode

public boolean validObjectCode(Integer universityFiscalYear,
                               String chartOfAccountsCode,
                               String objectCode)
This method checks if an object code with the given primary key fields exists in the database.

Parameters:
universityFiscalYear - the university fiscal year of the object code
chartOfAccountsCode - the chart of accounts code of the object code
objectCode - the object code itself
Returns:
true if it exists (or was not filled in to begin with), false if otherwise

checkDetailObjectReversionCodeValidity

public boolean checkDetailObjectReversionCodeValidity(OrganizationReversionGlobalDetail detail)
Tests if the object reversion code is a valid code.

Parameters:
detail - the OrganizationReversionGlobalDetail to check
Returns:
true if it the detail is valid, false if otherwise

areAllOrganizationsValid

public boolean areAllOrganizationsValid(OrganizationReversionGlobal globalOrgRev)
This method tests if all the OrganizationReversionGlobalOrganization objects associated with the given global organization reversion pass all of their tests.

Parameters:
globalOrgRev - the global organization reversion to check
Returns:
true if valid, false otherwise

checkOrganizationChartValidity

public boolean checkOrganizationChartValidity(OrganizationReversionGlobalOrganization org)
Tests if the the organization of the given OrganizationReversionGlobalOrganization is within the chart of the global organization reversion as a whole.

Parameters:
globalOrgRev - the global organization reversion that is currently being validated.
org - the OrganizationReversionGlobalOrganization to check
Returns:
true if valid, false otherwise

checkOrganizationValidity

public boolean checkOrganizationValidity(OrganizationReversionGlobalOrganization org)
Tests if the given OrganizationReversionGlobalOrganization's Organization is active and within the system.

Parameters:
org - the OrganizationReversionGlobalOrganization to check
Returns:
true if valid, false otherwise

checkOrganizationReversionForOrganizationExists

public boolean checkOrganizationReversionForOrganizationExists(OrganizationReversionGlobal globalOrgRev,
                                                               OrganizationReversionGlobalOrganization org)
Checks that an organization reversion for the given organization reversion change and organization reversion change organization exist.

Parameters:
globalOrgRev - global Organization Reversion to check
org - organization within that Global Organization Reversion to check specifically
Returns:
true if organization reversion for organization exists, false if otherwise

checkOrganizationIsNotAmongOrgRevOrganizations

public boolean checkOrganizationIsNotAmongOrgRevOrganizations(OrganizationReversionGlobal globalOrgRev,
                                                              OrganizationReversionGlobalOrganization orgRevOrg)
This method checks if a newly added organization is already among the organizations already listed. WARNING: only use on add line rules; there's no good way to use this method when testing the entire document.

Parameters:
globalOrgRev - the global Organization Reversion to check
orgRevOrg - the newly adding organization reversion change organization
Returns:
true if organization should be added as it is not currently in the collection, false if otherwise

areContainingSameOrganizations

public static boolean areContainingSameOrganizations(OrganizationReversionGlobalOrganization orgRevOrgA,
                                                     OrganizationReversionGlobalOrganization orgRevOrgB)
This method tests if two OrganizationReversionGlobalOrganization objects are holding the same underlying Organization.

Parameters:
orgRevOrgA - the first OrganizationReversionGlobalOrganization to check
orgRevOrgB - the second OrganizationReversionGlobalOrganization to check
Returns:
true if they share the organization, false if otherwise

setOrganizationReversionService

public void setOrganizationReversionService(OrganizationReversionService organizationReversionService)

setObjectCodeService

public void setObjectCodeService(ObjectCodeService objectCodeService)

getGlobalOrganizationReversion

protected OrganizationReversionGlobal getGlobalOrganizationReversion()


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