org.kuali.kfs.module.cam.document.validation.impl
Class AssetGlobalRule

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.module.cam.document.validation.impl.AssetGlobalRule
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 AssetGlobalRule
extends org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase

Rule implementation for Asset Global document.


Field Summary
protected static Map<AssetLocationService.LocationField,String> LOCATION_FIELD_MAP
           
 
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, personService, priorErrorPath, roleService, workflowDocumentService
 
Constructor Summary
AssetGlobalRule()
           
 
Method Summary
protected  boolean checkNegativeOrZeroPayment(org.kuali.rice.kns.document.MaintenanceDocument maintenanceDocument, AssetPaymentDetail assetPaymentDetail)
          "Add Negative Payment" permission check.
protected  boolean checkReferenceExists(AssetGlobal assetGlobal, AssetPaymentDetail assetPaymentDetail)
          This method checks reference fields when adding new payment into collection.
protected  boolean checkReferenceExists(AssetGlobalDetail assetGlobalDetail)
          This method checks reference fields when adding one shared location information into collection.
protected  boolean checkRequiredFieldsForNewOrNonCapital(AssetPaymentDetail assetPaymentDetail)
          This method check the required fields for acquisition type New .
protected  AssetAcquisitionTypeService getAssetAcquisitionTypeService()
           
protected  AssetGlobalService getAssetGlobalService()
           
protected  AssetPaymentService getAssetPaymentService()
           
protected  AssetService getAssetService()
           
protected  String getCapitalizationThresholdAmount()
          Get the capitalization threshold amount from the system parameter setting.
protected  org.kuali.rice.kns.service.ParameterService getParameterService()
           
protected  boolean isAccountInvalid(Account account)
           
protected  boolean isCapitalStatus(AssetGlobal assetGlobal)
           
protected  boolean isOrgOwnerAccountFromCab(AssetGlobal assetGlobal)
          Check if organization owner account is set from CAB.
protected  boolean isStatusCodeRetired(String statusCode)
           
 boolean processCustomAddCollectionLineBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document, String collectionName, org.kuali.rice.kns.bo.PersistableBusinessObject line)
           
protected  boolean processCustomRouteDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
           
protected  boolean processCustomSaveDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
           
 boolean processSaveDocument(org.kuali.rice.kns.document.Document document)
           
protected  boolean setAssetLock(org.kuali.rice.kns.document.MaintenanceDocument document, AssetGlobal assetGlobal)
          Locking on separate source asset number
protected  boolean validateAccount(AssetGlobal assetGlobal)
           
protected  boolean validateAcquisitionIncomeObjectCode(AssetGlobal assetGlobal)
          Validate offset object code
static boolean validateAssetAlreadySeparated(Long separateSourceCapitalAssetNumber)
          Give an error if this asset has already been separated
protected  boolean validateAssetDescription(AssetGlobalDetail uniqueLocationDetails)
          Validates the asset description.
protected  boolean validateAssetTotalAmount(org.kuali.rice.kns.document.MaintenanceDocument document)
          check if amount is above threshold for capital assets for normal user.
static boolean validateAssetTotalCostMatchesPaymentTotalCost(AssetGlobal assetGlobal)
          Give an error if this asset can't be separated due to mismatching amount on asset and AssetPayment records
protected  boolean validateAssetType(AssetGlobal assetGlobal)
          Validate asset type at the AssetGlobal level.
protected  boolean validateAssetType(AssetGlobalDetail assetGlobalUniqueDetails, Integer sharedIndex, Integer uniqueIndex)
          Validate asset type in the AssetGlobalUniqueDetails level, and ensures the value is in the list of valid types.
protected  boolean validateCapitalAssetAmountAboveThreshhold(org.kuali.rice.kns.document.MaintenanceDocument document, org.kuali.rice.kns.util.KualiDecimal assetAmount, String capitalizationThresholdAmount)
          Validate Capital Asset Amount above the threshold or below the amount for authorized user only.
protected  boolean validateCapitalAssetTypeCode(AssetGlobalDetail uniqueLocationDetails)
          Validates the capital asset type code.
