• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java RoutingReportCriteria类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.kuali.rice.kew.api.action.RoutingReportCriteria的典型用法代码示例。如果您正苦于以下问题:Java RoutingReportCriteria类的具体用法?Java RoutingReportCriteria怎么用?Java RoutingReportCriteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

RoutingReportCriteria类属于org.kuali.rice.kew.api.action包,在下文中一共展示了RoutingReportCriteria类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: populateRouteLogFutureRequests

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
/**
   * executes a simulation of the future routing, and sets the futureRootRequests and futureActionRequestCount
   * properties on the provided RouteLogForm.
   * 
   * @param rlForm the RouteLogForm --used in a write-only fashion.
   * @param document the DocumentRouteHeaderValue for the document whose future routing is being simulated.
   * @throws Exception
   */
  public void populateRouteLogFutureRequests(RouteLogForm rlForm, DocumentRouteHeaderValue document) throws Exception {

      RoutingReportCriteria reportCriteria = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId()).build();
      String applicationId = document.getDocumentType().getApplicationId();

      // gather the IDs for action requests that predate the simulation
Set<String> preexistingActionRequestIds = getActionRequestIds(document);
      
// run the simulation
      DocumentDetail documentDetail = KewApiServiceLocator.getWorkflowDocumentActionsService(applicationId).executeSimulation(reportCriteria);

      // fabricate our ActionRequestValueS from the results
      List<ActionRequestValue> futureActionRequests = 
      	reconstituteActionRequestValues(documentDetail, preexistingActionRequestIds);

      Collections.sort(futureActionRequests, ROUTE_LOG_ACTION_REQUEST_SORTER);
      
      futureActionRequests = switchActionRequestPositionsIfPrimaryDelegatesPresent(futureActionRequests);
      
      int pendingActionRequestCount = 0;
      for (ActionRequestValue actionRequest: futureActionRequests) {
          if (actionRequest.isPending()) {
              pendingActionRequestCount++;

              if (ActionRequestStatus.INITIALIZED.getCode().equals(actionRequest.getStatus())) {
                  actionRequest.setDisplayStatus("PENDING");
              } else if (ActionRequestStatus.ACTIVATED.getCode().equals(actionRequest.getStatus())) {
                  actionRequest.setDisplayStatus("IN ACTION LIST");
              }
          }
      }

      rlForm.setFutureRootRequests(futureActionRequests);
      rlForm.setFutureActionRequestCount(pendingActionRequestCount);
  }
 

开发者ID:kuali,
项目名称:kc-rice,
代码行数:44,
代码来源:RouteLogAction.java

示例2: executeSimulation

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
@Override
public DocumentDetail executeSimulation(RoutingReportCriteria reportCriteria) {
    incomingParamCheck(reportCriteria, "reportCriteria");
    if ( LOG.isDebugEnabled() ) {
    	LOG.debug("Executing routing report [docId=" + reportCriteria.getDocumentId() + ", docTypeName=" + reportCriteria.getDocumentTypeName() + "]");
    }
    SimulationCriteria criteria = SimulationCriteria.from(reportCriteria);

    return DTOConverter.convertDocumentDetailNew(KEWServiceLocator.getRoutingReportService().report(criteria));
}
 

开发者ID:kuali,
项目名称:kc-rice,
代码行数:11,
代码来源:WorkflowDocumentActionsServiceImpl.java

示例3: buildCriteria

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
@Override
public RoutingReportCriteria buildCriteria(WorkflowDocument workflowDoc) throws Exception {
    RoutingReportCriteria.Builder criteria = RoutingReportCriteria.Builder.createByDocumentTypeName(
            workflowDoc.getDocumentTypeName());
    criteria.setXmlContent(workflowDoc.getDocumentContent().getApplicationContent());
    return criteria.build();
}
 

开发者ID:kuali,
项目名称:kc-rice,
代码行数:8,
代码来源:WorkflowUtilityTest.java

