use of org.kuali.kfs.coa.businessobject.ProjectCode in project cu-kfs by CU-CommunityApps.
the class AwsAccountingXmlDocumentAccountingLineServiceImplTest method buildMockProjectCodeService.
private ProjectCodeService buildMockProjectCodeService() {
ProjectCodeService projectCodeService = mock(ProjectCodeService.class);
when(projectCodeService.getByPrimaryId(CuFPTestConstants.TEST_PROJECT_CODE_EB_PLGIFX)).thenReturn(null);
ProjectCode mockedProjectCode = createMockProjectCode(ProjectCodeFixture.PC_EB_PLGIFT);
when(projectCodeService.getByPrimaryId(CuFPTestConstants.TEST_PROJECT_CODE_EB_PLGIFT)).thenReturn(mockedProjectCode);
return projectCodeService;
}
use of org.kuali.kfs.coa.businessobject.ProjectCode 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;
}
use of org.kuali.kfs.coa.businessobject.ProjectCode in project cu-kfs by CU-CommunityApps.
the class AccountVerificationWebServiceImpl method isValidProjectCode.
public boolean isValidProjectCode(String projectCodeParm) throws Exception {
boolean isValidProjectCode = false;
ProjectCode projectCode = SpringContext.getBean(ProjectCodeService.class).getByPrimaryId(projectCodeParm);
if (projectCode == null || projectCode.toString().isEmpty() || (!projectCode.isActive())) {
isValidProjectCode = false;
} else {
isValidProjectCode = true;
}
return isValidProjectCode;
}
use of org.kuali.kfs.coa.businessobject.ProjectCode in project cu-kfs by CU-CommunityApps.
the class MockProjectCodeService method createProjectCode.
private ProjectCode createProjectCode(String projectCode) {
ProjectCode project = new ProjectCode();
project.setCode(projectCode);
return project;
}
use of org.kuali.kfs.coa.businessobject.ProjectCode in project cu-kfs by CU-CommunityApps.
the class MockProjectCodeService method getByPrimaryId.
@Override
public ProjectCode getByPrimaryId(String projectCode) {
ProjectCode project = null;
if (ConcurAccountValidationTestConstants.VALID_PROJECT_CODE.equalsIgnoreCase(projectCode)) {
project = createProjectCode(projectCode);
project.setActive(true);
}
if (ConcurAccountValidationTestConstants.INACTIVE_PROJECT_CODE.equalsIgnoreCase(projectCode)) {
project = createProjectCode(projectCode);
project.setActive(false);
}
return project;
}
Aggregations