use of edu.cornell.kfs.coa.businessobject.ContractGrantReportingCode in project cu-kfs by CU-CommunityApps.
the class ObjectCodeGlobalExtensionRule method checkContractGrantReportingCode.
/*
* Verify value has been entered for required attribute cgReportingCode
*/
protected boolean checkContractGrantReportingCode(CUObjectCodeGlobal ocg) {
boolean success = true;
String cgReportingCode = ocg.getCgReportingCode();
for (GlobalBusinessObjectDetail ocgd : ocg.getAllDetailObjects()) {
String chartOfAccountsCode = ((ObjectCodeGlobalDetail) ocgd).getChartOfAccountsCode();
if ((!StringUtils.isBlank(cgReportingCode)) && (!StringUtils.isBlank(cgReportingCode))) {
// have values for both table primary keys
HashMap<String, String> fieldValues = new HashMap<String, String>();
fieldValues.put("chartOfAccountsCode", chartOfAccountsCode);
// prompt table has attribute defined as "code" and we need to use it for the lookup
fieldValues.put("code", cgReportingCode);
BusinessObjectService bos = SpringContext.getBean(BusinessObjectService.class);
Collection<ContractGrantReportingCode> retVals = bos.findMatching(ContractGrantReportingCode.class, fieldValues);
if (retVals.isEmpty()) {
putFieldError("cgReportingCode", CUKFSKeyConstants.ERROR_DOCUMENT_OBJCDMAINT_CG_RPT_CAT_CODE_NOT_EXIST, new String[] { chartOfAccountsCode, cgReportingCode });
success = false;
} else {
// verify the value to be assigned is active
for (ContractGrantReportingCode sfp : retVals) {
if (!sfp.isActive()) {
putFieldError("cgReportingCode", KFSKeyConstants.ERROR_INACTIVE, getFieldLabel(CUObjectCodeGlobal.class, "cgReportingCode"));
success = false;
}
}
}
}
// implied else coa or cgReportingCode or both are blank, caught by maintenance doc having these fields defined as "required", else coding to report this causes double error messages
}
return success;
}
use of edu.cornell.kfs.coa.businessobject.ContractGrantReportingCode in project cu-kfs by CU-CommunityApps.
the class ObjectCodeExtensionRule method checkContractGrantReportingCode.
/*
* Verify value has been entered for required attribute cgReportingCode
*/
protected boolean checkContractGrantReportingCode(ObjectCode objectCode) {
boolean success = true;
ObjectCodeExtendedAttribute extendedAttributes = (ObjectCodeExtendedAttribute) objectCode.getExtension();
String cgReportingCode = extendedAttributes.getCgReportingCode();
String chartOfAccountsCode = objectCode.getChartOfAccountsCode();
if ((!StringUtils.isBlank(cgReportingCode)) && (!StringUtils.isBlank(cgReportingCode))) {
// have values for both table primary keys
Map fieldValues = new HashMap();
fieldValues.put("chartOfAccountsCode", chartOfAccountsCode);
// prompt table has attribute defined as "code" and we need to use it for the lookup
fieldValues.put("code", cgReportingCode);
BusinessObjectService bos = SpringContext.getBean(BusinessObjectService.class);
Collection<ContractGrantReportingCode> retVals = bos.findMatching(ContractGrantReportingCode.class, fieldValues);
if (retVals.isEmpty()) {
putFieldError("extension.cgReportingCode", CUKFSKeyConstants.ERROR_DOCUMENT_OBJCDMAINT_CG_RPT_CAT_CODE_NOT_EXIST, new String[] { chartOfAccountsCode, cgReportingCode });
success = false;
} else {
// verify the value to be assigned is active
for (ContractGrantReportingCode sfp : retVals) {
if (!sfp.isActive()) {
putFieldError("extension.cgReportingCode", KFSKeyConstants.ERROR_INACTIVE, getFieldLabel(ObjectCode.class, "extension.cgReportingCode"));
success = false;
}
}
}
}
// implied else coa or cgReportingCode or both are blank, caught by maintenance doc having these fields defined as "required", else coding to report this causes double error messages
return success;
}
Aggregations