示例4: testRoutingReportOnDocumentType

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
@Test public void testRoutingReportOnDocumentType() throws Exception {
      RoutingReportCriteria.Builder criteria = RoutingReportCriteria.Builder.createByDocumentTypeName("SeqDocType");
  	criteria.setRuleTemplateNames(Collections.singletonList("WorkflowDocumentTemplate"));
      WorkflowDocumentActionsService wdas = KewApiServiceLocator.getWorkflowDocumentActionsService();
  	DocumentDetail documentDetail = wdas.executeSimulation(criteria.build());
  	assertNotNull(documentDetail);
  	assertEquals("Should have been 2 requests generated.", 2, documentDetail.getActionRequests().size());

  	// let's try doing both WorkflowDocumentTemplate and WorkflowDocumentTemplate2 together
  	criteria.setRuleTemplateNames(Arrays.asList(new String[] {"WorkflowDocumentTemplate", "WorkflowDocument2Template"}));
  	documentDetail = wdas.executeSimulation(criteria.build());
  	assertEquals("Should have been 3 requests generated.", 3, documentDetail.getActionRequests().size());

  	boolean foundRkirkend = false;
  	boolean foundBmcgough = false;
  	boolean foundPmckown = false;
  	for (ActionRequest actionRequest : documentDetail.getActionRequests()) {
	String netId = getPrincipalNameForId(actionRequest.getPrincipalId());
	if (netId.equals("rkirkend")) {
		foundRkirkend = true;
		assertEquals(SeqSetup.WORKFLOW_DOCUMENT_NODE, actionRequest.getNodeName());
	} else if (netId.equals("bmcgough")) {
		foundBmcgough = true;
		assertEquals(SeqSetup.WORKFLOW_DOCUMENT_NODE, actionRequest.getNodeName());
	} else if (netId.equals("pmckown")) {
		foundPmckown = true;
		assertEquals(SeqSetup.WORKFLOW_DOCUMENT_2_NODE, actionRequest.getNodeName());
	}
}
  	assertTrue("Did not find request for rkirkend", foundRkirkend);
  	assertTrue("Did not find request for bmcgough", foundBmcgough);
  	assertTrue("Did not find request for pmckown", foundPmckown);

  }
 

开发者ID:kuali,
项目名称:kc-rice,
代码行数:35,
代码来源:WorkflowUtilityTest.java

示例5: testRoutingReportOnDocumentId

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
@Test public void testRoutingReportOnDocumentId() throws Exception {
    WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), "SeqDocType");

    WorkflowDocumentActionsService wdas = KewApiServiceLocator.getWorkflowDocumentActionsService();
    RoutingReportCriteria.Builder criteria = RoutingReportCriteria.Builder.createByDocumentId(doc.getDocumentId());
    criteria.setRuleTemplateNames(Collections.singletonList("WorkflowDocumentTemplate"));
    DocumentDetail documentDetail = wdas.executeSimulation(criteria.build());
    assertNotNull(documentDetail);
    assertEquals("Document id returned should be the same as the one passed in", doc.getDocumentId(),
            documentDetail.getDocument().getDocumentId());
    assertEquals("Wrong number of action requests generated", 2, documentDetail.getActionRequests().size());

    // let's try doing both WorkflowDocumentTemplate and WorkflowDocumentTemplate2 together
    criteria.setRuleTemplateNames(Arrays.asList(new String[] { "WorkflowDocumentTemplate", "WorkflowDocument2Template" }));
    documentDetail = wdas.executeSimulation(criteria.build());
    assertEquals("Should have been 3 requests generated.", 3, documentDetail.getActionRequests().size());

    boolean foundRkirkend = false;
    boolean foundBmcgough = false;
    boolean foundPmckown = false;
    for (ActionRequest actionRequest : documentDetail.getActionRequests()) {
        String netId = getPrincipalNameForId(actionRequest.getPrincipalId());
        if (netId.equals("rkirkend")) {
            foundRkirkend = true;
            assertEquals(SeqSetup.WORKFLOW_DOCUMENT_NODE, actionRequest.getNodeName());
        } else if (netId.equals("bmcgough")) {
            foundBmcgough = true;
            assertEquals(SeqSetup.WORKFLOW_DOCUMENT_NODE, actionRequest.getNodeName());
        } else if (netId.equals("pmckown")) {
            foundPmckown = true;
            assertEquals(SeqSetup.WORKFLOW_DOCUMENT_2_NODE, actionRequest.getNodeName());
        }
    }
    assertTrue("Did not find request for rkirkend", foundRkirkend);
    assertTrue("Did not find request for bmcgough", foundBmcgough);
    assertTrue("Did not find request for pmckown", foundPmckown);

}
 

开发者ID:kuali,
项目名称:kc-rice,
代码行数:39,
代码来源:WorkflowUtilityTest.java

示例6: doRouteLevelChange

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
/**
 * @see org.kuali.rice.kns.document.DocumentBase#handleRouteLevelChange(org.kuali.rice.kew.clientapp.vo.DocumentRouteLevelChangeDTO)
 */
