Search in sources :

Example 6 with AccountExtendedAttribute

use of edu.cornell.kfs.coa.businessobject.AccountExtendedAttribute in project cu-kfs by CU-CommunityApps.

the class AccountExtensionRule method checkAppropriationAccount.

protected boolean checkAppropriationAccount(MaintenanceDocument document) {
    boolean success = true;
    String subFundGroupCode = newAccount.getSubFundGroupCode();
    String appropriationAccountNumber = ((AccountExtendedAttribute) newAccount.getExtension()).getAppropriationAccountNumber();
    BusinessObjectService bos = SpringContext.getBean(BusinessObjectService.class);
    if (!StringUtils.isBlank(appropriationAccountNumber)) {
        Map fieldValues = new HashMap();
        fieldValues.put("subFundGroupCode", subFundGroupCode);
        fieldValues.put("appropriationAccountNumber", appropriationAccountNumber);
        Collection<AppropriationAccount> retVals = bos.findMatching(AppropriationAccount.class, fieldValues);
        if (retVals.isEmpty()) {
            success = false;
            putFieldError("extension.appropriationAccountNumber", CUKFSKeyConstants.ERROR_DOCUMENT_ACCMAINT_APPROP_ACCT_NOT_GROUP_CODE, new String[] { appropriationAccountNumber, subFundGroupCode });
        } else {
            for (AppropriationAccount sfp : retVals) {
                if (!sfp.isActive()) {
                    putFieldError("extension.appropriationAccountNumber", KFSKeyConstants.ERROR_INACTIVE, getFieldLabel(Account.class, "extension.appropriationAccountNumber"));
                    success = false;
                }
            }
        }
    }
    return success;
}
Also used : Account(org.kuali.kfs.coa.businessobject.Account) AppropriationAccount(edu.cornell.kfs.coa.businessobject.AppropriationAccount) AppropriationAccount(edu.cornell.kfs.coa.businessobject.AppropriationAccount) HashMap(java.util.HashMap) AccountExtendedAttribute(edu.cornell.kfs.coa.businessobject.AccountExtendedAttribute) HashMap(java.util.HashMap) Map(java.util.Map) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Aggregations

AccountExtendedAttribute (edu.cornell.kfs.coa.businessobject.AccountExtendedAttribute)6 AppropriationAccount (edu.cornell.kfs.coa.businessobject.AppropriationAccount)6 Account (org.kuali.kfs.coa.businessobject.Account)5 HashMap (java.util.HashMap)4 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)4 SubFundProgram (edu.cornell.kfs.coa.businessobject.SubFundProgram)3 Map (java.util.Map)3 IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount)2 CuAccountGlobal (edu.cornell.kfs.coa.businessobject.CuAccountGlobal)1 MajorReportingCategory (edu.cornell.kfs.coa.businessobject.MajorReportingCategory)1 AccountReversionTrickleDownInactivationService (edu.cornell.kfs.coa.service.AccountReversionTrickleDownInactivationService)1 AccountGlobal (org.kuali.kfs.coa.businessobject.AccountGlobal)1 MaintenanceDocument (org.kuali.kfs.kns.document.MaintenanceDocument)1 Document (org.kuali.kfs.krad.document.Document)1 DocumentService (org.kuali.kfs.krad.service.DocumentService)1