Search in sources :

Example 11 with BusinessObjectService

use of org.kuali.kfs.krad.service.BusinessObjectService in project cu-kfs by CU-CommunityApps.

the class AccountExtendedAttribute method setMajorReportingCategoryCode.

/**
 * @param majorReportingCategoryCode the majorReportingCategoryCode to set
 */
public void setMajorReportingCategoryCode(String majorReportingCategoryCode) {
    this.majorReportingCategoryCode = majorReportingCategoryCode;
    BusinessObjectService bos = SpringContext.getBean(BusinessObjectService.class);
    HashMap<String, String> keys = new HashMap<String, String>();
    keys.put("majorReportingCategoryCode", majorReportingCategoryCode);
    majorReportingCategory = (MajorReportingCategory) bos.findByPrimaryKey(MajorReportingCategory.class, keys);
}
Also used : HashMap(java.util.HashMap) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 12 with BusinessObjectService

use of org.kuali.kfs.krad.service.BusinessObjectService in project cu-kfs by CU-CommunityApps.

the class AccountExtendedAttribute method setInvoiceTypeCode.

/**
 * @param invoiceTypeCode the invoiceTypeCode to set
 */
public void setInvoiceTypeCode(String invoiceTypeCode) {
    this.invoiceTypeCode = invoiceTypeCode;
    BusinessObjectService bos = SpringContext.getBean(BusinessObjectService.class);
    HashMap<String, String> keys = new HashMap<String, String>();
    keys.put("invoiceTypeCode", invoiceTypeCode);
    invoiceType = (InvoiceType) bos.findByPrimaryKey(InvoiceType.class, keys);
// invoiceType.setInvoiceTypeCode(invoiceTypeCode);
}
Also used : HashMap(java.util.HashMap) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 13 with BusinessObjectService

use of org.kuali.kfs.krad.service.BusinessObjectService in project cu-kfs by CU-CommunityApps.

the class OrganizationGlobal method generateGlobalChangesToPersist.

@Override
public List<PersistableBusinessObject> generateGlobalChangesToPersist() {
    /*
         * The logic below is based on that from the AccountGlobal class.
         */
    List<PersistableBusinessObject> globalChanges = new ArrayList<PersistableBusinessObject>();
    BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
    for (OrganizationGlobalDetail detail : organizationGlobalDetails) {
        Organization org = boService.findByPrimaryKey(Organization.class, detail.getPrimaryKeys());
        if (org != null) {
            // ORGANIZATION MANAGER UNIVERSAL ID
            if (StringUtils.isNotBlank(organizationManagerUniversalId)) {
                org.setOrganizationManagerUniversalId(organizationManagerUniversalId);
            }
            // ORGANIZATION PHYSICAL CAMPUS CODE
            if (StringUtils.isNotBlank(organizationPhysicalCampusCode)) {
                org.setOrganizationPhysicalCampusCode(organizationPhysicalCampusCode);
            }
            // ORGANIZATION LINE 1 ADDRESS
            if (StringUtils.isNotBlank(organizationLine1Address)) {
                org.setOrganizationLine1Address(organizationLine1Address);
            }
            // ORGANIZATION LINE 2 ADDRESS
            if (StringUtils.isNotBlank(organizationLine2Address)) {
                org.setOrganizationLine2Address(organizationLine2Address);
            }
            // ORGANIZATION CITY NAME
            if (StringUtils.isNotBlank(organizationCityName)) {
                org.setOrganizationCityName(organizationCityName);
            }
            // ORGANIZATION STATE CODE
            if (StringUtils.isNotBlank(organizationStateCode)) {
                org.setOrganizationStateCode(organizationStateCode);
            }
            // ORGANIZATION ZIP CODE
            if (StringUtils.isNotBlank(organizationZipCode)) {
                org.setOrganizationZipCode(organizationZipCode);
            }
            // ORGANIZATION COUNTRY CODE
            if (StringUtils.isNotBlank(organizationCountryCode)) {
                org.setOrganizationCountryCode(organizationCountryCode);
            }
            globalChanges.add(org);
        }
    }
    return globalChanges;
}
Also used : PersistableBusinessObject(org.kuali.kfs.krad.bo.PersistableBusinessObject) Organization(org.kuali.kfs.coa.businessobject.Organization) ArrayList(java.util.ArrayList) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 14 with BusinessObjectService

use of org.kuali.kfs.krad.service.BusinessObjectService in project cu-kfs by CU-CommunityApps.

the class AccountGlobalRule method checkSubFundProgram.

