org.kuali.kfs.module.bc.document.validation.impl
Class BudgetConstructionDocumentRules

java.lang.Object
  extended by org.kuali.rice.kns.rules.DocumentRuleBase
      extended by org.kuali.rice.kns.rules.TransactionalDocumentRuleBase
          extended by org.kuali.kfs.module.bc.document.validation.impl.BudgetConstructionDocumentRules
All Implemented Interfaces:
AddBudgetConstructionDocumentRule<BudgetConstructionDocument>, AddPendingBudgetGeneralLedgerLineRule<BudgetConstructionDocument,PendingBudgetConstructionGeneralLedger>, DeleteMonthlySpreadRule<BudgetConstructionDocument>, DeletePendingBudgetGeneralLedgerLineRule<BudgetConstructionDocument,PendingBudgetConstructionGeneralLedger>, SaveMonthlyBudgetRule<BudgetConstructionDocument,BudgetConstructionMonthly>, org.kuali.rice.kns.rule.AddAdHocRoutePersonRule, org.kuali.rice.kns.rule.AddAdHocRouteWorkgroupRule, 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 BudgetConstructionDocumentRules
extends org.kuali.rice.kns.rules.TransactionalDocumentRuleBase
implements AddBudgetConstructionDocumentRule<BudgetConstructionDocument>, AddPendingBudgetGeneralLedgerLineRule<BudgetConstructionDocument,PendingBudgetConstructionGeneralLedger>, DeletePendingBudgetGeneralLedgerLineRule<BudgetConstructionDocument,PendingBudgetConstructionGeneralLedger>, DeleteMonthlySpreadRule<BudgetConstructionDocument>, SaveMonthlyBudgetRule<BudgetConstructionDocument,BudgetConstructionMonthly>


Field Summary
protected static AccountingLineRuleHelperService accountingLineRuleHelper
           
protected  List<String> budgetAggregationCodesParamValues
           
protected static BudgetParameterService budgetParameterService
           
protected static org.kuali.rice.kns.service.BusinessObjectService businessObjectService
           
protected static org.kuali.rice.kns.service.DataDictionaryService dataDictionaryService
           
protected  List<String> expenditureObjectTypesParamValues
           
protected static FiscalYearFunctionControlService fiscalYearFunctionControlService
           
protected  List<String> fringeBenefitDesignatorCodesParamValues
           
protected static org.apache.log4j.Logger LOG
           
protected  List<String> revenueObjectTypesParamValues
           
protected  List<String> salarySettingFundGroupsParamValues
           
protected static SalarySettingService salarySettingService
           
protected  List<String> salarySettingSubFundGroupsParamValues
           
protected static String TARGET_ERROR_PROPERTY_NAME
           
 
Constructor Summary
BudgetConstructionDocumentRules()
           
 
Method Summary
protected  boolean checkPendingBudgetConstructionGeneralLedgerLine(BudgetConstructionDocument budgetConstructionDocument, PendingBudgetConstructionGeneralLedger pendingBudgetConstructionGeneralLedger, org.kuali.rice.kns.util.MessageMap errors, boolean isRevenue, boolean isAdd)
          Checks a PBGL line.
protected  boolean checkPendingBudgetConstructionGeneralLedgerLines(BudgetConstructionDocument budgetConstructionDocument, org.kuali.rice.kns.util.MessageMap errors, boolean isRevenue, boolean doMonthRICheck)
          Iterates existing revenue or expenditure lines.
protected  boolean isBudgetAggregationAllowed(List paramValues, PendingBudgetConstructionGeneralLedger accountingLine, org.kuali.rice.kns.util.MessageMap errors, boolean isAdd)
           
protected  boolean isBudgetAllowed(BudgetConstructionDocument budgetConstructionDocument, String propertyName, org.kuali.rice.kns.util.MessageMap errors, boolean isAdd, boolean isDocumentAdd)
          runs rule checks that don't allow a budget
protected  boolean isNewLineUnique(BudgetConstructionDocument budgetConstructionDocument, PendingBudgetConstructionGeneralLedger newLine, org.kuali.rice.kns.util.MessageMap errors, boolean isRevenue)
           
protected  boolean isNonWagesAccountNotLaborObject(BudgetConstructionDocument budgetConstructionDocument, PendingBudgetConstructionGeneralLedger accountingLine, org.kuali.rice.kns.util.MessageMap errors, boolean isAdd)
           