@Override
public void doRouteLevelChange(DocumentRouteLevelChange change) {
    LOG.debug("handleRouteLevelChange() started");
    super.doRouteLevelChange(change);
    try {
        String newNodeName = change.getNewNodeName();
        if (StringUtils.isNotBlank(newNodeName)) {
            RoutingReportCriteria.Builder reportCriteria = RoutingReportCriteria.Builder
                    .createByDocumentIdAndTargetNodeName(getDocumentNumber(), newNodeName);
            List<String> desiredActions = new ArrayList<String>(2);
            desiredActions.add(ActionRequestType.APPROVE.getCode());
            desiredActions.add(ActionRequestType.COMPLETE.getCode());
            String note = "";
            if (newNodeName.equalsIgnoreCase(PurapWorkflowConstants.BUDGET_NODE)
                    || newNodeName.equalsIgnoreCase(PurapWorkflowConstants.FYI_BUDGET)) {
                if (newNodeName.equalsIgnoreCase(PurapWorkflowConstants.BUDGET_NODE)) {
                    note = OLEConstants.SufficientFundCheck.REQ_NOTE;
                }
                if (newNodeName.equalsIgnoreCase(PurapWorkflowConstants.FYI_BUDGET)) {
                    note = OLEConstants.SufficientFundCheck.FYI_NOTE;
                }
                DocumentService documentService = SpringContext.getBean(DocumentService.class);
                Note apoNote = documentService.createNoteFromDocument(this, note);
                this.addNote(apoNote);
                documentService.saveDocumentNotes(this);

            }
        }
    } catch (Exception e) {
        String errorMsg = "Workflow Error found checking actions requests on document with id "
                + getDocumentNumber() + ". *** WILL NOT UPDATE PURAP STATUS ***";
        LOG.error(errorMsg, e);
    }
}
 

开发者ID:VU-libtech,
项目名称:OLE-INST,
代码行数:38,
代码来源:OleRequisitionDocument.java

示例7: doRouteLevelChange

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.document.DocumentBase#doRouteLevelChange(org.kuali.rice.kew.framework.postprocessor.DocumentRouteLevelChange)
 */
@Override
public void doRouteLevelChange(DocumentRouteLevelChange levelChangeEvent) {

    super.doRouteLevelChange(levelChangeEvent);
    try {
        String newNodeName = levelChangeEvent.getNewNodeName();
        List<String> desiredActions = new ArrayList<String>(2);
        RoutingReportCriteria.Builder reportCriteria = RoutingReportCriteria.Builder
                .createByDocumentIdAndTargetNodeName(getDocumentNumber(), newNodeName);
        desiredActions.add(ActionRequestType.APPROVE.getCode());
        desiredActions.add(ActionRequestType.COMPLETE.getCode());
        if (KewApiServiceLocator.getWorkflowDocumentActionsService().documentWillHaveAtLeastOneActionRequest(
                reportCriteria.build(), desiredActions, false)) {
            if (StringUtils.isNotBlank(newNodeName)) {
                if (StringUtils.isNotBlank(newNodeName)) {
                    if (newNodeName.equalsIgnoreCase(PurapWorkflowConstants.BUDGET_NODE)
                            || newNodeName.equalsIgnoreCase(PurapWorkflowConstants.FYI_BUDGET)) {
                        String note = OLEConstants.SufficientFundCheck.PREQ_NOTE;
                        DocumentService documentService = SpringContext.getBean(DocumentService.class);
                        Note apoNote = documentService.createNoteFromDocument(this, note);
                        this.addNote(apoNote);
                        documentService.saveDocumentNotes(this);
                    }
                }
            }
        }
    } catch (Exception e) {
        String errorMsg = "Workflow Error found checking actions requests on document with id "
                + getDocumentNumber() + ". *** WILL NOT UPDATE PURAP STATUS ***";
        LOG.error(errorMsg, e);
    }
}
 

开发者ID:VU-libtech,
项目名称:OLE-INST,
代码行数:36,
代码来源:OlePaymentRequestDocument.java