protected  boolean validateDocumentTypeForNonNew(String acquisitionTypeCode, AssetPaymentDetail assetPaymentDetail)
          When acquisition type code is Capital (Gifts, Transfer-in, State excess, and Found), payment document type code will be assigned to AA for Add Asset Document.
protected  boolean validateLocation(AssetGlobal assetGlobal, AssetGlobalDetail assetGlobalDetail)
          Validate location
protected  boolean validateLocationCollection(AssetGlobal assetGlobal, List<AssetGlobalDetail> assetSharedDetails)
           
protected  boolean validateLocationQuantity(org.kuali.rice.kns.bo.PersistableBusinessObject line)
          Validated the location quantity
protected  boolean validateManufacturer(AssetGlobalDetail uniqueLocationDetails)
          Validates the manufacturer.
protected  boolean validateNonCapitalAssetAmountBelowThreshold(org.kuali.rice.kns.util.KualiDecimal assetAmount, String capitalizationThresholdAmount)
          Validate non-capital asset amount below the threshold.
protected  boolean validateObjectCode(ObjectCode objectCode, AssetGlobal assetGlobal)
          Check object code is set to capital only when the status is capital.
protected  boolean validatePaymentCollection(org.kuali.rice.kns.document.MaintenanceDocument maintenanceDocument, AssetGlobal assetGlobal)
           
protected  boolean validatePaymentLine(org.kuali.rice.kns.document.MaintenanceDocument maintenanceDocument, AssetGlobal assetGlobal, AssetPaymentDetail assetPaymentDetail)
           
protected  boolean validatePostedDate(AssetPaymentDetail assetPaymentDetail)
          Validates the posted date payment posted date can't be a future date
protected  boolean validateSeparateSourceAmount(AssetGlobalDetail uniqueLocationDetail, org.kuali.rice.kns.document.MaintenanceDocument document)
          Validates the separate source amount.
protected  boolean validateSeparateSourceAmountAboveThreshold(org.kuali.rice.kns.document.MaintenanceDocument document, AssetGlobalDetail assetGlobalUniqueDetail)
          Validate all separate source amount is above the capital asset threshold amount.
protected  boolean validateTagDuplication(List<AssetGlobalDetail> assetSharedDetails)
           
protected  boolean validateTagDuplication(List<AssetGlobalDetail> assetSharedDetails, String campusTagNumber)
           
protected  boolean validateTotalCostAmount(AssetGlobal assetGlobal)
          Validate that the total cost of the source asset is not zero or a negative amount.
protected  boolean validateVendorAndManufacturer(AssetGlobal assetGlobal)
           
 
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, 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, setupConvenienceObjects, 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

LOCATION_FIELD_MAP

protected static final Map<AssetLocationService.LocationField,String> LOCATION_FIELD_MAP
Constructor Detail

AssetGlobalRule

public AssetGlobalRule()
Method Detail

checkReferenceExists

protected boolean checkReferenceExists(AssetGlobal assetGlobal,
                                       AssetPaymentDetail assetPaymentDetail)
This method checks reference fields when adding new payment into collection.

Parameters:
assetGlobal -
assetPaymentDetail -
Returns:

checkReferenceExists

protected boolean checkReferenceExists(AssetGlobalDetail assetGlobalDetail)
This method checks reference fields when adding one shared location information into collection.

Parameters:
assetGlobalDetail -
Returns:

isCapitalStatus

protected boolean isCapitalStatus(AssetGlobal assetGlobal)

isStatusCodeRetired

protected boolean isStatusCodeRetired(String statusCode)

processCustomAddCollectionLineBusinessRules

public boolean processCustomAddCollectionLineBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document,
                                                           String collectionName,
                                                           org.kuali.rice.kns.bo.PersistableBusinessObject line)
Overrides:
processCustomAddCollectionLineBusinessRules in class org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase

validateLocationQuantity

protected boolean validateLocationQuantity(org.kuali.rice.kns.bo.PersistableBusinessObject line)
Validated the location quantity

Parameters:
line -
Returns:
boolean

validateTagDuplication

protected boolean validateTagDuplication(List<AssetGlobalDetail> assetSharedDetails,
                                         String campusTagNumber)

validateTagDuplication

protected boolean validateTagDuplication(List<AssetGlobalDetail> assetSharedDetails)

validatePaymentLine

