Search in sources :

Example 1 with ProjectCode

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;
}
Also used : ProjectCode(org.kuali.kfs.coa.businessobject.ProjectCode) ProjectCodeService(org.kuali.kfs.coa.service.ProjectCodeService)

Example 2 with ProjectCode

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;
}
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 3 with ProjectCode

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;
}
Also used : ProjectCode(org.kuali.kfs.coa.businessobject.ProjectCode) ProjectCodeService(org.kuali.kfs.coa.service.ProjectCodeService)

Example 4 with ProjectCode

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;
}
Also used : ProjectCode(org.kuali.kfs.coa.businessobject.ProjectCode)

Example 5 with ProjectCode

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;
}
Also used : ProjectCode(org.kuali.kfs.coa.businessobject.ProjectCode)

Aggregations

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