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


Java KEWServiceLocator.getSimulationEngine方法代码示例

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


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

示例1: report

import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
public DocumentRouteHeaderValue report(SimulationCriteria criteria) {
	try {
		SimulationWorkflowEngine simulationEngine = KEWServiceLocator.getSimulationEngine();
		SimulationResults results = simulationEngine.runSimulation(criteria);
		return materializeDocument(results);
    } catch (Exception e) {
    	if (e instanceof RuntimeException) {
    		throw (RuntimeException)e;
    	}
        throw new IllegalStateException("Problem running report: " + e.getMessage(), e);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:RoutingReportServiceImpl.java

示例2: documentWillHaveAtLeastOneActionRequest

import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的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

示例3: isUserInRouteLogWithOptionalFlattening

import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
@Override
public boolean isUserInRouteLogWithOptionalFlattening(String documentId, String principalId, boolean lookFuture, boolean flattenNodes) {
    incomingParamCheck(documentId, "documentId");
    incomingParamCheck(principalId, "principalId");
    boolean authorized = false;
    if ( LOG.isDebugEnabled() ) {
    	LOG.debug("Evaluating isUserInRouteLog [docId=" + documentId + ", principalId=" + principalId + ", lookFuture=" + lookFuture + "]");
    }
    DocumentRouteHeaderValue routeHeader = loadDocument(documentId);
    if (routeHeader == null) {
        throw new IllegalArgumentException("Document for documentId: " + documentId + " does not exist");
    }
    Principal principal = KEWServiceLocator.getIdentityHelperService().getPrincipal(principalId);
    if (principal == null) {
        throw new IllegalArgumentException("Principal for principalId: " + principalId + " does not exist");
    }
    List<ActionTakenValue> actionsTaken = KEWServiceLocator.getActionTakenService().findByDocumentIdPrincipalId(documentId, principal.getPrincipalId());

    if(routeHeader.getInitiatorWorkflowId().equals(principal.getPrincipalId())){
    	return true;
    }

    if (!actionsTaken.isEmpty()) {
    	LOG.debug("found action taken by user");
    	authorized = true;
    }

    List<ActionRequestValue> actionRequests = KEWServiceLocator.getActionRequestService().findAllActionRequestsByDocumentId(documentId);
    if (actionRequestListHasPrincipal(principal, actionRequests)) {
    	authorized = true;
    }

    if (!lookFuture || authorized) {
    	return authorized;
    }


    SimulationWorkflowEngine simulationEngine = KEWServiceLocator.getSimulationEngine();
    SimulationCriteria criteria = SimulationCriteria.createSimulationCritUsingDocumentId(documentId);
    criteria.setDestinationNodeName(null); // process entire document to conclusion
    criteria.getDestinationRecipients().add(new KimPrincipalRecipient(principal));
    criteria.setFlattenNodes(flattenNodes);

    try {
    	SimulationResults results = simulationEngine.runSimulation(criteria);
    	if (actionRequestListHasPrincipal(principal, results.getSimulatedActionRequests())) {
    		authorized = true;
    	}
    } catch (Exception e) {
    	throw new RiceRuntimeException(e);
    }

    return authorized;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:55,代码来源:WorkflowDocumentActionsServiceImpl.java


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