示例8: addPurchaseOrderNote

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
public void addPurchaseOrderNote(DocumentRouteLevelChange levelChangeEvent) {

        String newNodeName = levelChangeEvent.getNewNodeName();
        RoutingReportCriteria.Builder reportCriteria = RoutingReportCriteria.Builder
                .createByDocumentIdAndTargetNodeName(getDocumentNumber(), newNodeName);
        if (newNodeName != null
                && (newNodeName.equalsIgnoreCase(PurapWorkflowConstants.BUDGET_NODE) || newNodeName
                .equalsIgnoreCase(PurapWorkflowConstants.FYI_BUDGET))) {
            String note = "";
            if(newNodeName.equalsIgnoreCase(PurapWorkflowConstants.BUDGET_NODE)){
                 note = OLEConstants.SufficientFundCheck.POA_NOTE;
            }
            if(newNodeName.equalsIgnoreCase(PurapWorkflowConstants.FYI_BUDGET)){
                note = OLEConstants.SufficientFundCheck.FYI_NOTE;
            }
            DocumentService documentService = SpringContext.getBean(DocumentService.class);
            Note apoNote = documentService.createNoteFromDocument(this, note);
            this.addNote(apoNote);
            String documentTypeName = this.getDocumentHeader().getWorkflowDocument().getDocumentTypeName();
            if (documentTypeName != null
                    && documentTypeName.equals(OLEConstants.FinancialDocumentTypeCodes.PURCHASE_ORDER_AMENDMENT)) {
                documentService.saveDocumentNotes(this);
            }

        }

    }
 

开发者ID:VU-libtech,
项目名称:OLE-INST,
代码行数:28,
代码来源:OlePurchaseOrderAmendmentDocument.java

示例9: doRouteLevelChange

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.document.DocumentBase#doRouteLevelChange(org.kuali.rice.kew.framework.postprocessor.DocumentRouteLevelChange)
 */
@Override
public void doRouteLevelChange(DocumentRouteLevelChange levelChangeEvent) {

    super.doRouteLevelChange(levelChangeEvent);
    try {
        String newNodeName = levelChangeEvent.getNewNodeName();
        List<String> desiredActions = new ArrayList<String>(2);
        RoutingReportCriteria.Builder reportCriteria = RoutingReportCriteria.Builder
                .createByDocumentIdAndTargetNodeName(getDocumentNumber(), newNodeName);
        desiredActions.add(ActionRequestType.APPROVE.getCode());
        desiredActions.add(ActionRequestType.FYI.getCode());
        desiredActions.add(ActionRequestType.COMPLETE.getCode());
        if (KewApiServiceLocator.getWorkflowDocumentActionsService().documentWillHaveAtLeastOneActionRequest(
                reportCriteria.build(), desiredActions, false)) {
            if (StringUtils.isNotBlank(newNodeName)) {
                if (StringUtils.isNotBlank(newNodeName)) {
                    if (newNodeName.equalsIgnoreCase(PurapWorkflowConstants.BUDGET_NODE)
                            || newNodeName.equalsIgnoreCase(PurapWorkflowConstants.FYI_BUDGET)) {
                        String note = "";
                        if (newNodeName.equalsIgnoreCase(PurapWorkflowConstants.BUDGET_NODE)) {
                            note = OLEConstants.SufficientFundCheck.INV_NOTE;
                        }
                        if (newNodeName.equalsIgnoreCase(PurapWorkflowConstants.FYI_BUDGET)) {
                            note = OLEConstants.SufficientFundCheck.FYI_NOTE;
                        }
                        DocumentService documentService = SpringContext.getBean(DocumentService.class);
                        Note apoNote = documentService.createNoteFromDocument(this, note);
                        this.addNote(apoNote);
                        documentService.saveDocumentNotes(this);
                    }
                }
            }
        }
    } catch (Exception e) {
        String errorMsg = "Workflow Error found checking actions requests on document with id "
                + getDocumentNumber() + ". *** WILL NOT UPDATE PURAP STATUS ***";
        LOG.error(errorMsg, e);
    }
}
 

开发者ID:VU-libtech,
项目名称:OLE-INST,
代码行数:43,
代码来源:OleInvoiceDocument.java