protected boolean checkSubFundProgram(MaintenanceDocument document) {
    boolean success = true;
    String subFundGroupCode = newAccountGlobal.getSubFundGroupCode();
    String subFundProg = newAccountGlobal.getProgramCode();
    BusinessObjectService bos = SpringContext.getBean(BusinessObjectService.class);
    if (StringUtils.isNotBlank(subFundProg)) {
        Map<String, String> fieldValues = new HashMap<>();
        fieldValues.put(KFSPropertyConstants.SUB_FUND_GROUP_CODE, subFundGroupCode);
        fieldValues.put(CUKFSPropertyConstants.PROGRAM_CODE, subFundProg);
        Collection<SubFundProgram> retVals = bos.findMatching(SubFundProgram.class, fieldValues);
        if (retVals.isEmpty()) {
            success = false;
            putFieldError(CUKFSPropertyConstants.PROGRAM_CODE, CUKFSKeyConstants.ERROR_DOCUMENT_ACCMAINT_PROGRAM_CODE_NOT_GROUP_CODE, new String[] { subFundProg, subFundGroupCode });
        } else {
            for (SubFundProgram subFundProgram : retVals) {
                if (!subFundProgram.isActive()) {
                    putFieldError(CUKFSPropertyConstants.PROGRAM_CODE, KFSKeyConstants.ERROR_INACTIVE, getFieldLabel(Account.class, CUKFSPropertyConstants.PROGRAM_CODE));
                    success = false;
                    break;
                }
            }
        }
    } else {
        Map<String, String> fieldValues = new HashMap<String, String>();
        fieldValues.put(KFSPropertyConstants.SUB_FUND_GROUP_CODE, subFundGroupCode);
        Collection<SubFundProgram> retVals = bos.findMatching(SubFundProgram.class, fieldValues);
        if (!retVals.isEmpty()) {
            success = false;
            putFieldError(CUKFSPropertyConstants.PROGRAM_CODE, CUKFSKeyConstants.ERROR_DOCUMENT_ACCMAINT_PROGRAM_CODE_CANNOT_BE_BLANK_FOR_GROUP_CODE, new String[] { subFundGroupCode });
        }
    }
    return success;
}
Also used : AppropriationAccount(edu.cornell.kfs.coa.businessobject.AppropriationAccount) Account(org.kuali.kfs.coa.businessobject.Account) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) HashMap(java.util.HashMap) SubFundProgram(edu.cornell.kfs.coa.businessobject.SubFundProgram) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 15 with BusinessObjectService

use of org.kuali.kfs.krad.service.BusinessObjectService in project cu-kfs by CU-CommunityApps.

the class Account method preUpdate.

@Override
protected void preUpdate() {
    super.preUpdate();
    try {
        // KULCOA-549: update the sufficient funds table
        // get the current data from the database
        BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
        Account originalAcct = (Account) boService.retrieve(this);
        if (originalAcct != null) {
            if (!originalAcct.getSufficientFundsCode().equals(getSufficientFundsCode()) || originalAcct.isExtrnlFinEncumSufficntFndIndicator() != isExtrnlFinEncumSufficntFndIndicator() || originalAcct.isIntrnlFinEncumSufficntFndIndicator() != isIntrnlFinEncumSufficntFndIndicator() || originalAcct.isPendingAcctSufficientFundsIndicator() != isPendingAcctSufficientFundsIndicator() || originalAcct.isFinPreencumSufficientFundIndicator() != isFinPreencumSufficientFundIndicator()) {
                SufficientFundRebuild sfr = new SufficientFundRebuild();
                sfr.setAccountFinancialObjectTypeCode(SufficientFundRebuild.REBUILD_ACCOUNT);
                sfr.setChartOfAccountsCode(getChartOfAccountsCode());
                sfr.setAccountNumberFinancialObjectCode(getAccountNumber());
                if (boService.retrieve(sfr) == null) {
                    boService.save(sfr);
                }
            }
        }
    } catch (Exception ex) {
        LOG.error("Problem updating sufficient funds rebuild table: ", ex);
    }
}
Also used : SufficientFundRebuild(org.kuali.kfs.gl.businessobject.SufficientFundRebuild) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Aggregations

BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)34 HashMap (java.util.HashMap)26 Map (java.util.Map)7 Account (org.kuali.kfs.coa.businessobject.Account)7 AppropriationAccount (edu.cornell.kfs.coa.businessobject.AppropriationAccount)6 ArrayList (java.util.ArrayList)6 List (java.util.List)5 AccountExtendedAttribute (edu.cornell.kfs.coa.businessobject.AccountExtendedAttribute)4 LinkedHashMap (java.util.LinkedHashMap)4 SubFundProgram (edu.cornell.kfs.coa.businessobject.SubFundProgram)3 ContractGrantReportingCode (edu.cornell.kfs.coa.businessobject.ContractGrantReportingCode)2 IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount)2 CheckReconciliation (com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation)1 CUObjectCodeGlobal (edu.cornell.kfs.coa.businessobject.CUObjectCodeGlobal)1 CuAccountGlobal (edu.cornell.kfs.coa.businessobject.CuAccountGlobal)1 MajorReportingCategory (edu.cornell.kfs.coa.businessobject.MajorReportingCategory)1 ObjectCodeExtendedAttribute (edu.cornell.kfs.coa.businessobject.ObjectCodeExtendedAttribute)1 AccountReversionImportService (edu.cornell.kfs.coa.service.AccountReversionImportService)1 AccountReversionTrickleDownInactivationService (edu.cornell.kfs.coa.service.AccountReversionTrickleDownInactivationService)1 EzraProposalAward (edu.cornell.kfs.module.ezra.businessobject.EzraProposalAward)1