Search in sources :

Example 36 with ValidationResult

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

the class ConcurAccountValidationServiceImpl method checkMissingOrInactive.

private ValidationResult checkMissingOrInactive(Inactivatable inactivatableObject, String missingMessage, String inactiveMessage) {
    ValidationResult validationResult = new ValidationResult();
    if (inactivatableObject == null || inactivatableObject.toString().isEmpty()) {
        validationResult.setValid(false);
        validationResult.addMessage(missingMessage);
    } else if (!inactivatableObject.isActive()) {
        validationResult.setValid(false);
        validationResult.addMessage(inactiveMessage);
    }
    return validationResult;
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult)

Example 37 with ValidationResult

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

the class ConcurAccountValidationServiceImpl method checkRequiredAccountInfo.

public ValidationResult checkRequiredAccountInfo(String chartOfAccountsCode, String accountNumber, String objectCode, boolean objectCodeRequired) {
    ValidationResult validationResult = new ValidationResult();
    if (chartOfAccountsCode == null || chartOfAccountsCode.isEmpty()) {
        validationResult.setValid(false);
        validationResult.addMessage(MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_REQUIRED), ConcurConstants.AccountingStringFieldNames.CHART));
    }
    if (accountNumber == null || accountNumber.isEmpty()) {
        validationResult.setValid(false);
        validationResult.addMessage(MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_REQUIRED), ConcurConstants.AccountingStringFieldNames.ACCOUNT_NUMBER));
    }
    if (objectCodeRequired && (objectCode == null || objectCode.isEmpty())) {
        validationResult.setValid(false);
        validationResult.addMessage(MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_REQUIRED), ConcurConstants.AccountingStringFieldNames.OBJECT_CODE));
    }
    return validationResult;
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult)

Example 38 with ValidationResult

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

the class ConcurAccountValidationServiceTest method isAccountNull.

@Test
public void isAccountNull() {
    ValidationResult validationResult = concurAccountValidationService.checkAccount(ConcurAccountValidationTestConstants.VALID_CHART, null);
    String accountErrorMessageString = ConcurUtils.formatStringForErrorMessage(ConcurConstants.AccountingStringFieldNames.ACCOUNT_NUMBER, ConcurAccountValidationTestConstants.VALID_CHART, null);
    Assert.assertFalse("Validation was expected to fail but returned true", validationResult.isValid());
    Assert.assertEquals("Error message was expected for null account number", MessageFormat.format(concurAccountValidationService.getConfigurationService().getPropertyValueAsString(KFSKeyConstants.ERROR_EXISTENCE), accountErrorMessageString) + KFSConstants.NEWLINE, validationResult.getErrorMessagesAsOneFormattedString());
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult) Test(org.junit.Test)

Example 39 with ValidationResult

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

the class ConcurAccountValidationServiceTest method isSubAccountNull.

@Test
public void isSubAccountNull() {
    ValidationResult validationResult = concurAccountValidationService.checkSubAccount(ConcurAccountValidationTestConstants.VALID_CHART, ConcurAccountValidationTestConstants.VALID_ACCT_NBR, null);
    Assert.assertTrue("Validation was expected to pass", validationResult.isValid());
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult) Test(org.junit.Test)

Example 40 with ValidationResult

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

the class ConcurAccountValidationServiceTest method isAccountBad.

@Test
public void isAccountBad() {
    ValidationResult validationResult = concurAccountValidationService.checkAccount(ConcurAccountValidationTestConstants.VALID_CHART, ConcurAccountValidationTestConstants.BAD_ACCT_NBR);
    String accountErrorMessageString = ConcurUtils.formatStringForErrorMessage(ConcurConstants.AccountingStringFieldNames.ACCOUNT_NUMBER, ConcurAccountValidationTestConstants.VALID_CHART, ConcurAccountValidationTestConstants.BAD_ACCT_NBR);
    Assert.assertFalse("Validation was expected to fail but returned true", validationResult.isValid());
    Assert.assertEquals("Error message was expected for bad account number", MessageFormat.format(concurAccountValidationService.getConfigurationService().getPropertyValueAsString(KFSKeyConstants.ERROR_EXISTENCE), accountErrorMessageString) + KFSConstants.NEWLINE, validationResult.getErrorMessagesAsOneFormattedString());
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult) Test(org.junit.Test)

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