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


Java RouteContext.isSimulation方法代码示例

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


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

示例1: process

import org.kuali.rice.kew.engine.RouteContext; //导入方法依赖的package包/类
@Override
public SimpleResult process(RouteContext routeContext, RouteHelper routeHelper) throws Exception {
    DocumentRouteHeaderValue document = routeContext.getDocument();
    RouteNodeInstance nodeInstance = routeContext.getNodeInstance();
    if (routeContext.isSimulation()) {
        if (routeContext.getActivationContext().isActivateRequests()) {
            activateRequests(routeContext, document, nodeInstance);
        }
        return new SimpleResult(true);
    } else if (!activateRequests(routeContext, document, nodeInstance) && shouldTransition(document,
            nodeInstance)) {
        return new SimpleResult(true);
    } else {
        return new SimpleResult(false);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:RequestActivationNode.java

示例2: activateRequests

import org.kuali.rice.kew.engine.RouteContext; //导入方法依赖的package包/类
/**
 * Activates any pending requests and returns whether there are outstanding blocking requests
 * @param context the RouteContext
 * @throws org.kuali.rice.kew.api.exception.WorkflowException if anything goes wrong...
 * @return whether there are outstanding blocking requests
 */
protected boolean activateRequests(RouteContext routeContext) throws WorkflowException {
    DocumentRouteHeaderValue document = routeContext.getDocument();
    RouteNodeInstance nodeInstance = routeContext.getNodeInstance();
    if (routeContext.isSimulation()) {
        // this seems to indicate whether, when we are simulating, to activate requests...
        if (routeContext.getActivationContext().isActivateRequests()) {
            activateRequests(routeContext, document, nodeInstance);
        }
        // if we are in simulation, don't block, just transition out
        return false;
    } else {
        // activate any unactivated pending requests on this node instance
        return activateRequests(routeContext, document, nodeInstance);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:IteratedRequestActivationNode.java

示例3: saveNode

import org.kuali.rice.kew.engine.RouteContext; //导入方法依赖的package包/类
private RouteNodeInstance saveNode(RouteContext context, RouteNodeInstance nodeInstance) {
    if (!context.isSimulation()) {
        return KEWServiceLocator.getRouteNodeService().save(nodeInstance);
    } else {
        // if we are in simulation mode, lets go ahead and assign some id
        // values to our beans
        for (RouteNodeInstance routeNodeInstance : nodeInstance.getNextNodeInstances()) {
            if (routeNodeInstance.getRouteNodeInstanceId() == null) {
                routeNodeInstance.setRouteNodeInstanceId(context.getEngineState().getNextSimulationId());
            }
        }
        if (nodeInstance.getProcess() != null && nodeInstance.getProcess().getRouteNodeInstanceId() == null) {
            nodeInstance.getProcess().setRouteNodeInstanceId(context.getEngineState().getNextSimulationId());
        }
        if (nodeInstance.getBranch() != null && nodeInstance.getBranch().getBranchId() == null) {
            nodeInstance.getBranch().setBranchId(context.getEngineState().getNextSimulationId());
        }
        return nodeInstance;
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:BasicJoinEngine.java

示例4: process

import org.kuali.rice.kew.engine.RouteContext; //导入方法依赖的package包/类
public SimpleResult process(RouteContext context, RouteHelper helper) throws Exception {
   	if (context.isSimulation()) {
           if (!context.getActivationContext().isActivateRequests()) {
           	return new SimpleResult(true);
           }
       } 
loadConfiguration(context);
Document document = generateXmlInput(context);
if (LOG.isDebugEnabled()) {
    LOG.debug("XML input for email tranformation:\n" + XmlJotter.jotNode(document));
}
Templates style = loadStyleSheet(styleName);
EmailContent emailContent = emailStyleHelper.generateEmailContent(style, document);
if (!StringUtils.isBlank(to)) {
	CoreApiServiceLocator.getMailer().sendEmail(new EmailFrom(from), new EmailTo(to), new EmailSubject(emailContent.getSubject()), new EmailBody(emailContent.getBody()), emailContent.isHtml());
}
return new SimpleResult(true);
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:EmailNode.java

示例5: activateRequests

import org.kuali.rice.kew.engine.RouteContext; //导入方法依赖的package包/类
/**
 * Activates the action requests that are pending at this routelevel of the
 * document. The requests are processed by priority and then request ID. It
 * is implicit in the access that the requests are activated according to
 * the route level above all.
 * <p>
 * FYI and acknowledgment requests do not cause the processing to stop. Only
 * action requests for approval or completion cause the processing to stop
 * and then only for route level with a serialized activation policy. Only
 * requests at the current document's current route level are activated.
 * Inactive requests at a lower level cause a routing exception.
 * <p>
 * Exception routing and adhoc routing are processed slightly differently.
 *
 * @return True if the any approval actions were activated.
 * @throws org.kuali.rice.kew.api.exception.ResourceUnavailableException
 * @throws WorkflowException
 */
public boolean activateRequests(RouteContext context, DocumentRouteHeaderValue document,
        RouteNodeInstance nodeInstance) throws WorkflowException {
    MDC.put("docId", document.getDocumentId());
    PerformanceLogger performanceLogger = new PerformanceLogger(document.getDocumentId());
    List<ActionItem> generatedActionItems = new ArrayList<ActionItem>();
    List<ActionRequestValue> requests = new ArrayList<ActionRequestValue>();
    if (context.isSimulation()) {
        for (ActionRequestValue ar : context.getDocument().getActionRequests()) {
            // TODO logic check below duplicates behavior of the ActionRequestService.findPendingRootRequestsByDocIdAtRouteNode(documentId, routeNodeInstanceId) method
            if (ar.getCurrentIndicator()
                    && (ActionRequestStatus.INITIALIZED.getCode().equals(ar.getStatus())
                    || ActionRequestStatus.ACTIVATED.getCode().equals(ar.getStatus()))
                    && ar.getNodeInstance().getRouteNodeInstanceId().equals(nodeInstance.getRouteNodeInstanceId())
                    && ar.getParentActionRequest() == null) {
                requests.add(ar);
            }
        }
        requests.addAll(context.getEngineState().getGeneratedRequests());
    } else {
        requests = KEWServiceLocator.getActionRequestService().findPendingRootRequestsByDocIdAtRouteNode(
                document.getDocumentId(), nodeInstance.getRouteNodeInstanceId());
    }
    if (LOG.isDebugEnabled()) {
        LOG.debug("Pending Root Requests " + requests.size());
    }
    boolean activatedApproveRequest = activateRequestsCustom(context, requests, generatedActionItems, document,
            nodeInstance);

    // now let's send notifications, since this code needs to be able to activate each request individually, we need
    // to collection all action items and then notify after all have been generated
    notify(context, generatedActionItems, nodeInstance);

    performanceLogger.log("Time to activate requests.");
    return activatedApproveRequest;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:54,代码来源:RequestActivationNode.java

示例6: saveActionRequest

import org.kuali.rice.kew.engine.RouteContext; //导入方法依赖的package包/类
protected ActionRequestValue saveActionRequest(RouteContext context, ActionRequestValue actionRequest) {
    if (!context.isSimulation()) {
        return KEWServiceLocator.getActionRequestService().saveActionRequest(actionRequest);
    } else {
        actionRequest.setActionRequestId(String.valueOf(generatedRequestPriority++));
        context.getEngineState().getGeneratedRequests().add(actionRequest);
        return actionRequest;
    }

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

示例7: saveDocument

import org.kuali.rice.kew.engine.RouteContext; //导入方法依赖的package包/类
protected DocumentRouteHeaderValue saveDocument(RouteContext context, DocumentRouteHeaderValue document) {
    if (!context.isSimulation()) {
        document = KEWServiceLocator.getRouteHeaderService().saveRouteHeader(document);
        context.setDocument(document);
    }
    return document;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:8,代码来源:RequestActivationNode.java

示例8: process

import org.kuali.rice.kew.engine.RouteContext; //导入方法依赖的package包/类
public SimpleResult process(RouteContext routeContext, RouteHelper routeHelper) throws Exception {
    // if previous requests were satisfied (if no requests have been generated yet, this should return true
    RequestFulfillmentCriteria criteria = getRequestFulfillmentCriteria(routeContext);
    // generate new requests until they are not satisfied or none are generated
    // if none are generated then we should transition immediately
    boolean activatedBlockingRequests = activateRequests(routeContext); // activation should always occur as something might have generated unactived requests
    boolean initialRequestGeneration = routeContext.getNodeInstance().isInitial();
    while (criteria.pendingRequestsAreFulfilled(activatedBlockingRequests, routeContext)) {
        boolean newRequestsGenerated = generateNewRequests(initialRequestGeneration, routeContext, routeHelper);
        initialRequestGeneration = false;

        if (!newRequestsGenerated) {
            // if the pending requests were fulfilled
            // ...and we didn't generate any new requests
            // ...then there are no further requests to activate (XXX: WRONG)
            // ...and we have no more processing to do
            return new SimpleResult(true);
        }

        // activate any requests that were generated
        activatedBlockingRequests = activateRequests(routeContext);

        // set the request fulfillment criteria for the new set of requests
        // if we are simulating, always set a criteria that indicates fulfillment
        if (routeContext.isSimulation()) {
            criteria = new SimulatingCriteria();
        } else {
            criteria = getRequestFulfillmentCriteria(routeContext);
        }
    }
    // if we got here, then for some reason pending requests have not been fulfilled
    // so wait/block for request fulfillment
    return new SimpleResult(false);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:35,代码来源:IteratedRequestActivationNode.java

示例9: saveActionRequest

import org.kuali.rice.kew.engine.RouteContext; //导入方法依赖的package包/类
protected ActionRequestValue saveActionRequest(RouteContext context, ActionRequestValue actionRequest) {
    if (!context.isSimulation()) {
        return KEWServiceLocator.getActionRequestService().saveActionRequest(actionRequest);
    } else {
        actionRequest.setActionRequestId(String.valueOf(generatedRequestPriority++));
        context.getEngineState().getGeneratedRequests().add(actionRequest);
        return actionRequest;
    }
    
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:11,代码来源:IteratedRequestActivationNode.java

示例10: process

import org.kuali.rice.kew.engine.RouteContext; //导入方法依赖的package包/类
public SimpleResult process(RouteContext context, RouteHelper helper)
		throws Exception {

       LOG.debug("processing FYIByNetworkId simple node");
       String documentId = context.getDocument().getDocumentId();
       Element rootElement = getRootElement(new StandardDocumentContent(context.getDocument().getDocContent()));
	Collection<Element> fieldElements = XmlHelper.findElements(rootElement, "field");
       Iterator<Element> elementIter = fieldElements.iterator();
       while (elementIter.hasNext()) {
       	Element field = (Element) elementIter.next();
       	Element version = field.getParentElement();
       	if (version.getAttribute("current").getValue().equals("true")) {
       		LOG.debug("Looking for networkId field:  " + field.getAttributeValue("name"));
              	if (field.getAttribute("name")!= null && field.getAttributeValue("name").equals("networkId")) {
           		LOG.debug("Should send an FYI to netID:  " + field.getChildText("value"));
              		if (field.getChildText("value") != null) {
              			Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName(field.getChildText("value"));

              			//WorkflowDocument wfDoc = new WorkflowDocument(new NetworkIdVO(field.getChildText("value")), documentId);
              			if (!context.isSimulation()) {
                  			KEWServiceLocator.getWorkflowDocumentService().adHocRouteDocumentToPrincipal(user.getPrincipalId(), context.getDocument(), KewApiConstants.ACTION_REQUEST_FYI_REQ, null, null, "Notification Request", user.getPrincipalId(), "Notification Request", true, null);
              		}
              			//wfDoc.adHocRouteDocumentToPrincipal(KewApiConstants.ACTION_REQUEST_FYI_REQ, "Notification Request", new NetworkIdVO(field.getChildText("value")), "Notification Request", true);
               		LOG.debug("Sent FYI using the adHocRouteDocumentToPrincipal function to NetworkID:  " + user.getPrincipalName());
                              	break;
              	}
       	}
       }
       }
	return super.process(context, helper);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:32,代码来源:FYIByNetworkId.java

示例11: process

import org.kuali.rice.kew.engine.RouteContext; //导入方法依赖的package包/类
public SimpleResult process(RouteContext context, RouteHelper helper)
		throws Exception {

       LOG.debug("processing FYIByUniversityId node");
       Element rootElement = getRootElement(new StandardDocumentContent(context.getDocument().getDocContent()));
		Collection<Element> fieldElements = XmlHelper.findElements(rootElement, "field");
       Iterator<Element> elementIter = fieldElements.iterator();
       while (elementIter.hasNext()) {
       	Element field = (Element) elementIter.next();
       	Element version = field.getParentElement();
       	if (version.getAttribute("current").getValue().equals("true")) {
       		LOG.debug("Looking for studentUid field:  " + field.getAttributeValue("name"));
              	if (field.getAttribute("name")!= null && field.getAttributeValue("name").equals("studentUid")) {
              		String employeeId = field.getChildText("value");
           		LOG.debug("Should send an FYI to employee ID:  " + employeeId);
              		if (!StringUtils.isBlank(employeeId)) {
              			Person person = KimApiServiceLocator.getPersonService().getPerson(employeeId);

              			if (person == null) {
              				throw new WorkflowRuntimeException("Failed to locate a Person with the given employee ID: " + employeeId);
              			}
              			if (!context.isSimulation()) {
              				KEWServiceLocator.getWorkflowDocumentService().adHocRouteDocumentToPrincipal(person.getPrincipalId(), context.getDocument(), KewApiConstants.ACTION_REQUEST_FYI_REQ, null, null, "Notification Request", person.getPrincipalId(), "Notification Request", true, null);
              			}
              			//wfDoc.adHocRouteDocumentToPrincipal(KewApiConstants.ACTION_REQUEST_FYI_REQ, "Notification Request", new EmplIdVO(field.getChildText("value")), "Notification Request", true);
               		LOG.debug("Sent FYI using the adHocRouteDocumentToPrincipal function to UniversityID:  " + person.getEmployeeId());
               		break;
              	}
       	}
       }
       }
	return super.process(context, helper);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:34,代码来源:FYIByUniversityId.java

示例12: activateRequestsCustom

import org.kuali.rice.kew.engine.RouteContext; //导入方法依赖的package包/类
protected boolean activateRequestsCustom(RouteContext context, List<ActionRequestValue> requests,
        List<ActionItem> generatedActionItems, DocumentRouteHeaderValue document,
        RouteNodeInstance nodeInstance) throws WorkflowException {
    // make a copy of the list so that we can sort it
    requests = new ArrayList<ActionRequestValue>(requests);
    Collections.sort(requests, new Utilities.PrioritySorter());
    String activationType = nodeInstance.getRouteNode().getActivationType();
    if (StringUtils.isBlank(activationType)) {
        // not sure if this is really necessary, but preserves behavior prior to introduction of priority-parallel activation
        activationType = KewApiConstants.ROUTE_LEVEL_SEQUENCE;
    }
    boolean isParallel = KewApiConstants.ROUTE_LEVEL_PARALLEL.equals(activationType);
    boolean isPriorityParallel = KewApiConstants.ROUTE_LEVEL_PRIORITY_PARALLEL.equals(activationType);
    boolean isSequential = KewApiConstants.ROUTE_LEVEL_SEQUENCE.equals(activationType);

    boolean activatedApproveRequest = false;
    if (CollectionUtils.isNotEmpty(requests)) {
        // if doing priority-parallel
        int currentPriority = requests.get(0).getPriority();
        for (ActionRequestValue request : requests) {
            if (request.getParentActionRequest() != null || request.getNodeInstance() == null) {
                // 1. disregard request if it's not a top-level request
                // 2. disregard request if it's a "future" request and hasn't been attached to a node instance yet
                continue;
            }
            if (activatedApproveRequest && (!context.isSimulation() || !context.getActivationContext()
                    .isActivateRequests())) {
                if (isSequential || (isPriorityParallel && request.getPriority() != currentPriority)) {
                    break;
                }
            }
            currentPriority = request.getPriority();
            if (request.isActive()) {
                activatedApproveRequest = activatedApproveRequest || request.isApproveOrCompleteRequest();
                continue;
            }
            logProcessingMessage(request);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Activating request: " + request);
            }
            activatedApproveRequest = activateRequest(context, request, nodeInstance, generatedActionItems)
                    || activatedApproveRequest;
        }
    }
    return activatedApproveRequest;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:47,代码来源:RequestActivationNode.java

示例13: activateRequestsCustom

import org.kuali.rice.kew.engine.RouteContext; //导入方法依赖的package包/类
protected boolean activateRequestsCustom(RouteContext context,
		List<ActionRequestValue> requests, List<ActionItem> generatedActionItems,
		DocumentRouteHeaderValue document, RouteNodeInstance nodeInstance)
		throws WorkflowException {
       // copy the list so's we can sort it
       requests = new ArrayList<ActionRequestValue>(requests);
	Collections.sort( requests, ROLE_REQUEST_SORTER );
	String activationType = nodeInstance.getRouteNode().getActivationType();
	boolean isParallel = KewApiConstants.ROUTE_LEVEL_PARALLEL.equals( activationType );
	boolean requestActivated = false;
	String groupToActivate = null;
	Integer priorityToActivate = null;
	for ( ActionRequestValue request : requests ) {
		// if a request has already been activated and we are not parallel routing
		// or in the simulator, break out of the loop and exit
		if ( requestActivated
				&& !isParallel
				&& (!context.isSimulation() || !context.getActivationContext()
						.isActivateRequests()) ) {
			break;
		}
		if ( request.getParentActionRequest() != null || request.getNodeInstance() == null ) {
			// 1. disregard request if it's not a top-level request
			// 2. disregard request if it's a "future" request and hasn't
			// been attached to a node instance yet
			continue;
		}
		if ( request.isApproveOrCompleteRequest() ) {
			boolean thisRequestActivated = false;
			// capture the priority and grouping information for this request
			// We only need this for Approval requests since FYI and ACK requests are non-blocking
			if ( priorityToActivate == null ) {
			 	priorityToActivate = request.getPriority();
			}
			if ( groupToActivate == null ) {
				groupToActivate = request.getResponsibilityDesc();
			}
			// check that the given request is found in the current group to activate
			// check priority and grouping from the request (stored in the responsibility description)
			if ( StringUtils.equals( groupToActivate, request.getResponsibilityDesc() )
					&& (
							(priorityToActivate != null && request.getPriority() != null && priorityToActivate.equals(request.getPriority()))
						||  (priorityToActivate == null && request.getPriority() == null)
						)
					) {
				// if the request is already active, note that we have an active request
				// and move on to the next request
				if ( request.isActive() ) {
					requestActivated = true;
					continue;
				}
				logProcessingMessage( request );
				if ( LOG.isDebugEnabled() ) {
					LOG.debug( "Activating request: " + request );
				}
				// this returns true if any requests were activated as a result of this call
				thisRequestActivated = activateRequest( context, request, nodeInstance,
						generatedActionItems );
				requestActivated |= thisRequestActivated;
			}
			// if this request was not activated and no request has been activated thus far
			// then clear out the grouping and priority filters
			// as this represents a case where the person with the earlier priority
			// did not need to approve for this route level due to taking
			// a prior action
			if ( !thisRequestActivated && !requestActivated ) {
				priorityToActivate = null;
				groupToActivate = null;
			}
		} else {
			logProcessingMessage( request );
			if ( LOG.isDebugEnabled() ) {
				LOG.debug( "Activating request: " + request );
			}
			requestActivated = activateRequest( context, request, nodeInstance,
					generatedActionItems )
					|| requestActivated;
		}
	}
	return requestActivated;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:82,代码来源:RoleNode.java

示例14: notify

import org.kuali.rice.kew.engine.RouteContext; //导入方法依赖的package包/类
/**
 * This method takes care of notification for ActionItems.
    *
    * <p>It has logic for suppressing notifications a)
 * during simulations, and b) when the RouteNodeInstance has NodeState specifically hinting for notification
 * suppression for a given ActionItem.</p>
 * 
 * <p>A side effect during non-simulation calls is that any notification suppression NodeStates will be removed
 * from the RouteNodeInstance after notifications are sent.</p>
 * 
 * @param context the routing context in which to perform the notification
 * @param actionItems the list of action items for which to dispatch notifications
 * @param routeNodeInstance the node instance at which the notifications are being sent
 */
protected void notify(RouteContext context, List<ActionItem> actionItems, RouteNodeInstance routeNodeInstance) {
	if (!context.isSimulation()) {
		new NotificationSuppression().notify(actionItems, routeNodeInstance);
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:RequestActivationNodeBase.java


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