Search in sources :

Example 31 with ValidationResult

use of edu.cornell.kfs.concur.businessobjects.ValidationResult in project cu-kfs by CU-CommunityApps.

the class ConcurEventNotificationProcessingServiceImpl method validateReportAccountInfo.

private ValidationResult validateReportAccountInfo(ConcurReport concurReport) {
    ValidationResult reportValidationResult = new ValidationResult();
    LOG.info("validateReportAccountInfo()");
    if (concurReport.getAccountInfos() != null && concurReport.getAccountInfos().size() > 0) {
        for (ConcurAccountInfo concurAccountInfo : concurReport.getAccountInfos()) {
            LOG.info(concurAccountInfo.toString());
            if (concurAccountInfo.isForPersonalCorporateCardExpense()) {
                reportValidationResult.add(concurAccountValidationService.validateConcurAccountInfoObjectCodeNotRequired(concurAccountInfo));
            } else {
                reportValidationResult.add(concurAccountValidationService.validateConcurAccountInfo(concurAccountInfo));
            }
        }
    }
    LOG.info("Validation Result: " + reportValidationResult.isValid() + ", validation messages: " + reportValidationResult.getErrorMessagesAsOneFormattedString());
    return reportValidationResult;
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult) ConcurAccountInfo(edu.cornell.kfs.concur.businessobjects.ConcurAccountInfo)

Example 32 with ValidationResult

use of edu.cornell.kfs.concur.businessobjects.ValidationResult in project cu-kfs by CU-CommunityApps.

the class ConcurRequestExtractFileValidationServiceImpl method requestedCashAdvanceAccountingInformationIsValid.

private boolean requestedCashAdvanceAccountingInformationIsValid(ConcurRequestExtractRequestDetailFileLine detailFileLine) {
    ConcurAccountInfo concurAccountInfo = new ConcurAccountInfo(detailFileLine.getChart(), detailFileLine.getAccountNumber(), detailFileLine.getSubAccountNumber(), getConcurBatchUtilityService().getConcurParameterValue(ConcurParameterConstants.DEFAULT_TRAVEL_REQUEST_OBJECT_CODE), detailFileLine.getSubObjectCode(), detailFileLine.getProjectCode());
    ValidationResult validationResults = getConcurAccountValidationService().validateConcurAccountInfo(concurAccountInfo);
    if (validationResults.isNotValid()) {
        detailFileLine.getValidationResult().addMessages(validationResults.getMessages());
    }
    return validationResults.isValid();
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult) ConcurAccountInfo(edu.cornell.kfs.concur.businessobjects.ConcurAccountInfo)

Example 33 with ValidationResult

use of edu.cornell.kfs.concur.businessobjects.ValidationResult in project cu-kfs by CU-CommunityApps.

the class ConcurAccountValidationServiceImpl method checkProjectCode.

public ValidationResult checkProjectCode(String projectCodeParm) {
    ValidationResult validationResult = new ValidationResult();
    if (StringUtils.isNotBlank(projectCodeParm)) {
        ProjectCode projectCode = projectCodeService.getByPrimaryId(projectCodeParm);
        String projectCodeErrorMessageString = ConcurUtils.formatStringForErrorMessage(ConcurConstants.AccountingStringFieldNames.PROJECT_CODE, projectCodeParm);
        validationResult = checkMissingOrInactive(projectCode, MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_EXISTENCE), projectCodeErrorMessageString), MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_INACTIVE), projectCodeErrorMessageString));
    }
    return validationResult;
}
Also used : ProjectCode(org.kuali.kfs.coa.businessobject.ProjectCode) ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult)

Example 34 with ValidationResult

use of edu.cornell.kfs.concur.businessobjects.ValidationResult in project cu-kfs by CU-CommunityApps.

the class ConcurAccountValidationServiceImpl method checkSubObjectCode.

public ValidationResult checkSubObjectCode(String chartOfAccountsCode, String accountNumber, String objectCode, String subObjectCodeParm) {
    ValidationResult validationResult = new ValidationResult();
    if (StringUtils.isNotBlank(subObjectCodeParm)) {
        SubObjectCode subObjectCode = subObjectCodeService.getByPrimaryIdForCurrentYear(chartOfAccountsCode, accountNumber, objectCode, subObjectCodeParm);
        String subObjectCodeErrorMessageString = ConcurUtils.formatStringForErrorMessage(ConcurConstants.AccountingStringFieldNames.SUB_OBJECT_CODE, chartOfAccountsCode, accountNumber, objectCode, subObjectCodeParm);
        validationResult = checkMissingOrInactive(subObjectCode, MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_EXISTENCE), subObjectCodeErrorMessageString), MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_INACTIVE), subObjectCodeErrorMessageString));
    }
    return validationResult;
}
Also used : SubObjectCode(org.kuali.kfs.coa.businessobject.SubObjectCode) ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult)

Example 35 with ValidationResult

use of edu.cornell.kfs.concur.businessobjects.ValidationResult in project cu-kfs by CU-CommunityApps.

the class ConcurAccountValidationServiceImpl method checkValuesAreValid.

private ValidationResult checkValuesAreValid(String chartOfAccountsCode, String accountNumber, String subAccountNumber, String objectCode, String subObjectCode, String projectCode, boolean objectCodeRequired) {
    ValidationResult accountValidationResult = checkAccount(chartOfAccountsCode, accountNumber);
    if (accountValidationResult.isNotValid()) {
        return accountValidationResult;
    } else {
        ValidationResult validationResult = new ValidationResult();
        if (objectCodeRequired) {
            updateValidationResultAndAddErrorMessages(validationResult, checkObjectCode(chartOfAccountsCode, objectCode));
        }
        updateValidationResultAndAddErrorMessages(validationResult, checkSubAccount(chartOfAccountsCode, accountNumber, subAccountNumber));
        if (objectCodeRequired) {
            updateValidationResultAndAddErrorMessages(validationResult, checkSubObjectCode(chartOfAccountsCode, accountNumber, objectCode, subObjectCode));
        }
        updateValidationResultAndAddErrorMessages(validationResult, checkProjectCode(projectCode));
        return validationResult;
    }
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult)

Aggregations

ValidationResult (edu.cornell.kfs.concur.businessobjects.ValidationResult)52 Test (org.junit.Test)40 ConcurAccountInfo (edu.cornell.kfs.concur.businessobjects.ConcurAccountInfo)3 ConcurBatchReportLineValidationErrorItem (edu.cornell.kfs.concur.batch.report.ConcurBatchReportLineValidationErrorItem)2 ConcurReport (edu.cornell.kfs.concur.businessobjects.ConcurReport)1 ProjectCode (org.kuali.kfs.coa.businessobject.ProjectCode)1 SubAccount (org.kuali.kfs.coa.businessobject.SubAccount)1 SubObjectCode (org.kuali.kfs.coa.businessobject.SubObjectCode)1