Search in sources :

Example 1 with DocumentType

use of org.kuali.kfs.kew.doctype.bo.DocumentType 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 2 with DocumentType

use of org.kuali.kfs.kew.doctype.bo.DocumentType in project cu-kfs by CU-CommunityApps.

the class AutoCancelBatchDaoJdbc method canAutoCancelDocType.

private boolean canAutoCancelDocType(String docTypeId) {
    DocumentType docType = docTypes.get(docTypeId);
    if (ObjectUtils.isNull(docType)) {
        docType = KEWServiceLocator.getDocumentTypeService().getDocumentTypeById(docTypeId);
        docTypes.put(docTypeId, docType);
    }
    if (cancelDocumentTypes.isEmpty()) {
        cancelDocumentTypes = parameterService.getParameterValuesAsString(AutoCancelBatchStep.class, CUKFSParameterKeyConstants.AUTO_CANCEL_DOC_TYPES_PARAMETER);
    }
    return cancelDocumentTypes.contains(docType.getName());
}
Also used : AutoCancelBatchStep(edu.cornell.kfs.sys.batch.AutoCancelBatchStep) DocumentType(org.kuali.kfs.kew.doctype.bo.DocumentType)

Example 3 with DocumentType

use of org.kuali.kfs.kew.doctype.bo.DocumentType in project cu-kfs by CU-CommunityApps.

the class CuAutoDisapproveDocumentsServiceImpl method checkIfParentDocumentTypeParameterExists.

protected boolean checkIfParentDocumentTypeParameterExists() {
    // check to make sure the system parameter for Parent Document Type = FP has been setup...
    if (!getParameterService().parameterExists(AutoDisapproveDocumentsStep.class, KFSParameterKeyConstants.YearEndAutoDisapprovalConstants.YEAR_END_AUTO_DISAPPROVE_PARENT_DOCUMENT_TYPE)) {
        LOG.warn("YEAR_END_AUTO_DISAPPROVE_PARENT_DOCUMENT_TYPE System parameter does not exist in the " + "parameters list.  The job can not continue without this parameter");
        getAutoDisapproveErrorReportWriterService().writeFormattedMessageLine("YEAR_END_AUTO_DISAPPROVE_PARENT_DOCUMENT_TYPE System parameter does not exist in the " + "parameters list.  The job can not continue without this parameter");
        return false;
    }
    List<DocumentType> parentDocumentTypes = this.getYearEndAutoDisapproveParentDocumentTypes();
    for (DocumentType parentDocumentType : parentDocumentTypes) {
        if (ObjectUtils.isNull(documentTypeService.getDocumentTypeByName(parentDocumentType.getName()))) {
            LOG.warn("Invalid Document Type: The value for System Parameter YEAR_END_AUTO_DISAPPROVE_PARENT_DOCUMENT_TYPE " + "is invalid. The auto disapproval job cannot use this value.");
            getAutoDisapproveErrorReportWriterService().writeFormattedMessageLine("Invalid Document Type: The value for System Parameter YEAR_END_AUTO_DISAPPROVE_PARENT_DOCUMENT_TYPE " + "is invalid. The auto disapproval job cannot use this value.");
        }
    }
    return true;
}
Also used : DocumentType(org.kuali.kfs.kew.doctype.bo.DocumentType) AutoDisapproveDocumentsStep(org.kuali.kfs.sys.batch.AutoDisapproveDocumentsStep)

Example 4 with DocumentType

use of org.kuali.kfs.kew.doctype.bo.DocumentType in project cu-kfs by CU-CommunityApps.

the class CuAutoDisapproveDocumentsServiceImpl method checkIfDocumentEligibleForAutoDispproval.

/**
 * @see org.kuali.kfs.sys.batch.service.impl.AutoDisapproveDocumentsServiceImpl#checkIfDocumentEligibleForAutoDispproval(org.kuali.kfs.krad.bo.DocumentHeader)
 */
@Override
protected boolean checkIfDocumentEligibleForAutoDispproval(DocumentHeader documentHeader) {
    boolean documentEligible = false;
    List<DocumentType> parentDocumentTypes = this.getYearEndAutoDisapproveParentDocumentTypes();
    String documentTypeName = documentHeader.getWorkflowDocument().getDocumentTypeName();
    DocumentType childDocumentType = documentTypeService.getDocumentTypeByName(documentTypeName);
    for (DocumentType parentDocumentType : parentDocumentTypes) {
        documentEligible = childDocumentType.getParentId().equals(parentDocumentType.getId());
        if (documentEligible) {
            break;
        }
    }
    return documentEligible;
}
Also used : DocumentType(org.kuali.kfs.kew.doctype.bo.DocumentType)

Example 5 with DocumentType

use of org.kuali.kfs.kew.doctype.bo.DocumentType in project cu-kfs by CU-CommunityApps.

the class AbstractRelatedView method getUrl.

public String getUrl() {
    String documentTypeName = this.getDocumentTypeName();
    DocumentType docType = KEWServiceLocator.getDocumentTypeService().getDocumentTypeByName(documentTypeName);
    String docHandlerUrl = docType.getResolvedDocumentHandlerUrl();
    int endSubString = docHandlerUrl.lastIndexOf("/");
    String serverName = docHandlerUrl.substring(0, endSubString);
    String handler = docHandlerUrl.substring(endSubString + 1, docHandlerUrl.lastIndexOf("?"));
    return serverName + "/" + handler + "?channelTitle=" + docType.getName() + "&" + KRADConstants.DISPATCH_REQUEST_PARAMETER + "=" + KRADConstants.DOC_HANDLER_METHOD + "&" + KRADConstants.PARAMETER_DOC_ID + "=" + this.getDocumentNumber() + "&" + KRADConstants.PARAMETER_COMMAND + "=" + KewApiConstants.DOCSEARCH_COMMAND;
}
Also used : DocumentType(org.kuali.kfs.kew.doctype.bo.DocumentType)

Aggregations

DocumentType (org.kuali.kfs.kew.doctype.bo.DocumentType)18 ArrayList (java.util.ArrayList)3 RouteNodeInstance (org.kuali.kfs.kew.engine.node.RouteNodeInstance)3 Timestamp (java.sql.Timestamp)2 Criteria (org.apache.ojb.broker.query.Criteria)2 QueryByCriteria (org.apache.ojb.broker.query.QueryByCriteria)2 RouteNode (org.kuali.kfs.kew.engine.node.RouteNode)2 AutoCancelBatchStep (edu.cornell.kfs.sys.batch.AutoCancelBatchStep)1 Collection (java.util.Collection)1 Iterator (java.util.Iterator)1 List (java.util.List)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 ProjectCode (org.kuali.kfs.coa.businessobject.ProjectCode)1 SubAccount (org.kuali.kfs.coa.businessobject.SubAccount)1 SubObjectCode (org.kuali.kfs.coa.businessobject.SubObjectCode)1 DocumentAttributeIndexingQueue (org.kuali.kfs.kew.api.document.attribute.DocumentAttributeIndexingQueue)1 WorkflowException (org.kuali.kfs.kew.api.exception.WorkflowException)1 DocumentAuthorizer (org.kuali.kfs.krad.document.DocumentAuthorizer)1