protected boolean validatePaymentLine(org.kuali.rice.kns.document.MaintenanceDocument maintenanceDocument,
                                      AssetGlobal assetGlobal,
                                      AssetPaymentDetail assetPaymentDetail)

checkNegativeOrZeroPayment

protected boolean checkNegativeOrZeroPayment(org.kuali.rice.kns.document.MaintenanceDocument maintenanceDocument,
                                             AssetPaymentDetail assetPaymentDetail)
"Add Negative Payment" permission check.

Parameters:
maintenanceDocument -
assetPaymentDetail -
Returns:

checkRequiredFieldsForNewOrNonCapital

protected boolean checkRequiredFieldsForNewOrNonCapital(AssetPaymentDetail assetPaymentDetail)
This method check the required fields for acquisition type New .

Parameters:
assetPaymentDetail -
Returns:

validatePostedDate

protected boolean validatePostedDate(AssetPaymentDetail assetPaymentDetail)
Validates the posted date payment posted date can't be a future date

Parameters:
assetPaymentDetail -
Returns:
boolean

validateDocumentTypeForNonNew

protected boolean validateDocumentTypeForNonNew(String acquisitionTypeCode,
                                                AssetPaymentDetail assetPaymentDetail)
When acquisition type code is Capital (Gifts, Transfer-in, State excess, and Found), payment document type code will be assigned to AA for Add Asset Document.

Parameters:
documentTypeCode -
Returns:

validateObjectCode

protected boolean validateObjectCode(ObjectCode objectCode,
                                     AssetGlobal assetGlobal)
Check object code is set to capital only when the status is capital.

Parameters:
assetGlobal -
assetPaymentDetail -
Returns:
valid

isAccountInvalid

protected boolean isAccountInvalid(Account account)

processCustomRouteDocumentBusinessRules

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

validateSeparateSourceAmountAboveThreshold

protected boolean validateSeparateSourceAmountAboveThreshold(org.kuali.rice.kns.document.MaintenanceDocument document,
                                                             AssetGlobalDetail assetGlobalUniqueDetail)
Validate all separate source amount is above the capital asset threshold amount.

Parameters:
document -
Returns:

validateAssetTotalAmount

protected boolean validateAssetTotalAmount(org.kuali.rice.kns.document.MaintenanceDocument document)
check if amount is above threshold for capital assets for normal user. minTotalPaymentByAsset and maxTotalPaymentByAsset are used to check against threshold. Due to the decimal rounding, the asset total amount could have 1 cent difference with each other. We need to pick up the right value for different threshold check.

Parameters:
document -
Returns:

getCapitalizationThresholdAmount

protected String getCapitalizationThresholdAmount()
Get the capitalization threshold amount from the system parameter setting.

Returns:

validateCapitalAssetAmountAboveThreshhold

protected boolean validateCapitalAssetAmountAboveThreshhold(org.kuali.rice.kns.document.MaintenanceDocument document,
                                                            org.kuali.rice.kns.util.KualiDecimal assetAmount,
                                                            String capitalizationThresholdAmount)
Validate Capital Asset Amount above the threshold or below the amount for authorized user only.

Parameters:
document -
assetAmount -
capitalizationThresholdAmount -
Returns:

validateNonCapitalAssetAmountBelowThreshold

protected boolean validateNonCapitalAssetAmountBelowThreshold(org.kuali.rice.kns.util.KualiDecimal assetAmount,
                                                              String capitalizationThresholdAmount)
Validate non-capital asset amount below the threshold.

Parameters:
assetAmount -
capitalizationThresholdAmount -
Returns:

validateTotalCostAmount

protected boolean validateTotalCostAmount(AssetGlobal assetGlobal)
Validate that the total cost of the source asset is not zero or a negative amount.

Parameters:
assetGlobal -
Returns:
boolean

validateCapitalAssetTypeCode

protected boolean validateCapitalAssetTypeCode(AssetGlobalDetail uniqueLocationDetails)
Validates the capital asset type code. This only checks for the existence of some contents, not whether the contents are valid.

Parameters:
uniqueLocationDetails -
Returns:
boolean

validateAssetDescription

protected boolean validateAssetDescription(AssetGlobalDetail uniqueLocationDetails)
Validates the asset description.

