Search in sources :

Example 1 with ObjectCodeService

use of org.kuali.kfs.coa.service.ObjectCodeService in project cu-kfs by CU-CommunityApps.

the class ProcurementCardCreateDocumentServiceImpl method validateTransaction.

@Override
protected String validateTransaction(ProcurementCardTransaction transaction) {
    String errorText = "";
    UniversityDateService uds = SpringContext.getBean(UniversityDateService.class);
    ObjectCodeService ocs = SpringContext.getBean(ObjectCodeService.class);
    ObjectCode objectCode = ocs.getByPrimaryIdWithCaching(uds.getCurrentFiscalYear(), transaction.getChartOfAccountsCode(), transaction.getFinancialObjectCode());
    if (ObjectUtils.isNull(objectCode)) {
        String tempErrorText = "Chart " + transaction.getChartOfAccountsCode() + " Object Code " + transaction.getFinancialObjectCode() + " is invalid; using default error Object Code.";
        if (LOG.isInfoEnabled()) {
            LOG.info(tempErrorText);
        }
        errorText += " " + tempErrorText;
        transaction.setFinancialObjectCode(getErrorObjectCode());
        transaction.refresh();
    }
    errorText += " " + super.validateTransaction(transaction);
    return errorText;
}
Also used : ObjectCodeService(org.kuali.kfs.coa.service.ObjectCodeService) ObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode) UniversityDateService(org.kuali.kfs.sys.service.UniversityDateService)

Example 2 with ObjectCodeService

use of org.kuali.kfs.coa.service.ObjectCodeService in project cu-kfs by CU-CommunityApps.

the class AwsAccountingXmlDocumentAccountingLineServiceImplTest method buildMockObjectCodeService.

private ObjectCodeService buildMockObjectCodeService() {
    ObjectCodeService objectCodeService = mock(ObjectCodeService.class);
    ObjectCode mockedObjectCode = createMockObjectCode(ObjectCodeFixture.OC_IT_6600);
    when(objectCodeService.getByPrimaryIdForCurrentYear(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_AWS_DEFAULT_OBJ_CODE)).thenReturn(mockedObjectCode);
    mockedObjectCode = createMockObjectCode(ObjectCodeFixture.OC_IT_4020);
    when(objectCodeService.getByPrimaryIdForCurrentYear(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_OBJ_CODE_4020)).thenReturn(mockedObjectCode);
    mockedObjectCode = createMockObjectCode(ObjectCodeFixture.OC_IT_1000);
    when(objectCodeService.getByPrimaryIdForCurrentYear(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_OBJ_CODE_1000)).thenReturn(mockedObjectCode);
    mockedObjectCode = createMockObjectCode(ObjectCodeFixture.OC_CS_6600);
    when(objectCodeService.getByPrimaryIdForCurrentYear(CuFPTestConstants.TEST_AWS_BILLING_CHART_CODE_CS, CuFPTestConstants.TEST_AWS_DEFAULT_OBJ_CODE)).thenReturn(mockedObjectCode);
    return objectCodeService;
}
Also used : SubObjectCodeService(org.kuali.kfs.coa.service.SubObjectCodeService) ObjectCodeService(org.kuali.kfs.coa.service.ObjectCodeService) ObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode) SubObjectCode(org.kuali.kfs.coa.businessobject.SubObjectCode)

Aggregations

ObjectCode (org.kuali.kfs.coa.businessobject.ObjectCode)2 ObjectCodeService (org.kuali.kfs.coa.service.ObjectCodeService)2 SubObjectCode (org.kuali.kfs.coa.businessobject.SubObjectCode)1 SubObjectCodeService (org.kuali.kfs.coa.service.SubObjectCodeService)1 UniversityDateService (org.kuali.kfs.sys.service.UniversityDateService)1