示例10: from

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
public static SimulationCriteria from(RoutingReportCriteria criteriaVO) {
    if (criteriaVO == null) {
        return null;
    }
    SimulationCriteria criteria = new SimulationCriteria();
    criteria.setDestinationNodeName(criteriaVO.getTargetNodeName());
    criteria.setDocumentId(criteriaVO.getDocumentId());
    criteria.setDocumentTypeName(criteriaVO.getDocumentTypeName());
    criteria.setXmlContent(criteriaVO.getXmlContent());
    criteria.setActivateRequests(criteriaVO.isActivateRequests());
    criteria.setFlattenNodes(criteriaVO.isFlattenNodes());
    if (criteriaVO.getRoutingPrincipalId() != null) {
        Principal kPrinc = KEWServiceLocator.getIdentityHelperService().
                getPrincipal(criteriaVO.getRoutingPrincipalId());
        Person user = KimApiServiceLocator.getPersonService().getPerson(kPrinc.getPrincipalId());
        if (user == null) {
            throw new RiceRuntimeException(
                    "Could not locate user for the given id: " + criteriaVO.getRoutingPrincipalId());
        }
        criteria.setRoutingUser(user);
    }
    if (criteriaVO.getRuleTemplateNames() != null) {
        criteria.setRuleTemplateNames(criteriaVO.getRuleTemplateNames());
    }
    if (criteriaVO.getNodeNames() != null) {
        criteria.setNodeNames(criteriaVO.getNodeNames());
    }
    if (criteriaVO.getTargetPrincipalIds() != null) {
        for (String targetPrincipalId : criteriaVO.getTargetPrincipalIds()) {
            Principal principal = KEWServiceLocator.getIdentityHelperService().getPrincipal(targetPrincipalId);
            criteria.getDestinationRecipients().add(new KimPrincipalRecipient(principal));
        }
    }

    if (criteriaVO.getActionsToTake() != null) {
        for (RoutingReportActionToTake actionToTake : criteriaVO.getActionsToTake()) {
            criteria.getActionsToTake().add(SimulationActionToTake.from(actionToTake));
        }
    }

    return criteria;
}
 

开发者ID:kuali,
项目名称:kc-rice,
代码行数:43,
代码来源:SimulationCriteria.java

示例11: documentWillHaveAtLeastOneActionRequest

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
@Override
 public boolean documentWillHaveAtLeastOneActionRequest(RoutingReportCriteria reportCriteria, List<String> actionRequestedCodes, boolean ignoreCurrentActionRequests) {
     incomingParamCheck(reportCriteria, "reportCriteria");
     incomingParamCheck(actionRequestedCodes, "actionRequestedCodes");
     try {
      SimulationWorkflowEngine simulationEngine = KEWServiceLocator.getSimulationEngine();
      SimulationCriteria criteria = SimulationCriteria.from(reportCriteria);
      // set activate requests to true by default so force action works correctly
      criteria.setActivateRequests(Boolean.TRUE);
      SimulationResults results = simulationEngine.runSimulation(criteria);
         List<ActionRequestValue> actionRequestsToProcess = results.getSimulatedActionRequests();
         if (!ignoreCurrentActionRequests) {
             actionRequestsToProcess.addAll(results.getDocument().getActionRequests());
         }
         for (ActionRequestValue actionRequest : actionRequestsToProcess) {
             if (actionRequest.isDone()) {
                 // an action taken has eliminated this request from being active
                 continue;
             }
	// if no action request codes are passed in.... assume any request found is
   	if (CollectionUtils.isEmpty(actionRequestedCodes) ) {
   		// we found an action request
   		return true;
   	}
   	// check the action requested codes passed in
   	for (String requestedActionRequestCode : actionRequestedCodes) {
		if (requestedActionRequestCode.equals(actionRequest.getActionRequested())) {
		    boolean satisfiesDestinationUserCriteria = (criteria.getDestinationRecipients().isEmpty()) || (isRecipientRoutedRequest(actionRequest,criteria.getDestinationRecipients()));
		    if (satisfiesDestinationUserCriteria) {
		        if (StringUtils.isBlank(criteria.getDestinationNodeName())) {
		            return true;
		        } else if (StringUtils.equals(criteria.getDestinationNodeName(),actionRequest.getNodeInstance().getName())) {
		            return true;
		        }
		    }
		}
	}
}
      return false;
     } catch (Exception ex) {
     	String error = "Problems evaluating documentWillHaveAtLeastOneActionRequest: " + ex.getMessage();
         LOG.error(error,ex);
         if (ex instanceof RuntimeException) {
         	throw (RuntimeException)ex;
         }
         throw new RuntimeException(error, ex);
     }
 }
 

开发者ID:kuali,
项目名称:kc-rice,
代码行数:49,
代码来源:WorkflowDocumentActionsServiceImpl.java

