use of edu.cornell.kfs.coa.businessobject.MajorReportingCategory in project cu-kfs by CU-CommunityApps.
the class AccountExtensionRule method checkMajorReportingCategoryCode.
protected boolean checkMajorReportingCategoryCode(MaintenanceDocument document) {
boolean success = true;
String majorReportingCategoryCode = ((AccountExtendedAttribute) newAccount.getExtension()).getMajorReportingCategoryCode();
BusinessObjectService bos = SpringContext.getBean(BusinessObjectService.class);
// MajorReportingCategory code is not a required field, if no value is entered no validation is performed
if (!StringUtils.isBlank(majorReportingCategoryCode)) {
Map fieldValues = new HashMap();
fieldValues.put("majorReportingCategoryCode", majorReportingCategoryCode);
Collection<MajorReportingCategory> retVals = bos.findMatching(MajorReportingCategory.class, fieldValues);
if (retVals.isEmpty()) {
putFieldError("extension.majorReportingCategoryCode", CUKFSKeyConstants.ERROR_DOCUMENT_ACCMAINT_MJR_RPT_CAT_CODE_NOT_EXIST, new String[] { majorReportingCategoryCode });
success = false;
} else {
for (MajorReportingCategory sfp : retVals) {
if (!sfp.isActive()) {
putFieldError("extension.majorReportingCategoryCode", KFSKeyConstants.ERROR_INACTIVE, getFieldLabel(Account.class, "extension.majorReportingCategoryCode"));
success = false;
}
}
}
}
return success;
}
Aggregations