Search in sources :

Example 31 with BusinessObjectService

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

the class CapitalAssetInformationAction method findGeneralLedgerEntry.

/**
 * Retrieves the CAB General Ledger Entry from DB
 *
 * @param generalLedgerEntryId Entry Id
 * @return GeneralLedgerEntry
 */
protected GeneralLedgerEntry findGeneralLedgerEntry(Long generalLedgerEntryId, boolean requireNew) {
    BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
    Map<String, Object> pkeys = new HashMap<String, Object>();
    pkeys.put(CamsPropertyConstants.GeneralLedgerEntry.GENERAL_LEDGER_ACCOUNT_IDENTIFIER, generalLedgerEntryId);
    if (requireNew) {
        pkeys.put(CamsPropertyConstants.GeneralLedgerEntry.ACTIVITY_STATUS_CODE, CamsConstants.ActivityStatusCode.NEW);
    }
    GeneralLedgerEntry entry = boService.findByPrimaryKey(GeneralLedgerEntry.class, pkeys);
    return entry;
}
Also used : HashMap(java.util.HashMap) GeneralLedgerEntry(org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 32 with BusinessObjectService

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

the class CuLaborBenefitsCalculationServiceImpl method getBenefitRateCategoryCode.

@Override
public String getBenefitRateCategoryCode(String chartOfAccountsCode, String accountNumber, String subAccountNumber) {
    this.setCostSharingSourceAccountNumber(null);
    this.setCostSharingSourceAccountChartOfAccountsCode(null);
    this.setCostSharingSourceSubAccountNumber(null);
    // make sure the sub accout number is filled in
    if (subAccountNumber != null) {
        LOG.info("Sub Account Number was filled in. Checking to see if it is a Cost Sharing Sub Account.");
        // make sure the system parameter exists
        if (SpringContext.getBean(ParameterService.class).parameterExists(KfsParameterConstants.FINANCIAL_SYSTEM_ALL.class, "USE_COST_SHARE_SOURCE_ACCOUNT_BENEFIT_RATE_IND")) {
            // parameter exists, determine the value of the parameter
            String sysParam2 = SpringContext.getBean(ParameterService.class).getParameterValueAsString(KfsParameterConstants.FINANCIAL_SYSTEM_ALL.class, "USE_COST_SHARE_SOURCE_ACCOUNT_BENEFIT_RATE_IND");
            LOG.debug("sysParam2: " + sysParam2);
            // if sysParam2 == Y then check to see if it's a cost sharing sub account
            if (sysParam2.equalsIgnoreCase("Y")) {
                // lookup the A21SubAccount to get the cost sharing source account
                Map<String, Object> subFieldValues = new HashMap<String, Object>();
                subFieldValues.put(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, chartOfAccountsCode);
                subFieldValues.put(KFSPropertyConstants.SUB_ACCOUNT_NUMBER, subAccountNumber);
                subFieldValues.put(KFSPropertyConstants.SUB_ACCOUNT_TYPE_CODE, "CS");
                subFieldValues.put(KFSPropertyConstants.ACCOUNT_NUMBER, accountNumber);
                LOG.info("Looking for a cost sharing sub account for sub account number " + subAccountNumber);
                if (ObjectUtils.isNull(businessObjectService)) {
                    this.businessObjectService = SpringContext.getBean(BusinessObjectService.class);
                }
                // perform the lookup
                List<A21SubAccount> subAccountList = (List<A21SubAccount>) businessObjectService.findMatching(A21SubAccount.class, subFieldValues);
                // check to see if the lookup returns an empty list
                if (subAccountList.size() > 0) {
                    LOG.info("Found A21 Sub Account. Retrieving source account number for cost sharing.");
                    accountNumber = subAccountList.get(0).getCostShareSourceAccountNumber();
                    LOG.debug("Cost Sharing Source Account Number : " + accountNumber);
                    this.setCostSharingSourceAccountNumber(accountNumber);
                    this.setCostSharingSourceAccountChartOfAccountsCode(subAccountList.get(0).getCostShareChartOfAccountCode());
                    this.setCostSharingSourceSubAccountNumber(subAccountList.get(0).getCostShareSourceSubAccountNumber());
                } else {
                    LOG.info(subAccountNumber + " is not a cost sharing account.  Using the Labor Benefit Rate Category from the account number.");
                }
            } else {
                LOG.info("Using the Grant Account to determine the labor benefit rate category code.");
            }
        }
    }
    LOG.info("Looking up Account {" + chartOfAccountsCode + "," + accountNumber + "}");
    // lookup the account from the db based off the account code and the account number
    Account account = this.getAccountService().getByPrimaryId(chartOfAccountsCode, accountNumber);
    String laborBenefitRateCategoryCode = null;
    if (account == null) {
        LOG.info("The Account {" + chartOfAccountsCode + "," + accountNumber + "} could not be found.");
    } else {
        laborBenefitRateCategoryCode = account.getLaborBenefitRateCategoryCode();
    }
    // make sure the laborBenefitRateCategoryCode is not null or blank
    if (StringUtils.isBlank(laborBenefitRateCategoryCode)) {
        LOG.info("The Account did not have a Labor Benefit Rate Category Code. Will use the system parameter default.");
        // The system parameter does not exist. Using a blank Labor Benefit Rate Category Code
        laborBenefitRateCategoryCode = StringUtils.defaultString(SpringContext.getBean(ParameterService.class).getParameterValueAsString(Account.class, LaborConstants.BenefitCalculation.DEFAULT_BENEFIT_RATE_CATEGORY_CODE_PARAMETER));
    } else {
        LOG.debug("Labor Benefit Rate Category Code for Account " + accountNumber + " is " + laborBenefitRateCategoryCode);
    }
    return laborBenefitRateCategoryCode;
}
Also used : A21SubAccount(org.kuali.kfs.coa.businessobject.A21SubAccount) Account(org.kuali.kfs.coa.businessobject.Account) ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) HashMap(java.util.HashMap) KfsParameterConstants(org.kuali.kfs.sys.service.impl.KfsParameterConstants) List(java.util.List) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService) A21SubAccount(org.kuali.kfs.coa.businessobject.A21SubAccount)