protected  boolean isNotFringeBenefitObject(List paramValues, PendingBudgetConstructionGeneralLedger accountingLine, org.kuali.rice.kns.util.MessageMap errors, boolean isAdd)
           
protected  boolean isNotSalarySettingOnly(List fundGroupParamValues, List subfundGroupParamValues, BudgetConstructionDocument budgetConstructionDocument, PendingBudgetConstructionGeneralLedger accountingLine, org.kuali.rice.kns.util.MessageMap errors, boolean isRevenue, boolean isAdd)
           
protected  boolean isObjectTypeAllowed(List paramValues, PendingBudgetConstructionGeneralLedger accountingLine, org.kuali.rice.kns.util.MessageMap errors, boolean isRevenue, boolean isAdd)
           
 boolean isValidAccount(Account account, String value, org.kuali.rice.kns.datadictionary.DataDictionary dataDictionary, String errorPropertyName)
           
 boolean isValidObjectCode(ObjectCode objectCode, String value, org.kuali.rice.kns.datadictionary.DataDictionary dataDictionary, String errorPropertyName)
          Runs existence and active tests on the ObjectCode reference This method is differenct than the one in AccountingLineRuleHelper in that it adds the bad value to the errormessage This method signature should probably be added to AccountingLineRuleHelper
 boolean isValidSubAccount(SubAccount subAccount, String value, org.kuali.rice.kns.datadictionary.DataDictionary dataDictionary, String errorPropertyName)
           
 boolean isValidSubObjectCode(SubObjectCode subObjectCode, String value, org.kuali.rice.kns.datadictionary.DataDictionary dataDictionary, String errorPropertyName)
          Runs existence and active tests on the SubObjectCode reference This method is differenct than the one in AccountingLineRuleHelper in that it adds the bad value to the errormessage This method signature should probably be added to AccountingLineRuleHelper
 boolean processAddBudgetConstructionDocumentRules(BudgetConstructionDocument budgetConstructionDocument)
          Processes all the rules for this event and returns true if all rules passed
 boolean processAddPendingBudgetGeneralLedgerLineRules(BudgetConstructionDocument budgetConstructionDocument, PendingBudgetConstructionGeneralLedger pendingBudgetConstructionGeneralLedger, boolean isRevenue)
          Checks a new PBGL line.
 boolean processDeleteMonthlySpreadRules(BudgetConstructionDocument budgetConstructionDocument, BCConstants.MonthSpreadDeleteType monthSpreadDeleteType)
           
 boolean processDeletePendingBudgetGeneralLedgerLineRules(BudgetConstructionDocument budgetConstructionDocument, PendingBudgetConstructionGeneralLedger pendingBudgetConstructionGeneralLedger, boolean isRevenue)
          Runs rules for deleting an existing revenue or expenditure line.
 boolean processSaveBudgetDocumentRules(BudgetConstructionDocument budgetConstructionDocument, BCConstants.MonthSpreadDeleteType monthSpreadDeleteType)
          Iterates through existing revenue and expenditure lines to do validation, ri checks on object/sub-object code and request amount referential integrity checks against appointment funding and monthly detail amounts.
 boolean processSaveDocument(org.kuali.rice.kns.document.Document document)
          Runs business rules prior to saving Budget Document proper.
 boolean processSaveMonthlyBudgetRules(BudgetConstructionDocument budgetConstructionDocument, BudgetConstructionMonthly budgetConstructionMonthly)
          Processes all the rules for this event and returns true if all rules passed
protected  void putError(org.kuali.rice.kns.util.MessageMap errors, String propertyName, String errorKey, boolean isAdd, String... errorParameters)
          puts error to errormap for propertyName if isAdd, otherwise the property name is replaced with value of TARGET_ERROR_PROPERTY_NAME
protected  boolean validatePBGLLine(PendingBudgetConstructionGeneralLedger pendingBudgetConstructionGeneralLedger, boolean isAdd)
           
protected  void validatePrimitiveFromDescriptor(Object object, String attributeName, String errorPrefix, boolean validateRequired)
          Validates a single primitive in a BO
protected  void validatePrimitiveFromDescriptor(String entryName, Object object, PropertyDescriptor propertyDescriptor, String errorPrefix, boolean validateRequired)
          Validates a primitive in a BO
 