Parameters:
uniqueLocationDetails -
Returns:
boolean

validateManufacturer

protected boolean validateManufacturer(AssetGlobalDetail uniqueLocationDetails)
Validates the manufacturer.

Parameters:
uniqueLocationDetails -
Returns:
boolean

validateSeparateSourceAmount

protected boolean validateSeparateSourceAmount(AssetGlobalDetail uniqueLocationDetail,
                                               org.kuali.rice.kns.document.MaintenanceDocument document)
Validates the separate source amount.

Parameters:
uniqueLocationDetails -
Returns:
boolean

validateLocationCollection

protected boolean validateLocationCollection(AssetGlobal assetGlobal,
                                             List<AssetGlobalDetail> assetSharedDetails)

processCustomSaveDocumentBusinessRules

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

setAssetLock

protected boolean setAssetLock(org.kuali.rice.kns.document.MaintenanceDocument document,
                               AssetGlobal assetGlobal)
Locking on separate source asset number

Parameters:
document -
assetGlobal -
Returns:

validateAcquisitionIncomeObjectCode

protected boolean validateAcquisitionIncomeObjectCode(AssetGlobal assetGlobal)
Validate offset object code

Parameters:
assetGlobal -
Returns:

validatePaymentCollection

protected boolean validatePaymentCollection(org.kuali.rice.kns.document.MaintenanceDocument maintenanceDocument,
                                            AssetGlobal assetGlobal)

validateVendorAndManufacturer

protected boolean validateVendorAndManufacturer(AssetGlobal assetGlobal)

processSaveDocument

public boolean processSaveDocument(org.kuali.rice.kns.document.Document document)
Specified by:
processSaveDocument in interface org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRule
Specified by:
processSaveDocument in interface org.kuali.rice.kns.rule.SaveDocumentRule
Overrides:
processSaveDocument in class org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase

validateAccount

protected boolean validateAccount(AssetGlobal assetGlobal)

isOrgOwnerAccountFromCab

protected boolean isOrgOwnerAccountFromCab(AssetGlobal assetGlobal)
Check if organization owner account is set from CAB. We honor all accounting lines from CAB are valid payments even thougth they are expired.

Parameters:
assetGlobal -
Returns:

validateLocation

protected boolean validateLocation(AssetGlobal assetGlobal,
                                   AssetGlobalDetail assetGlobalDetail)
Validate location

Parameters:
assetGlobal -
Returns:
boolean

validateAssetType

protected boolean validateAssetType(AssetGlobal assetGlobal)
Validate asset type at the AssetGlobal level. Only checks that there are contents in the object.

Parameters:
assetGlobal -
Returns:
boolean

validateAssetType

protected boolean validateAssetType(AssetGlobalDetail assetGlobalUniqueDetails,
                                    Integer sharedIndex,
                                    Integer uniqueIndex)
Validate asset type in the AssetGlobalUniqueDetails level, and ensures the value is in the list of valid types. The incoming indices are for creation of the errorPath for the global variable message map, which will determine what text field to mark as having a problem. This was written to be called within a loop.

Parameters:
assetGlobalUniqueDetails -
sharedIndex - the index of the shared details within the AssetGlobal
uniqueIndex - the index of the unique details within the shared details
Returns:
boolean

validateAssetTotalCostMatchesPaymentTotalCost

public static boolean validateAssetTotalCostMatchesPaymentTotalCost(AssetGlobal assetGlobal)
Give an error if this asset can't be separated due to mismatching amount on asset and AssetPayment records

Parameters:
assetGlobal -
Returns:
validation success of failure

validateAssetAlreadySeparated

public static boolean validateAssetAlreadySeparated(Long separateSourceCapitalAssetNumber)
Give an error if this asset has already been separated

Parameters:
assetGlobal -
Returns:
validation success of failure

getParameterService

protected org.kuali.rice.kns.service.ParameterService getParameterService()

getAssetService

protected AssetService getAssetService()

getAssetPaymentService

protected AssetPaymentService getAssetPaymentService()

getAssetAcquisitionTypeService

protected AssetAcquisitionTypeService getAssetAcquisitionTypeService()

getAssetGlobalService

protected AssetGlobalService getAssetGlobalService()


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