use of org.kuali.kfs.coa.businessobject.ObjectCode 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.ObjectCode in project cu-kfs by CU-CommunityApps.
the class ScrubberValidatorImpl method validateObjectCode.
/**
* Validates the object code of the origin 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
*/
protected Message validateObjectCode(OriginEntryInformation originEntry, OriginEntryInformation workingEntry, AccountingCycleCachingService accountingCycleCachingService) {
LOG.debug("validateObjectCode() started");
if (!StringUtils.hasText(originEntry.getFinancialObjectCode())) {
return MessageBuilder.buildMessage(KFSKeyConstants.ERROR_OBJECT_CODE_EMPTY, Message.TYPE_FATAL);
}
// We're checking the object code based on the year & chart from the working entry.
workingEntry.setFinancialObjectCode(originEntry.getFinancialObjectCode());
// the fiscal year can be blank in originEntry, but we're assuming that the year attribute is populated by the validate year
// method
ObjectCode workingEntryFinancialObject = accountingCycleCachingService.getObjectCode(workingEntry.getUniversityFiscalYear(), workingEntry.getChartOfAccountsCode(), workingEntry.getFinancialObjectCode());
if (workingEntryFinancialObject == null) {
String objectCodeString = workingEntry.getUniversityFiscalYear() + "-" + workingEntry.getChartOfAccountsCode() + "-" + workingEntry.getFinancialObjectCode();
return MessageBuilder.buildMessage(KFSKeyConstants.ERROR_OBJECT_CODE_NOT_FOUND, objectCodeString, Message.TYPE_FATAL);
}
if (!workingEntryFinancialObject.isActive()) {
String objectCodeString = workingEntry.getUniversityFiscalYear() + "-" + workingEntry.getChartOfAccountsCode() + "-" + workingEntry.getFinancialObjectCode();
return MessageBuilder.buildMessage(KFSKeyConstants.ERROR_OBJECT_CODE_NOT_ACTIVE, objectCodeString, Message.TYPE_FATAL);
}
return null;
}
use of org.kuali.kfs.coa.businessobject.ObjectCode in project cu-kfs by CU-CommunityApps.
the class AccountingLineRuleHelperServiceImpl method getAccountingLineValidationErrors.
@Override
public List<AccountingLineValidationError> getAccountingLineValidationErrors(AccountingLine accountingLine, boolean useShortMessages) {
List<AccountingLineValidationError> validationErrors = new ArrayList<>();
// CORNELL FIX:
if (ObjectUtils.isNull(accountingLine)) {
return validationErrors;
}
// get the accounting line sequence string to identify which line has error.
String accountIdentifyingPropertyName = getAccountIdentifyingPropertyName(accountingLine);
// retrieve accounting line objects to validate
Chart chart = accountingLine.getChart();
Account account = accountingLine.getAccount();
ObjectCode objectCode = accountingLine.getObjectCode();
validationErrors.addAll(getChartValidationErrors(chart, KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, accountIdentifyingPropertyName, useShortMessages));
validationErrors.addAll(getAccountValidationErrors(account, KFSPropertyConstants.ACCOUNT_NUMBER, accountIdentifyingPropertyName, useShortMessages));
// sub account is not required
if (StringUtils.isNotBlank(accountingLine.getSubAccountNumber()) && !accountingLine.getSubAccountNumber().equals(KFSConstants.getDashSubAccountNumber())) {
SubAccount subAccount = accountingLine.getSubAccount();
validationErrors.addAll(getSubAccountValidationErrors(subAccount, KFSPropertyConstants.SUB_ACCOUNT_NUMBER, accountIdentifyingPropertyName, useShortMessages));
}
validationErrors.addAll(getObjectCodeValidationErrors(objectCode, KFSPropertyConstants.FINANCIAL_OBJECT_CODE, accountIdentifyingPropertyName, useShortMessages));
// sub object is not required
if (StringUtils.isNotBlank(accountingLine.getFinancialSubObjectCode())) {
SubObjectCode subObjectCode = accountingLine.getSubObjectCode();
validationErrors.addAll(getSubObjectCodeValidationErrors(subObjectCode, KFSPropertyConstants.FINANCIAL_SUB_OBJECT_CODE, accountIdentifyingPropertyName, useShortMessages));
}
// project code is not required
if (StringUtils.isNotBlank(accountingLine.getProjectCode())) {
ProjectCode projectCode = accountingLine.getProject();
validationErrors.addAll(getProjectCodeValidationErrors(projectCode, KFSConstants.PROJECT_CODE_PROPERTY_NAME, accountIdentifyingPropertyName, useShortMessages));
}
if (StringUtils.isNotBlank(accountingLine.getReferenceOriginCode())) {
OriginationCode referenceOrigin = accountingLine.getReferenceOrigin();
validationErrors.addAll(getReferenceOriginCodeValidationErrors(accountIdentifyingPropertyName, referenceOrigin, useShortMessages));
}
if (StringUtils.isNotBlank(accountingLine.getReferenceTypeCode())) {
DocumentType referenceType = accountingLine.getReferenceFinancialSystemDocumentType();
validationErrors.addAll(getReferenceTypeCodeValidationErrors(accountingLine.getReferenceTypeCode(), referenceType, accountIdentifyingPropertyName, useShortMessages));
}
return validationErrors;
}
use of org.kuali.kfs.coa.businessobject.ObjectCode in project cu-kfs by CU-CommunityApps.
the class AccountingLineRuleHelperServiceImpl method hasObjectBudgetRequiredOverrides.
public boolean hasObjectBudgetRequiredOverrides(AccountingLine line, String overrideCode) {
boolean retVal = true;
ObjectCode objectCode = line.getObjectCode();
AccountingLineOverride override = AccountingLineOverride.valueOf(overrideCode);
Account account = line.getAccount();
if (AccountingLineOverride.needsObjectBudgetOverride(account, objectCode) && !override.hasComponent(AccountingLineOverride.COMPONENT.NON_BUDGETED_OBJECT)) {
GlobalVariables.getMessageMap().putError(KFSPropertyConstants.FINANCIAL_OBJECT_CODE, KFSKeyConstants.ERROR_DOCUMENT_ACCOUNT_PRESENCE_NON_BUDGETED_OBJECT_CODE, account.getAccountNumber(), objectCode.getFinancialObjectCode());
retVal = false;
}
return retVal;
}
use of org.kuali.kfs.coa.businessobject.ObjectCode in project cu-kfs by CU-CommunityApps.
the class AccountVerificationWebServiceImpl method isValidObjectCode.
public boolean isValidObjectCode(String chartOfAccountsCode, String objectCodeParm) throws Exception {
boolean isValidObjectCode = false;
ObjectCode objectCode = SpringContext.getBean(ObjectCodeService.class).getByPrimaryIdForCurrentYear(chartOfAccountsCode, objectCodeParm);
if (objectCode == null || objectCode.toString().isEmpty() || (!objectCode.isActive())) {
isValidObjectCode = false;
} else {
isValidObjectCode = true;
}
return isValidObjectCode;
}
Aggregations