示例12: routeNodeHasApproverActionRequest

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
/**
     * Really this method needs to be implemented using the executeSimulation functionality (the SimulationEngine).
     * This would get rid of the needs for us to call to FlexRM directly.
     */
    private boolean routeNodeHasApproverActionRequest(DocumentType documentType, String docContent, RouteNode node, Integer routeLevel) {
        incomingParamCheck(documentType, "documentType");
        incomingParamCheck(docContent, "docContent");
        incomingParamCheck(node, "node");
        incomingParamCheck(routeLevel, "routeLevel");

/*        DocumentRouteHeaderValue routeHeader = new DocumentRouteHeaderValue();
        routeHeader.setDocumentId("");
        routeHeader.setDocumentTypeId(documentType.getDocumentTypeId());
        routeHeader.setDocRouteLevel(routeLevel);
        routeHeader.setDocVersion(new Integer(KewApiConstants.DocumentContentVersions.CURRENT));*/

        RoutingReportCriteria.Builder builder = RoutingReportCriteria.Builder.createByDocumentTypeName(documentType.getName());
        builder.setNodeNames(Collections.singletonList(node.getName()));
        builder.setXmlContent(docContent);
        DocumentDetail docDetail = executeSimulation(builder.build());
        if (docDetail != null) {
            for (ActionRequest actionRequest : docDetail.getActionRequests()) {
                if (actionRequest.isApprovalRequest()) {
                    return true;
                }
            }
        }
        /*if (node.getRuleTemplate() != null && node.isFlexRM()) {
            String ruleTemplateName = node.getRuleTemplate().getName();
            builder.setXmlContent(docContent);
            routeHeader.setDocRouteStatus(KewApiConstants.ROUTE_HEADER_INITIATED_CD);
            FlexRM flexRM = new FlexRM();
    		RouteContext context = RouteContext.getCurrentRouteContext();
    		context.setDocument(routeHeader);
    		try {
    			List actionRequests = flexRM.getActionRequests(routeHeader, node, null, ruleTemplateName);
    			for (Iterator iter = actionRequests.iterator(); iter.hasNext();) {
    				ActionRequestValue actionRequest = (ActionRequestValue) iter.next();
    				if (actionRequest.isApproveOrCompleteRequest()) {
    					return true;
    				}
    			}
    		} finally {
    			RouteContext.clearCurrentRouteContext();
    		}
        }*/
        return false;
    }
 

开发者ID:kuali,
项目名称:kc-rice,
代码行数:49,
代码来源:WorkflowDocumentActionsServiceImpl.java

示例13: testFutureRequestsWithRoutingAndWorkflowInfoActionRequestCheck

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
/**
 * Tests future requests operation
 *
 * @throws Exception
 */
@Test
public void testFutureRequestsWithRoutingAndWorkflowInfoActionRequestCheck() throws Exception {
    this.loadXmlFile(this.getClass(), "FutureRequestsConfig.xml");

    String user1PrincipalId = getPrincipalIdForName("user1");
    String user2PrincipalId = getPrincipalIdForName("user2");

    WorkflowDocument document = WorkflowDocumentFactory.createDocument(user1PrincipalId, "FutureRequestsDoc");
    document.route("");

    // Node1
    //user1 should have approval requested
    document = WorkflowDocumentFactory.loadDocument(user1PrincipalId, document.getDocumentId());
    WorkflowDocumentActionsService actionService = KewApiServiceLocator.getWorkflowDocumentActionsService();
    RoutingReportCriteria.Builder reportCriteria = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
    reportCriteria.setTargetPrincipalIds(Collections.singletonList(user1PrincipalId));
    String actionToTakeNode = "Node1";
    reportCriteria.setActionsToTake(Collections.singletonList(RoutingReportActionToTake.Builder.create(
            KewApiConstants.ACTION_TAKEN_APPROVED_CD, user1PrincipalId, actionToTakeNode)));
    assertTrue("User " + user1PrincipalId + " should have approval requests on the document",
            actionService.documentWillHaveAtLeastOneActionRequest(reportCriteria.build(),
                    Collections.singletonList(KewApiConstants.ACTION_REQUEST_APPROVE_REQ), false));

    reportCriteria = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
    reportCriteria.setTargetPrincipalIds(Collections.singletonList(user1PrincipalId));
    actionToTakeNode = "Node1";
    reportCriteria.setActionsToTake(Collections.singletonList(RoutingReportActionToTake.Builder.create(KewApiConstants.ACTION_TAKEN_APPROVED_CD, user1PrincipalId, actionToTakeNode)));
    DocumentDetail documentVO = KewApiServiceLocator.getWorkflowDocumentActionsService().executeSimulation(reportCriteria.build());
    assertTrue("User " + user1PrincipalId + " should have one or more approval requests on the document", documentVO.getActionRequests().size() > 0);

    reportCriteria = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
    String delyeaPrincipalId = getPrincipalIdForName("delyea");
    reportCriteria.setTargetPrincipalIds(Collections.singletonList(user1PrincipalId));
    actionToTakeNode = "Node1";
    reportCriteria.setActionsToTake(Collections.singletonList(RoutingReportActionToTake.Builder.create(KewApiConstants.ACTION_TAKEN_APPROVED_CD, user1PrincipalId, actionToTakeNode)));
    documentVO = actionService.executeSimulation(reportCriteria.build());
    assertTrue("User " + delyeaPrincipalId + " should not have any requests on the document but executeSimulation() method should return all action requests anyway", documentVO.getActionRequests().size() > 0);

    document = WorkflowDocumentFactory.createDocument(user1PrincipalId, "FutureRequestsDoc");
    document.setDoNotReceiveFutureRequests();
    document.route("");

    document = WorkflowDocumentFactory.loadDocument(user1PrincipalId, document.getDocumentId());
    assertFalse(document.isApprovalRequested());

    // user1 should not have approval requested
    reportCriteria = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
    reportCriteria.setTargetPrincipalIds(Collections.singletonList(user1PrincipalId));
    assertFalse("User " + user1PrincipalId + " should not have any approval request on the document", actionService.documentWillHaveAtLeastOneActionRequest(reportCriteria.build(), Collections.singletonList(KewApiConstants.ACTION_REQUEST_APPROVE_REQ), false));

    // user2 should have approval requested
    reportCriteria = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
    reportCriteria.setTargetPrincipalIds(Collections.singletonList(user2PrincipalId));
    assertTrue("User " + user2PrincipalId + " should have any approval request on the document", actionService.documentWillHaveAtLeastOneActionRequest(reportCriteria.build(), Collections.singletonList(KewApiConstants.ACTION_REQUEST_APPROVE_REQ), false));

}
 