Methods inherited from class org.kuali.rice.kns.rules.DocumentRuleBase
getDataDictionaryService, getDictionaryValidationService, getDocumentHelperService, getIdentityManagementService, getKualiConfigurationService, getMaxDictionaryValidationDepth, getPersonService, getWorkflowInfoService, isAddHocRoutePersonValid, isAddHocRouteWorkgroupValid, isAdHocRouteRecipientsValid, isDocumentAttributesValid, isDocumentOverviewValid, isNoteValid, processAddAdHocRoutePerson, processAddAdHocRouteWorkgroup, processAddNote, processApproveDocument, processCustomAddAdHocRoutePersonBusinessRules, processCustomAddAdHocRouteWorkgroupBusinessRules, processCustomAddNoteBusinessRules, processCustomApproveDocumentBusinessRules, processCustomRouteDocumentBusinessRules, processCustomSaveDocumentBusinessRules, processCustomSendAdHocRequests, processRouteDocument, 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

budgetParameterService

protected static BudgetParameterService budgetParameterService

accountingLineRuleHelper

protected static AccountingLineRuleHelperService accountingLineRuleHelper

dataDictionaryService

protected static org.kuali.rice.kns.service.DataDictionaryService dataDictionaryService

salarySettingService

protected static SalarySettingService salarySettingService

businessObjectService

protected static org.kuali.rice.kns.service.BusinessObjectService businessObjectService

fiscalYearFunctionControlService

protected static FiscalYearFunctionControlService fiscalYearFunctionControlService

revenueObjectTypesParamValues

protected List<String> revenueObjectTypesParamValues

expenditureObjectTypesParamValues

protected List<String> expenditureObjectTypesParamValues

budgetAggregationCodesParamValues

protected List<String> budgetAggregationCodesParamValues

fringeBenefitDesignatorCodesParamValues

protected List<String> fringeBenefitDesignatorCodesParamValues

salarySettingFundGroupsParamValues

protected List<String> salarySettingFundGroupsParamValues

salarySettingSubFundGroupsParamValues

protected List<String> salarySettingSubFundGroupsParamValues

TARGET_ERROR_PROPERTY_NAME

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

BudgetConstructionDocumentRules

public BudgetConstructionDocumentRules()
Method Detail

processAddBudgetConstructionDocumentRules

public boolean processAddBudgetConstructionDocumentRules(BudgetConstructionDocument budgetConstructionDocument)
Description copied from interface: AddBudgetConstructionDocumentRule
Processes all the rules for this event and returns true if all rules passed

Specified by:
processAddBudgetConstructionDocumentRules in interface AddBudgetConstructionDocumentRule<BudgetConstructionDocument>
Returns:
See Also:
AddBudgetConstructionDocumentRule.processAddBudgetConstructionDocumentRules(org.kuali.kfs.module.bc.document.BudgetConstructionDocument)

processSaveDocument

public boolean processSaveDocument(org.kuali.rice.kns.document.Document document)
Runs business rules prior to saving Budget Document proper. This is different than saving typical KFS documents in that the document is not saved to the user's inbox. Saved Budget Documents must meet the same state requirements as the typical KFS routed document, so required field checks must be done. Budget Documents can be opened by a user in edit mode multiple times and while in edit mode documents can be pushed down the review hierarchy, monthly budgets and appointment funding updated, benefits calculated, etc. Each of these operations require the document's data be in a consistent state with respect to business rules before the operation be performed.

Specified by:
processSaveDocument in interface org.kuali.rice.kns.rule.SaveDocumentRule
Overrides:
processSaveDocument in class org.kuali.rice.kns.rules.DocumentRuleBase
See Also:
DocumentRuleBase.processSaveDocument(org.kuali.rice.kns.document.Document)

processDeleteMonthlySpreadRules

public boolean processDeleteMonthlySpreadRules(BudgetConstructionDocument budgetConstructionDocument,
                                               BCConstants.MonthSpreadDeleteType monthSpreadDeleteType)
Specified by:
processDeleteMonthlySpreadRules in interface DeleteMonthlySpreadRule<BudgetConstructionDocument>

processSaveBudgetDocumentRules

public boolean processSaveBudgetDocumentRules(BudgetConstructionDocument budgetConstructionDocument,
                                              BCConstants.MonthSpreadDeleteType monthSpreadDeleteType)