Example 33 with BusinessObjectService

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

the class PaymentGroup method setPayeeOwnerCdFromVendor.

/**
 * @param string
 */
public void setPayeeOwnerCdFromVendor(String string) {
    // payeeOwnerCd = string;
    BusinessObjectService bos = SpringContext.getBean(BusinessObjectService.class);
    String[] headerDetails = payeeId.split("-");
    Map<String, String> fieldValues = new HashMap<String, String>();
    fieldValues.put("vendorHeaderGeneratedIdentifier", headerDetails[0]);
    fieldValues.put("vendorDetailAssignedIdentifier", headerDetails[1]);
    List<VendorDetail> details = (List<VendorDetail>) bos.findMatching(VendorDetail.class, fieldValues);
    if (details.size() == 1) {
        payeeOwnerCd = details.get(0).getVendorHeader().getVendorOwnershipCode();
    } else {
        throw new RuntimeException("Could not locate Vendor Ownership Code for payeeId [ " + string + " ]");
    }
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) List(java.util.List) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 34 with BusinessObjectService

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

the class PaymentGroup method validateVendorIdAndCustomerInstitutionIdentifier.

public void validateVendorIdAndCustomerInstitutionIdentifier() {
    BusinessObjectService bos = SpringContext.getBean(BusinessObjectService.class);
    Map<String, String> fieldValues = new HashMap<String, String>();
    fieldValues.put("vendorAddressGeneratedIdentifier", customerInstitutionNumber);
    String[] headerDetails = payeeId.split("-");
    fieldValues.put("vendorHeaderGeneratedIdentifier", headerDetails[0]);
    fieldValues.put("vendorDetailAssignedIdentifier", headerDetails[1]);
    List<VendorAddress> addrs = (List<VendorAddress>) bos.findMatching(VendorAddress.class, fieldValues);
    if (addrs.size() == 1) {
        VendorAddress addr = (VendorAddress) addrs.get(0);
        setVendorAddress(addr);
    } else {
        throw new RuntimeException("Invalid Address [ " + customerInstitutionNumber + " ] for payee [ " + payeeId + " ]");
    // Need to handle bad data.
    }
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) List(java.util.List) VendorAddress(org.kuali.kfs.vnd.businessobject.VendorAddress) 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