开发者ID:kuali,
项目名称:kc-rice,
代码行数:62,
代码来源:FutureRequestsTest.java

示例14: runDocumentWillHaveApproveOrCompleteRequestAtNode

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
private void runDocumentWillHaveApproveOrCompleteRequestAtNode(String documentType,ReportCriteriaGenerator generator) throws Exception {
      /*
        name="WorkflowDocument"
          -  bmcgough - Approve - false
          -  rkirkend - Approve - false
        name="WorkflowDocument2"
          -  pmckown - Approve - false
        name="Acknowledge1"
          -  temay - Ack - false
        name="Acknowledge2"
          -  jhopf - Ack - false
      */
        WorkflowDocumentActionsService wdas = KewApiServiceLocator.getWorkflowDocumentActionsService();

        WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), documentType);
        RoutingReportCriteria.Builder builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
        builder.setXmlContent(document.getDocumentContent().getApplicationContent());
        builder.setTargetNodeName("WorkflowDocument2");
        builder.setRoutingPrincipalId(getPrincipalIdForName("bmcgough"));
        assertTrue("Document should have one unfulfilled approve/complete request", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));
        builder.setTargetPrincipalIds(Collections.singletonList(getPrincipalIdForName("bmcgough")));
        assertFalse("Document should not have any unfulfilled approve/complete requests", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));

        builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
        builder.setXmlContent(document.getDocumentContent().getApplicationContent());
        builder.setTargetNodeName("WorkflowDocument2");
        builder.setRoutingPrincipalId(getPrincipalIdForName("bmcgough"));
        List<RoutingReportActionToTake.Builder> actionsToTake = new ArrayList<RoutingReportActionToTake.Builder>();
//        actionsToTake[0] = new ReportActionToTakeDTO(KewApiConstants.ACTION_TAKEN_APPROVED_CD,getPrincipalIdForName("rkirkend"),"WorkflowDocument");
        actionsToTake.add(RoutingReportActionToTake.Builder.create(KewApiConstants.ACTION_TAKEN_APPROVED_CD,getPrincipalIdForName("pmckown"),"WorkflowDocument2"));
        builder.setActionsToTake(actionsToTake);
        assertFalse("Document should not have any unfulfilled approve/complete requests", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));

        builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
        builder.setXmlContent(document.getDocumentContent().getApplicationContent());
        builder.setTargetNodeName("WorkflowDocument2");
        actionsToTake = new ArrayList<RoutingReportActionToTake.Builder>();
        actionsToTake.add(RoutingReportActionToTake.Builder.create(KewApiConstants.ACTION_TAKEN_APPROVED_CD,getPrincipalIdForName("bmcgough"),"WorkflowDocument"));
        actionsToTake.add(RoutingReportActionToTake.Builder.create(KewApiConstants.ACTION_TAKEN_APPROVED_CD,getPrincipalIdForName("rkirkend"),"WorkflowDocument"));
        builder.setActionsToTake(actionsToTake);
        builder.setRoutingPrincipalId(getPrincipalIdForName("pmckown"));
        assertFalse("Document should not have any unfulfilled approve/complete requests", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));

        document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), documentType);
        document.route("");
        assertTrue(document.isEnroute());

        document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
        document.approve("");

        document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
        document.approve("");

        builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
        builder.setXmlContent(document.getDocumentContent().getApplicationContent());
        builder.setTargetNodeName("WorkflowDocument2");
        assertTrue("Document should have one unfulfilled approve/complete request", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));

        document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("pmckown"), document.getDocumentId());
        document.approve("");
        assertTrue(document.isProcessed());

        builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
        builder.setXmlContent(document.getDocumentContent().getApplicationContent());
        builder.setTargetNodeName("Acknowledge1");
        assertFalse("Document should not have any unfulfilled approve/complete requests when in processed status", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));

        builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
        builder.setXmlContent(document.getDocumentContent().getApplicationContent());
        builder.setTargetNodeName("Acknowledge1");
        assertTrue("Document should have one unfulfilled Ack request when in final status", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ}), false));
        if (generator.isCriteriaRouteHeaderBased()) {
            assertFalse("Document should have no unfulfilled Ack request generated when in final status", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ}), true));
        }

        // if temay acknowledges the document here it will move to processed and no more simulations would need to be tested
        document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("temay"), document.getDocumentId());
        document.acknowledge("");
        assertTrue(document.isProcessed());
    }
 