Iterates through existing revenue and expenditure lines to do validation, ri checks on object/sub-object code and request amount referential integrity checks against appointment funding and monthly detail amounts. Checks are performed when the request amount has been updated, since initial add action, the last save event or since opening the document, whatever is latest.

See Also:
org.kuali.module.budget.rule.SaveBudgetDocumentRule#processSaveBudgetDocumentRules(D)

processAddPendingBudgetGeneralLedgerLineRules

public boolean processAddPendingBudgetGeneralLedgerLineRules(BudgetConstructionDocument budgetConstructionDocument,
                                                             PendingBudgetConstructionGeneralLedger pendingBudgetConstructionGeneralLedger,
                                                             boolean isRevenue)
Checks a new PBGL line. Comprehensive checks are done.

Specified by:
processAddPendingBudgetGeneralLedgerLineRules in interface AddPendingBudgetGeneralLedgerLineRule<BudgetConstructionDocument,PendingBudgetConstructionGeneralLedger>
Parameters:
budgetConstructionDocument -
pendingBudgetConstructionGeneralLedger -
isRevenue -
Returns:

processDeletePendingBudgetGeneralLedgerLineRules

public boolean processDeletePendingBudgetGeneralLedgerLineRules(BudgetConstructionDocument budgetConstructionDocument,
                                                                PendingBudgetConstructionGeneralLedger pendingBudgetConstructionGeneralLedger,
                                                                boolean isRevenue)
Runs rules for deleting an existing revenue or expenditure line.

Specified by:
processDeletePendingBudgetGeneralLedgerLineRules in interface DeletePendingBudgetGeneralLedgerLineRule<BudgetConstructionDocument,PendingBudgetConstructionGeneralLedger>
Parameters:
budgetConstructionDocument -
pendingBudgetConstructionGeneralLedger -
isRevenue -
Returns:

processSaveMonthlyBudgetRules

public boolean processSaveMonthlyBudgetRules(BudgetConstructionDocument budgetConstructionDocument,
                                             BudgetConstructionMonthly budgetConstructionMonthly)
Description copied from interface: SaveMonthlyBudgetRule
Processes all the rules for this event and returns true if all rules passed

Specified by:
processSaveMonthlyBudgetRules in interface SaveMonthlyBudgetRule<BudgetConstructionDocument,BudgetConstructionMonthly>
Returns:
See Also:
SaveMonthlyBudgetRule.processSaveMonthlyBudgetRules(org.kuali.kfs.module.bc.document.BudgetConstructionDocument, org.kuali.kfs.module.bc.businessobject.BudgetConstructionMonthly)

checkPendingBudgetConstructionGeneralLedgerLines

protected boolean checkPendingBudgetConstructionGeneralLedgerLines(BudgetConstructionDocument budgetConstructionDocument,
                                                                   org.kuali.rice.kns.util.MessageMap errors,
                                                                   boolean isRevenue,
                                                                   boolean doMonthRICheck)
Iterates existing revenue or expenditure lines. Checks if request amount is non-zero or has changed and runs business rules on the line.

Parameters:
budgetConstructionDocument -
errors -
isRevenue -
Returns:

checkPendingBudgetConstructionGeneralLedgerLine

protected boolean checkPendingBudgetConstructionGeneralLedgerLine(BudgetConstructionDocument budgetConstructionDocument,
                                                                  PendingBudgetConstructionGeneralLedger pendingBudgetConstructionGeneralLedger,
                                                                  org.kuali.rice.kns.util.MessageMap errors,
                                                                  boolean isRevenue,
                                                                  boolean isAdd)
Checks a PBGL line. Assumes the line has been checked against the dd for formatting and if required

Parameters:
budgetConstructionDocument -
pendingBudgetConstructionGeneralLedger -
Returns:

validatePBGLLine

protected boolean validatePBGLLine(PendingBudgetConstructionGeneralLedger pendingBudgetConstructionGeneralLedger,
                                   boolean isAdd)

validatePrimitiveFromDescriptor

protected void validatePrimitiveFromDescriptor(Object object,
                                               String attributeName,
                                               String errorPrefix,
                                               boolean validateRequired)
Validates a single primitive in a BO

Parameters:
object -
attributeName -
errorPrefix -
validateRequired -

validatePrimitiveFromDescriptor

protected void validatePrimitiveFromDescriptor(String entryName,
                                               Object object,
                                               PropertyDescriptor propertyDescriptor,
                                               String errorPrefix,
                                               boolean validateRequired)
