use of org.kuali.kfs.coa.businessobject.ObjectType in project cu-kfs by CU-CommunityApps.
the class ScrubberValidatorImpl method validateObjectType.
/**
* Assuming that the object code has been validated first, validates the object type of the entry
*
* @param originEntry the origin entry being scrubbed
* @param workingEntry the scrubbed version of the origin entry
* @return a Message if an error was encountered, otherwise null
* @see org.kuali.module.gl.service.ScrubberValidator#validateObjectType(org.kuali.module.gl.bo.OriginEntryFull,
* org.kuali.module.gl.bo.OriginEntryFull)
*/
protected Message validateObjectType(OriginEntryInformation originEntry, OriginEntryInformation workingEntry, AccountingCycleCachingService accountingCycleCachingService) {
LOG.debug("validateObjectType() started");
// grab bypass origin codes from parameters
Set<String> objectTypeBypassOriginationCodes = new HashSet<String>(parameterService.getParameterValuesAsString(ScrubberStep.class, GeneralLedgerConstants.GlScrubberGroupRules.OBJECT_TYPE_BYPASS_ORIGINATIONS));
// for incoming transaction based on the object code - want to do this before validation checks
if ((!objectTypeBypassOriginationCodes.contains(originEntry.getFinancialSystemOriginationCode())) || (!StringUtils.hasText(originEntry.getFinancialObjectTypeCode()))) {
ObjectCode workingEntryFinancialObject = accountingCycleCachingService.getObjectCode(workingEntry.getUniversityFiscalYear(), workingEntry.getChartOfAccountsCode(), workingEntry.getFinancialObjectCode());
workingEntry.setFinancialObjectTypeCode(workingEntryFinancialObject.getFinancialObjectTypeCode());
} else {
workingEntry.setFinancialObjectTypeCode(originEntry.getFinancialObjectTypeCode());
}
ObjectType workingEntryObjectType = accountingCycleCachingService.getObjectType(workingEntry.getFinancialObjectTypeCode());
if (workingEntryObjectType == null) {
return MessageBuilder.buildMessage(KFSKeyConstants.ERROR_OBJECT_TYPE_NOT_FOUND, originEntry.getFinancialObjectTypeCode(), Message.TYPE_FATAL);
}
if (!workingEntryObjectType.isActive()) {
return MessageBuilder.buildMessage(KFSKeyConstants.ERROR_OBJECT_TYPE_NOT_ACTIVE, originEntry.getFinancialObjectTypeCode(), Message.TYPE_FATAL);
}
return null;
}
use of org.kuali.kfs.coa.businessobject.ObjectType in project cu-kfs by CU-CommunityApps.
the class ScrubberValidatorImpl method validateReferenceDocumentFields.
/**
* If the encumbrance update code = R, ref doc number must exist, ref doc type must be valid and ref origin code must be valid.
* If encumbrance update code is not R, and ref doc number is empty, make sure ref doc number, ref doc type and ref origin code
* are null. If encumbrance update code is not R and the ref doc number has a value, ref doc type must be valid and ref origin
* code must be valid.
*
* @param originEntry the origin entry to check
* @param workingEntryInfo the copy of the entry to move valid data into
* @return a Message if an error was encountered, otherwise null
*/
protected List<Message> validateReferenceDocumentFields(OriginEntryInformation originEntry, OriginEntryInformation workingEntry, AccountingCycleCachingService accountingCycleCachingService) {
LOG.debug("validateReferenceDocument() started");
// 3148 of cobol
List<Message> errors = new ArrayList();
boolean numberNullIndicator = !StringUtils.hasText(originEntry.getReferenceFinancialDocumentNumber());
boolean typeCodeNullIndicator = !StringUtils.hasText(originEntry.getReferenceFinancialDocumentTypeCode());
boolean originCodeNullIndicator = !StringUtils.hasText(originEntry.getReferenceFinancialSystemOriginationCode());
// TODO:- do we need this?
boolean editReference = true;
if (numberNullIndicator) {
workingEntry.setReferenceFinancialDocumentNumber(null);
workingEntry.setReferenceFinancialDocumentTypeCode(null);
workingEntry.setReferenceFinancialSystemOriginationCode(null);
if (KFSConstants.ENCUMB_UPDT_REFERENCE_DOCUMENT_CD.equals(originEntry.getTransactionEncumbranceUpdateCode())) {
errors.add(MessageBuilder.buildMessage(KFSKeyConstants.ERROR_REF_DOC_NOT_BE_SPACE, Message.TYPE_FATAL));
}
} else {
workingEntry.setReferenceFinancialDocumentNumber(originEntry.getReferenceFinancialDocumentNumber());
if (!typeCodeNullIndicator) {
if (accountingCycleCachingService.isCurrentActiveAccountingDocumentType(originEntry.getReferenceFinancialDocumentTypeCode())) {
workingEntry.setReferenceFinancialDocumentTypeCode(originEntry.getReferenceFinancialDocumentTypeCode());
} else {
errors.add(MessageBuilder.buildMessage(KFSKeyConstants.ERROR_REFERENCE_DOCUMENT_TYPE_NOT_FOUND, originEntry.getReferenceFinancialDocumentTypeCode(), Message.TYPE_FATAL));
}
} else {
errors.add(MessageBuilder.buildMessage(KFSKeyConstants.ERROR_REFERENCE_FIELDS, " " + KFSPropertyConstants.REFERENCE_FIN_DOCUMENT_TYPE_CODE + " is missing.", Message.TYPE_FATAL));
}
if (!originCodeNullIndicator) {
// Validate reference origin code
OriginationCode oc = accountingCycleCachingService.getOriginationCode(originEntry.getFinancialSystemOriginationCode());
if (oc != null) {
workingEntry.setReferenceFinancialSystemOriginationCode(originEntry.getReferenceFinancialSystemOriginationCode());
} else {
errors.add(MessageBuilder.buildMessage(KFSKeyConstants.ERROR_REFERENCE_ORIGINATION_CODE_NOT_FOUND, " (" + originEntry.getReferenceFinancialSystemOriginationCode() + ")", Message.TYPE_FATAL));
}
} else {
errors.add(MessageBuilder.buildMessage(KFSKeyConstants.ERROR_REFERENCE_FIELDS, " " + KFSPropertyConstants.REFERENCE_FINANCIAL_SYSTEM_ORIGINATION_CODE + " is missing.", Message.TYPE_FATAL));
}
}
BalanceType workingEntryBalanceType = accountingCycleCachingService.getBalanceType(workingEntry.getFinancialBalanceTypeCode());
ObjectType workingEntryObjectType = accountingCycleCachingService.getObjectType(workingEntry.getFinancialObjectTypeCode());
if (workingEntryBalanceType == null || workingEntryObjectType == null) {
// It would be nice if we could still validate the entry, but we can't.
return errors;
}
if (workingEntryBalanceType.isFinBalanceTypeEncumIndicator() && !workingEntryObjectType.isFundBalanceIndicator()) {
if (// KFSMI-5565 : Allow blank/null for encumbrance update code, since it is the same as "N" during processing and should not be an error
org.apache.commons.lang.StringUtils.isBlank(originEntry.getTransactionEncumbranceUpdateCode()) || KFSConstants.ENCUMB_UPDT_DOCUMENT_CD.equals(originEntry.getTransactionEncumbranceUpdateCode()) || KFSConstants.ENCUMB_UPDT_NO_ENCUMBRANCE_CD.equals(originEntry.getTransactionEncumbranceUpdateCode()) || KFSConstants.ENCUMB_UPDT_REFERENCE_DOCUMENT_CD.equals(originEntry.getTransactionEncumbranceUpdateCode())) {
workingEntry.setTransactionEncumbranceUpdateCode(originEntry.getTransactionEncumbranceUpdateCode());
} else {
errors.add(MessageBuilder.buildMessage(KFSKeyConstants.ERROR_ENC_UPDATE_CODE_NOT_DRN, " (" + originEntry.getTransactionEncumbranceUpdateCode() + ")", Message.TYPE_FATAL));
}
} else {
workingEntry.setTransactionEncumbranceUpdateCode(null);
}
return errors;
}
use of org.kuali.kfs.coa.businessobject.ObjectType in project cu-kfs by CU-CommunityApps.
the class AdvanceDepositServiceImpl method getObjectCodeType.
protected String getObjectCodeType(String chart, String objectCode) {
Map<String, String> keys = new HashMap<String, String>();
keys.put(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, chart);
keys.put(KFSPropertyConstants.FINANCIAL_OBJECT_CODE, objectCode);
ObjectCode objectCodeInfo = businessObjectService.findByPrimaryKey(ObjectCode.class, keys);
objectCodeInfo.refreshReferenceObject(KFSPropertyConstants.FINANCIAL_OBJECT_TYPE);
ObjectType objectType = objectCodeInfo.getFinancialObjectType();
String objectTypeCode = objectType.getBasicAccountingCategoryCode();
return objectTypeCode;
}
use of org.kuali.kfs.coa.businessobject.ObjectType in project cu-kfs by CU-CommunityApps.
the class ContractsGrantsInvoiceCreateDocumentServiceImpl method retrieveExpenseObjectTypes.
/**
* Retrieve expense object types by the basic accounting category for expenses
*/
@Override
public Collection<String> retrieveExpenseObjectTypes() {
List<String> objectTypeCodes = new ArrayList<>();
Map<String, Object> fieldValues = new HashMap<>();
fieldValues.put(KFSPropertyConstants.BASIC_ACCOUNTING_CATEGORY_CODE, KFSConstants.BasicAccountingCategoryCodes.EXPENSES);
final Collection<ObjectType> objectTypes = getBusinessObjectService().findMatching(ObjectType.class, fieldValues);
for (ObjectType objectType : objectTypes) {
objectTypeCodes.add(objectType.getCode());
}
return objectTypeCodes;
}
Aggregations