开发者ID:kuali,
项目名称:kc-rice,
代码行数:81,
代码来源:WorkflowUtilityTest.java

示例15: populateRouteLogFutureRequests

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
/**
   * executes a simulation of the future routing, and sets the futureRootRequests and futureActionRequestCount
   * properties on the provided RouteLogForm.
   * 
   * @param rlForm the RouteLogForm --used in a write-only fashion.
   * @param document the DocumentRouteHeaderValue for the document whose future routing is being simulated.
   * @throws Exception
   */
  public void populateRouteLogFutureRequests(RouteLogForm rlForm, DocumentRouteHeaderValue document) throws Exception {

      RoutingReportCriteria reportCriteria = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId()).build();
      String applicationId = document.getDocumentType().getApplicationId();

      // gather the IDs for action requests that predate the simulation
Set<String> preexistingActionRequestIds = getActionRequestIds(document);
      
// run the simulation
      DocumentDetail documentDetail = KewApiServiceLocator.getWorkflowDocumentActionsService(applicationId).executeSimulation(reportCriteria);

      // fabricate our ActionRequestValueS from the results
      List<ActionRequestValue> futureActionRequests =
      	reconstituteActionRequestValues(documentDetail, preexistingActionRequestIds);

      Collections.sort(futureActionRequests, ROUTE_LOG_ACTION_REQUEST_SORTER);

      List<ActionRequestValue> futureActionRequestsForDisplay = new ArrayList<ActionRequestValue>();

      for (ActionRequestValue actionRequestValue : futureActionRequests) {
          futureActionRequestsForDisplay.add(actionRequestValue.deepCopy(new HashMap<Object, Object>()));
      }

      futureActionRequestsForDisplay =
              switchActionRequestPositionsIfPrimaryDelegatesPresent(futureActionRequestsForDisplay);

      int pendingActionRequestCount = 0;
      for (ActionRequestValue actionRequest: futureActionRequestsForDisplay) {
          if (actionRequest.isPending()) {
              pendingActionRequestCount++;

              if (ActionRequestStatus.INITIALIZED.getCode().equals(actionRequest.getStatus())) {
                  actionRequest.setDisplayStatus("PENDING");
              } else if (ActionRequestStatus.ACTIVATED.getCode().equals(actionRequest.getStatus())) {
                  actionRequest.setDisplayStatus("IN ACTION LIST");
              }
          }
      }

      rlForm.setFutureRootRequests(futureActionRequestsForDisplay);
      rlForm.setFutureActionRequestCount(pendingActionRequestCount);
  }
 

开发者ID:kuali,
项目名称:rice,
代码行数:51,
代码来源:RouteLogAction.java

示例16: buildCriteria

点赞 2

import org.kuali.rice.kew.api.action.RoutingReportCriteria; //导入依赖的package包/类
public RoutingReportCriteria buildCriteria(WorkflowDocument workflowDoc) throws Exception {
    RoutingReportCriteria.Builder criteria = RoutingReportCriteria.Builder.createByDocumentTypeName(
            workflowDoc.getDocumentTypeName());
    criteria.setXmlContent(workflowDoc.getDocumentContent().getApplicationContent());
    return criteria.build();
}
 

开发者ID:aapotts,
项目名称:kuali_rice,
代码行数:7,
代码来源:WorkflowUtilityTest.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)