Search in sources :

Example 1 with DocumentType

use of org.kuali.rice.kew.api.doctype.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 = KewApiServiceLocator.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.rice.kew.api.doctype.DocumentType)

Example 2 with DocumentType

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

the class AbstractRelatedView method getUrl.

public String getUrl() {
    String documentTypeName = this.getDocumentTypeName();
    DocumentType docType = KewApiServiceLocator.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.rice.kew.api.doctype.DocumentType)

Example 3 with DocumentType

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

the class CuAutoDisapproveDocumentsServiceImpl method checkIfParentDocumentTypeParameterExists.

protected boolean checkIfParentDocumentTypeParameterExists() {
    boolean parameterExists = true;
    // 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(getDocumentTypeService().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 parameterExists;
}
Also used : DocumentType(org.kuali.rice.kew.api.doctype.DocumentType) AutoDisapproveDocumentsStep(org.kuali.kfs.sys.batch.AutoDisapproveDocumentsStep)

Example 4 with DocumentType

use of org.kuali.rice.kew.api.doctype.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.rice.krad.bo.DocumentHeader)
 */
@Override
protected boolean checkIfDocumentEligibleForAutoDispproval(DocumentHeader documentHeader) {
    boolean documentEligible = false;
    List<DocumentType> parentDocumentTypes = this.getYearEndAutoDisapproveParentDocumentTypes();
    String documentTypeName = documentHeader.getWorkflowDocument().getDocumentTypeName();
    DocumentType childDocumentType = getDocumentTypeService().getDocumentTypeByName(documentTypeName);
    for (DocumentType parentDocumentType : parentDocumentTypes) {
        documentEligible = childDocumentType.getParentId().equals(parentDocumentType.getId());
        if (documentEligible) {
            break;
        }
    }
    return documentEligible;
}
Also used : DocumentType(org.kuali.rice.kew.api.doctype.DocumentType)

Example 5 with DocumentType

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

the class CuAutoDisapproveDocumentsServiceImpl method getYearEndAutoDisapproveParentDocumentTypes.

/**
 * Gets the year end auto disapprove parent document types.
 * @return Returns the parentDocumentTypes.
 */
protected List<DocumentType> getYearEndAutoDisapproveParentDocumentTypes() {
    List<DocumentType> parentDocumentTypes = new ArrayList<DocumentType>();
    Collection<String> documentTypeCodes = getParameterService().getParameterValuesAsString(AutoDisapproveDocumentsStep.class, KFSParameterKeyConstants.YearEndAutoDisapprovalConstants.YEAR_END_AUTO_DISAPPROVE_PARENT_DOCUMENT_TYPE);
    for (String documentTypeCode : documentTypeCodes) {
        DocumentType parentDocumentType = (DocumentType) getDocumentTypeService().getDocumentTypeByName(documentTypeCode);
        if (ObjectUtils.isNotNull(parentDocumentType)) {
            parentDocumentTypes.add(parentDocumentType);
        }
    }
    return parentDocumentTypes;
}
Also used : ArrayList(java.util.ArrayList) DocumentType(org.kuali.rice.kew.api.doctype.DocumentType)

Aggregations

DocumentType (org.kuali.rice.kew.api.doctype.DocumentType)7 AutoCancelBatchStep (edu.cornell.kfs.sys.batch.AutoCancelBatchStep)1 Timestamp (java.sql.Timestamp)1 ArrayList (java.util.ArrayList)1 PaymentRequestDocument (org.kuali.kfs.module.purap.document.PaymentRequestDocument)1 PurapService (org.kuali.kfs.module.purap.document.service.PurapService)1 AutoDisapproveDocumentsStep (org.kuali.kfs.sys.batch.AutoDisapproveDocumentsStep)1 DocumentTypeService (org.kuali.rice.kew.api.doctype.DocumentTypeService)1 DocumentAttributeIndexingQueue (org.kuali.rice.kew.api.document.attribute.DocumentAttributeIndexingQueue)1 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)1