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;
}
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;
}
Aggregations