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);
}
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);
}
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;
}
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;
}
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);
}
}
Aggregations