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;
}
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;
}
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 + " ]");
}
}
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.
}
}
Aggregations