Search in sources :

Example 1 with SubObjectCode

use of org.kuali.kfs.coa.businessobject.SubObjectCode in project cu-kfs by CU-CommunityApps.

the class AwsAccountingXmlDocumentAccountingLineServiceImpl method validateSubObjectCode.

private boolean validateSubObjectCode(String chartCode, String accountNumber, String objectCode, String subObjectCode) {
    if (StringUtils.isBlank(subObjectCode)) {
        return true;
    }
    SubObjectCode subObject = subObjectCodeService.getByPrimaryIdForCurrentYear(chartCode, accountNumber, objectCode, subObjectCode);
    if (ObjectUtils.isNull(subObject)) {
        String errorMessage = configurationService.getPropertyValueAsString(CuFPKeyConstants.ERROR_SUB_OBJECT_NOT_FOUND);
        LOG.error(String.format(errorMessage, chartCode, accountNumber, objectCode, subObjectCode));
        return false;
    }
    if (!subObject.isActive()) {
        String errorMessage = configurationService.getPropertyValueAsString(CuFPKeyConstants.ERROR_SUB_OBJECT_INACTIVE);
        LOG.error(String.format(errorMessage, chartCode, accountNumber, objectCode, subObjectCode));
        return false;
    }
    return true;
}
Also used : SubObjectCode(org.kuali.kfs.coa.businessobject.SubObjectCode)

Example 2 with SubObjectCode

use of org.kuali.kfs.coa.businessobject.SubObjectCode in project cu-kfs by CU-CommunityApps.

the class AwsAccountingXmlDocumentAccountingLineServiceImplTest method buildMockSubObjectCodeService.

private SubObjectCodeService buildMockSubObjectCodeService() {
    SubObjectCodeService subObjectCodeService = mock(SubObjectCodeService.class);
    SubObjectCode mockedSubObjectCode = createMockSubObjectCode(SubObjectCodeFixture.SO_109);
    when(subObjectCodeService.getByPrimaryIdForCurrentYear(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_ACCOUNT_NUMBER_1023715, CuFPTestConstants.TEST_OBJ_CODE_4020, CuFPTestConstants.TEST_SUB_OBJ_CODE_109)).thenReturn(mockedSubObjectCode);
    when(subObjectCodeService.getByPrimaryIdForCurrentYear(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_ACCOUNT_NUMBER_1023715, CuFPTestConstants.TEST_OBJ_CODE_4020, CuFPTestConstants.TEST_SUB_OBJ_CODE_10X)).thenReturn(null);
    return subObjectCodeService;
}
Also used : SubObjectCodeService(org.kuali.kfs.coa.service.SubObjectCodeService) SubObjectCode(org.kuali.kfs.coa.businessobject.SubObjectCode)

Example 3 with SubObjectCode

use of org.kuali.kfs.coa.businessobject.SubObjectCode in project cu-kfs by CU-CommunityApps.

the class AwsAccountingXmlDocumentAccountingLineServiceImplTest method createMockSubObjectCode.

private static SubObjectCode createMockSubObjectCode(SubObjectCodeFixture subObjectCodeFixture) {
    SubObjectCode subObjectCode = mock(SubObjectCode.class);
    when(subObjectCode.isActive()).thenReturn(subObjectCodeFixture.active);
    return subObjectCode;
}
Also used : SubObjectCode(org.kuali.kfs.coa.businessobject.SubObjectCode)

Example 4 with SubObjectCode

use of org.kuali.kfs.coa.businessobject.SubObjectCode 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;
}
Also used : SubAccount(org.kuali.kfs.coa.businessobject.SubAccount) Account(org.kuali.kfs.coa.businessobject.Account) SubObjectCode(org.kuali.kfs.coa.businessobject.SubObjectCode) OriginationCode(org.kuali.kfs.sys.businessobject.OriginationCode) ArrayList(java.util.ArrayList) SubAccount(org.kuali.kfs.coa.businessobject.SubAccount) DocumentType(org.kuali.kfs.kew.doctype.bo.DocumentType) ProjectCode(org.kuali.kfs.coa.businessobject.ProjectCode) ObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode) SubObjectCode(org.kuali.kfs.coa.businessobject.SubObjectCode) Chart(org.kuali.kfs.coa.businessobject.Chart) AccountingLineOverride(org.kuali.kfs.sys.businessobject.AccountingLineOverride)

Example 5 with SubObjectCode

use of org.kuali.kfs.coa.businessobject.SubObjectCode in project cu-kfs by CU-CommunityApps.

the class AccountVerificationWebServiceImpl method isValidSubObjectCode.

public boolean isValidSubObjectCode(String chartOfAccountsCode, String accountNumber, String objectCode, String subObjectCodeParm) throws Exception {
    boolean isValidSubObjectCode = false;
    SubObjectCode subObjectCode = SpringContext.getBean(SubObjectCodeService.class).getByPrimaryIdForCurrentYear(chartOfAccountsCode, accountNumber, objectCode, subObjectCodeParm);
    if (subObjectCode == null || subObjectCode.toString().isEmpty() || (!subObjectCode.isActive())) {
        isValidSubObjectCode = false;
    } else {
        isValidSubObjectCode = true;
    }
    return isValidSubObjectCode;
}
Also used : SubObjectCodeService(org.kuali.kfs.coa.service.SubObjectCodeService) SubObjectCode(org.kuali.kfs.coa.businessobject.SubObjectCode)

Aggregations

SubObjectCode (org.kuali.kfs.coa.businessobject.SubObjectCode)11 ArrayList (java.util.ArrayList)2 ObjectCode (org.kuali.kfs.coa.businessobject.ObjectCode)2 SubObjectCodeService (org.kuali.kfs.coa.service.SubObjectCodeService)2 ValidationResult (edu.cornell.kfs.concur.businessobjects.ValidationResult)1 Account (org.kuali.kfs.coa.businessobject.Account)1 Chart (org.kuali.kfs.coa.businessobject.Chart)1 ProjectCode (org.kuali.kfs.coa.businessobject.ProjectCode)1 SubAccount (org.kuali.kfs.coa.businessobject.SubAccount)1 DocumentType (org.kuali.kfs.kew.doctype.bo.DocumentType)1 PersistableBusinessObject (org.kuali.kfs.krad.bo.PersistableBusinessObject)1 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)1 AccountingLineOverride (org.kuali.kfs.sys.businessobject.AccountingLineOverride)1 OriginationCode (org.kuali.kfs.sys.businessobject.OriginationCode)1