Validates a primitive in a BO

Parameters:
entryName -
object -
propertyDescriptor -
errorPrefix -
validateRequired -

isObjectTypeAllowed

protected boolean isObjectTypeAllowed(List paramValues,
                                      PendingBudgetConstructionGeneralLedger accountingLine,
                                      org.kuali.rice.kns.util.MessageMap errors,
                                      boolean isRevenue,
                                      boolean isAdd)

isBudgetAggregationAllowed

protected boolean isBudgetAggregationAllowed(List paramValues,
                                             PendingBudgetConstructionGeneralLedger accountingLine,
                                             org.kuali.rice.kns.util.MessageMap errors,
                                             boolean isAdd)

isNewLineUnique

protected boolean isNewLineUnique(BudgetConstructionDocument budgetConstructionDocument,
                                  PendingBudgetConstructionGeneralLedger newLine,
                                  org.kuali.rice.kns.util.MessageMap errors,
                                  boolean isRevenue)

isNonWagesAccountNotLaborObject

protected boolean isNonWagesAccountNotLaborObject(BudgetConstructionDocument budgetConstructionDocument,
                                                  PendingBudgetConstructionGeneralLedger accountingLine,
                                                  org.kuali.rice.kns.util.MessageMap errors,
                                                  boolean isAdd)

isNotFringeBenefitObject

protected boolean isNotFringeBenefitObject(List paramValues,
                                           PendingBudgetConstructionGeneralLedger accountingLine,
                                           org.kuali.rice.kns.util.MessageMap errors,
                                           boolean isAdd)

isNotSalarySettingOnly

protected boolean isNotSalarySettingOnly(List fundGroupParamValues,
                                         List subfundGroupParamValues,
                                         BudgetConstructionDocument budgetConstructionDocument,
                                         PendingBudgetConstructionGeneralLedger accountingLine,
                                         org.kuali.rice.kns.util.MessageMap errors,
                                         boolean isRevenue,
                                         boolean isAdd)

isBudgetAllowed

protected boolean isBudgetAllowed(BudgetConstructionDocument budgetConstructionDocument,
                                  String propertyName,
                                  org.kuali.rice.kns.util.MessageMap errors,
                                  boolean isAdd,
                                  boolean isDocumentAdd)
runs rule checks that don't allow a budget

Parameters:
budgetConstructionDocument -
propertyName -
errors -
isAdd -
isDocumentAdd -
Returns:

isValidAccount

public boolean isValidAccount(Account account,
                              String value,
                              org.kuali.rice.kns.datadictionary.DataDictionary dataDictionary,
                              String errorPropertyName)

isValidSubAccount

public boolean isValidSubAccount(SubAccount subAccount,
                                 String value,
                                 org.kuali.rice.kns.datadictionary.DataDictionary dataDictionary,
                                 String errorPropertyName)

isValidSubObjectCode

public boolean isValidSubObjectCode(SubObjectCode subObjectCode,
                                    String value,
                                    org.kuali.rice.kns.datadictionary.DataDictionary dataDictionary,
                                    String errorPropertyName)
Runs existence and active tests on the SubObjectCode reference This method is differenct than the one in AccountingLineRuleHelper in that it adds the bad value to the errormessage This method signature should probably be added to AccountingLineRuleHelper

Parameters:
subObjectCode -
value -
dataDictionary -
errorPropertyName -
Returns:

isValidObjectCode

public boolean isValidObjectCode(ObjectCode objectCode,
                                 String value,
                                 org.kuali.rice.kns.datadictionary.DataDictionary dataDictionary,
                                 String errorPropertyName)
Runs existence and active tests on the ObjectCode reference This method is differenct than the one in AccountingLineRuleHelper in that it adds the bad value to the errormessage This method signature should probably be added to AccountingLineRuleHelper

Parameters:
objectCode -
value -
dataDictionary -
errorPropertyName -
Returns:

putError

protected void putError(org.kuali.rice.kns.util.MessageMap errors,
                        String propertyName,
                        String errorKey,
                        boolean isAdd,
                        String... errorParameters)
puts error to errormap for propertyName if isAdd, otherwise the property name is replaced with value of TARGET_ERROR_PROPERTY_NAME

Parameters:
propertyName -
errorKey -
isAdd -
errorParameters -


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