当前位置: 首页>>代码示例>>Java>>正文


Java WorkflowDocumentService.loadWorkflowDocument方法代码示例

本文整理汇总了Java中org.kuali.rice.krad.workflow.service.WorkflowDocumentService.loadWorkflowDocument方法的典型用法代码示例。如果您正苦于以下问题:Java WorkflowDocumentService.loadWorkflowDocument方法的具体用法?Java WorkflowDocumentService.loadWorkflowDocument怎么用?Java WorkflowDocumentService.loadWorkflowDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.krad.workflow.service.WorkflowDocumentService的用法示例。


在下文中一共展示了WorkflowDocumentService.loadWorkflowDocument方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: populateWorkflowStatusDate

import org.kuali.rice.krad.workflow.service.WorkflowDocumentService; //导入方法依赖的package包/类
/**
 * This method populates workflow status change date for a requisition item.
 *
 * @param item Requisition Item to populate workflow status date.
 * @return
 */
public void populateWorkflowStatusDate(OleRequisitionItem item) {
    LOG.debug("Inside populateWorkflowStatusDate of OleRequisitionItemLookupableHelperServiceImpl");
    Long documentNumber = Long.valueOf(item.getRequisition().getDocumentNumber());
    WorkflowDocumentService workflowDocumentService = SpringContext.getBean(WorkflowDocumentService.class);
    Person principalPerson = SpringContext.getBean(PersonService.class).getPerson(GlobalVariables.getUserSession().getPerson().getPrincipalId());
    WorkflowDocument workflowDocument;
    try {
        workflowDocument = workflowDocumentService.loadWorkflowDocument(item.getRequisition().getDocumentNumber(), principalPerson);
        item.setDateModified(convertTimestampToString(new Timestamp(workflowDocument
                .getApplicationDocumentStatusDate().getMillis())));
    } catch (WorkflowException ex) {
        GlobalVariables.getMessageMap().putError(OLEConstants.OrderQueue.REQUISITIONS, RiceKeyConstants.ERROR_CUSTOM, ex.getMessage());
    }
    LOG.debug("Leaving populateWorkflowStatusDate of OleRequisitionItemLookupableHelperServiceImpl");
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:22,代码来源:OleOrderQueueDocument.java

示例2: assign

import org.kuali.rice.krad.workflow.service.WorkflowDocumentService; //导入方法依赖的package包/类
/**
 * This method validates for selector and assigns selected requisitions to the selector.
 */
public void assign() {
    LOG.debug("Inside assign of OleOrderQueueDocument");
    if (selectedUserId == null || StringUtils.isEmpty(selectedUserId)) {
        Principal principalInfo = SpringContext.getBean(IdentityManagementService.class).getPrincipalByPrincipalName(GlobalVariables.getUserSession().getPerson().getPrincipalName());
        if (principalInfo != null) {
            selectedUserId = principalInfo.getPrincipalId();
        } else {
            GlobalVariables.getMessageMap().putError(OLEConstants.OrderQueue.REQUISITIONS, OLEKeyConstants.ERROR_ORDERQUEUE_INVALID_PRINCIPAL_NAME,
                    new String[]{});
            return;
        }
        RoleService roleService = SpringContext.getBean(RoleService.class);
        // Check if the Selector actually has the role of SELECTOR
        String roleId = roleService.getRoleIdByNamespaceCodeAndName(OLEConstants.OleRequisitionItem.ORDER_HOLD_QUEUE_ROLE_NAMESPACE, OLEConstants.OleRequisitionItem.ORDER_HOLD_QUEUE_ROLE);
        List<String> roleIds = new ArrayList<String>();
        roleIds.add(roleId);
        if (!roleService.principalHasRole(selectedUserId, roleIds, null)) {
            GlobalVariables.getMessageMap().putError(OLEConstants.OrderQueue.REQUISITIONS, OLEKeyConstants.ERROR_ORDERQUEUE_INVALID_SELECTOR, new String[]{principalName});
            return;
        }
    }

    Long documentNumber;
    WorkflowDocumentService workflowDocumentService = KRADServiceLocatorWeb.getWorkflowDocumentService();
    Person person = SpringContext.getBean(PersonService.class).getPerson(GlobalVariables.getUserSession().getPerson().getPrincipalId());
    WorkflowDocument workflowDocument;
    List<OleRequisitionItem> refreshItems = new ArrayList<OleRequisitionItem>();
    for (OleRequisitionItem item : requisitionItems) {
        boolean itemAdded = item.isItemAdded();
        if (itemAdded) {
            try {
                workflowDocument = workflowDocumentService.loadWorkflowDocument(item.getRequisition().getDocumentNumber(), person);

                // DocumentRouteHeaderValue routeHeader = SpringContext.getBean(RouteHeaderService.class).getRouteHeader(documentNumber);
                Person principalPerson = SpringContext.getBean(PersonService.class).getPerson(selectedUserId);
                if (workflowDocument.isSaved() || workflowDocument.isEnroute()) {
                    assignActionRequests(workflowDocument.getDocumentId().toString());
                    GlobalVariables.getMessageMap().putInfo(OLEConstants.OrderQueue.REQUISITIONS, OLEKeyConstants.MESSAGE_ORDERQUEUE_REQUISITIONS_ASSIGNED, new String[]{item.getRequisition().getDocumentNumber(), principalName});
                } else {
                    GlobalVariables.getMessageMap().putError(OLEConstants.OrderQueue.REQUISITIONS, OLEKeyConstants.ERROR_ORDERQUEUE_REQUISITIONS_ASSIGN, new String[]{workflowDocument.getStatus().toString(), item.getRequisition().getDocumentNumber()});
                    refreshItems.add(item);
                }
            } catch (WorkflowException ex) {
                GlobalVariables.getMessageMap().putError(OLEConstants.OrderQueue.REQUISITIONS, RiceKeyConstants.ERROR_CUSTOM, ex.getMessage());
                refreshItems.add(item);
            }

        } else {
            refreshItems.add(item);
        }
    }
    requisitionItems = refreshItems;
    LOG.debug("Leaving assign of OleOrderQueueDocument");
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:58,代码来源:OleOrderQueueDocument.java

示例3: delete

import org.kuali.rice.krad.workflow.service.WorkflowDocumentService; //导入方法依赖的package包/类
/**
 * This method invokes cancelDocument of DocumentService to delete selected requisitions.
 * Sets error message appriopriately if this action fails.
 */
public void delete() {
    LOG.debug("Inside delete of OleOrderQueueDocument");
    WorkflowDocumentService workflowDocumentService = SpringContext.getBean(WorkflowDocumentService.class);
    Person principalPerson = SpringContext.getBean(PersonService.class).getPerson(GlobalVariables.getUserSession().getPerson().getPrincipalId());
    WorkflowDocument workflowDocument;
    List<OleRequisitionItem> refreshItems = new ArrayList<OleRequisitionItem>();
    OleRequisitionDocument requisitionDocument;
    StringBuilder orderQueueRequisitionDeleted = new StringBuilder();
    boolean isErrorMsg = false;
    for (OleRequisitionItem item : requisitionItems) {
        boolean itemAdded = item.isItemAdded();
        if (itemAdded) {
            try {
                workflowDocument = workflowDocumentService.loadWorkflowDocument(item.getRequisition().getDocumentNumber(), principalPerson);
                if (workflowDocument.isSaved()) {
                    requisitionDocument = SpringContext.getBean(BusinessObjectService.class).findBySinglePrimaryKey(OleRequisitionDocument.class, Long.valueOf(item.getRequisition().getPurapDocumentIdentifier()));
                    requisitionDocument.setDocumentHeader(SpringContext.getBean(DocumentHeaderService.class).getDocumentHeaderById(item.getRequisition().getDocumentNumber()));

                    try {
                        requisitionDocument.getDocumentHeader().setWorkflowDocument(workflowDocument);
                        SpringContext.getBean(DocumentService.class).cancelDocument(requisitionDocument, OLEConstants.OrderQueue.CANCEL_ANNOTATION);
                        orderQueueRequisitionDeleted.append(item.getRequisition().getDocumentNumber()).append(",");
                        isErrorMsg = true;
                    } catch (WorkflowException wfe) {
                        GlobalVariables.getMessageMap().putError(OLEConstants.OrderQueue.REQUISITIONS, OLEKeyConstants.ERROR_ORDERQUEUE_REQUISITIONS_CANCELED_WFE, new String[]{requisitionDocument.getDocumentNumber(), wfe.getMessage()});
                        refreshItems.add(item);
                    }
                } else {
                    GlobalVariables.getMessageMap().putError(OLEConstants.OrderQueue.REQUISITIONS, OLEKeyConstants.ERROR_ORDERQUEUE_REQUISITIONS_CANCELED, new String[]{workflowDocument.getStatus().toString(), item.getRequisition().getDocumentNumber()});
                    refreshItems.add(item);
                }
            } catch (WorkflowException ex) {
                GlobalVariables.getMessageMap().putError(OLEConstants.OrderQueue.REQUISITIONS, RiceKeyConstants.ERROR_CUSTOM, ex.getMessage());
                refreshItems.add(item);
            }
        } else {
            refreshItems.add(item);
        }
    }

    int len = orderQueueRequisitionDeleted.lastIndexOf(",");
    if (isErrorMsg) {
        orderQueueRequisitionDeleted.replace(len, len + 1, " ");
        GlobalVariables.getMessageMap().putInfo(OLEConstants.OrderQueue.REQUISITIONS, OLEKeyConstants.MESSAGE_ORDERQUEUE_REQUISITIONS_CANCELED, new String[]{orderQueueRequisitionDeleted.toString()});
    }
    requisitionItems = refreshItems;
    LOG.debug("Leaving delete of OleOrderQueueDocument");
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:53,代码来源:OleOrderQueueDocument.java

示例4: cancelAccountsPayableDocumentByCheckingDocumentStatus

import org.kuali.rice.krad.workflow.service.WorkflowDocumentService; //导入方法依赖的package包/类
/**
 * @see org.kuali.ole.module.purap.document.service.AccountsPayableService#cancelAccountsPayableDocumentByCheckingDocumentStatus(org.kuali.ole.module.purap.document.AccountsPayableDocument, java.lang.String)
 */
@Override
public void cancelAccountsPayableDocumentByCheckingDocumentStatus(AccountsPayableDocument document, String noteText) throws Exception {
    DocumentService documentService = SpringContext.getBean(DocumentService.class);

    if (PurapConstants.CreditMemoStatuses.APPDOC_IN_PROCESS.equals(document.getApplicationDocumentStatus())) {
        //prior to submit, just call regular cancel logic
        documentService.cancelDocument(document, noteText);
    } else if (PurapConstants.CreditMemoStatuses.APPDOC_AWAITING_ACCOUNTS_PAYABLE_REVIEW.equals(document.getApplicationDocumentStatus())) {
        //while awaiting AP approval, just call regular disapprove logic as user will have action request
        documentService.disapproveDocument(document, noteText);
    } else if (document instanceof PaymentRequestDocument && PurapConstants.PaymentRequestStatuses.APPDOC_AWAITING_FISCAL_REVIEW.equals(document.getApplicationDocumentStatus()) && ((PaymentRequestDocument) document).isPaymentRequestedCancelIndicator()) {
        // special logic to disapprove PREQ as the fiscal officer
        DocumentActionParameters.Builder p = DocumentActionParameters.Builder.create(document.getDocumentNumber(), document.getLastActionPerformedByPersonId());
        p.setAnnotation("Document cancelled after requested cancel by " + GlobalVariables.getUserSession().getPrincipalName());
        KewApiServiceLocator.getWorkflowDocumentActionsService().disapprove(p.build());
    } else {
        UserSession originalUserSession = GlobalVariables.getUserSession();
        WorkflowDocument originalWorkflowDocument = document.getDocumentHeader().getWorkflowDocument();
        //any other time, perform special logic to cancel the document
        if (!document.getDocumentHeader().getWorkflowDocument().isApproved()) {
            try {
                // person canceling may not have an action requested on the document
                Person userRequestedCancel = SpringContext.getBean(PersonService.class).getPerson(document.getLastActionPerformedByPersonId());
                GlobalVariables.setUserSession(new UserSession(getOleSelectDocumentService().getSelectParameterValue(OLEConstants.SYSTEM_USER)));

                WorkflowDocumentService workflowDocumentService = SpringContext.getBean(WorkflowDocumentService.class);
                WorkflowDocument newWorkflowDocument = workflowDocumentService.loadWorkflowDocument(document.getDocumentNumber(), GlobalVariables.getUserSession().getPerson());
                document.getDocumentHeader().setWorkflowDocument(newWorkflowDocument);

                String annotation = "Document Cancelled by user " + originalUserSession.getPerson().getName() + " (" + originalUserSession.getPerson().getPrincipalName() + ")";
                if (ObjectUtils.isNotNull(userRequestedCancel)) {
                    annotation.concat(" per request of user " + userRequestedCancel.getName() + " (" + userRequestedCancel.getPrincipalName() + ")");
                }
                documentService.superUserDisapproveDocument(document, annotation);
            } finally {
                GlobalVariables.setUserSession(originalUserSession);
                document.getDocumentHeader().setWorkflowDocument(originalWorkflowDocument);
            }
        } else {
            // call gl method here (no reason for post processing since workflow done)
            SpringContext.getBean(AccountsPayableService.class).cancelAccountsPayableDocument(document, "");
            document.getDocumentHeader().getWorkflowDocument().logAnnotation("Document Cancelled by user " + originalUserSession.getPerson().getName() + " (" + originalUserSession.getPerson().getPrincipalName() + ")");
        }
    }

    Note noteObj = documentService.createNoteFromDocument(document, noteText);
    document.addNote(noteObj);
    SpringContext.getBean(NoteService.class).save(noteObj);
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:53,代码来源:AccountsPayableServiceImpl.java


注:本文中的org.kuali.rice.krad.workflow.service.WorkflowDocumentService.loadWorkflowDocument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。