本文整理汇总了Java中org.kuali.rice.kew.engine.OrchestrationConfig类的典型用法代码示例。如果您正苦于以下问题:Java OrchestrationConfig类的具体用法?Java OrchestrationConfig怎么用?Java OrchestrationConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OrchestrationConfig类属于org.kuali.rice.kew.engine包,在下文中一共展示了OrchestrationConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: queueDeferredWork
import org.kuali.rice.kew.engine.OrchestrationConfig; //导入依赖的package包/类
protected void queueDeferredWork(ActionTakenValue actionTaken) {
try {
final boolean shouldIndex = getRouteHeader().getDocumentType().hasSearchableAttributes() && RouteContext.getCurrentRouteContext().isSearchIndexingRequestedForContext();
String applicationId = routeHeader.getDocumentType().getApplicationId();
DocumentOrchestrationQueue blanketApprove = KewApiServiceLocator.getDocumentOrchestrationQueue(
routeHeader.getDocumentId(), applicationId);
org.kuali.rice.kew.api.document.OrchestrationConfig orchestrationConfig =
org.kuali.rice.kew.api.document.OrchestrationConfig.create(actionTaken.getActionTakenId(), nodeNames);
DocumentProcessingOptions options = DocumentProcessingOptions.create(true, shouldIndex);
blanketApprove.orchestrateDocument(routeHeader.getDocumentId(), getPrincipal().getPrincipalId(),
orchestrationConfig, options);
} catch (Exception e) {
LOG.error(e);
throw new WorkflowRuntimeException(e);
}
}
示例2: processWithOptions
import org.kuali.rice.kew.engine.OrchestrationConfig; //导入依赖的package包/类
@Override
public void processWithOptions(@WebParam(name = "documentId") String documentId,
@WebParam(name = "options") DocumentProcessingOptions options) {
if (StringUtils.isBlank(documentId)) {
throw new RiceIllegalArgumentException("documentId was a null or blank value");
}
if (options == null) {
options = DocumentProcessingOptions.createDefault();
}
OrchestrationConfig config = new OrchestrationConfig(OrchestrationConfig.EngineCapability.STANDARD,
Collections.<String>emptySet(), null, options.isSendNotifications(), options.isRunPostProcessor());
WorkflowEngine engine = getWorkflowEngineFactory().newEngine(config);
try {
engine.process(documentId, null);
} catch (Exception e) {
LOG.error("Failed to process document through the workflow engine", e);
if (e instanceof RuntimeException) {
throw (RuntimeException)e;
}
throw new WorkflowRuntimeException(e);
}
if (options.isIndexSearchAttributes()) {
getDocumentAttributeIndexingQueue().indexDocument(documentId);
}
}
示例3: performDeferredBlanketApproveWork
import org.kuali.rice.kew.engine.OrchestrationConfig; //导入依赖的package包/类
public void performDeferredBlanketApproveWork(ActionTakenValue actionTaken, DocumentProcessingOptions processingOptions) throws Exception {
if (getRouteHeader().isInException()) {
LOG.debug("Moving document back to Enroute from Exception");
markDocumentEnroute(getRouteHeader());
}
//KULRICE-12283 Modified this code to pass along parameters which configures if acks and FYIs are deactivated during the blanket approval
OrchestrationConfig config = new OrchestrationConfig(EngineCapability.BLANKET_APPROVAL, nodeNames, actionTaken,
processingOptions.isSendNotifications(), processingOptions.isRunPostProcessor(),
processingOptions.isDeactivateAcknowledgements(), processingOptions.isDeactivateFYIs(), true);
BlanketApproveEngine blanketApproveEngine = KEWServiceLocator.getWorkflowEngineFactory().newEngine(config);
blanketApproveEngine.process(getRouteHeader().getDocumentId(), null);
queueDocumentProcessing();
}
示例4: performDeferredBlanketApproveWork
import org.kuali.rice.kew.engine.OrchestrationConfig; //导入依赖的package包/类
public void performDeferredBlanketApproveWork(ActionTakenValue actionTaken, DocumentProcessingOptions processingOptions) throws Exception {
if (getRouteHeader().isInException()) {
LOG.debug("Moving document back to Enroute from Exception");
markDocumentEnroute(getRouteHeader());
}
//KULRICE-12283 Modified this code to pass along parameters which configures if acks and FYIs are deactivated during the blanket approval
OrchestrationConfig config = new OrchestrationConfig(EngineCapability.BLANKET_APPROVAL, nodeNames, actionTaken, processingOptions.isSendNotifications(), processingOptions.isRunPostProcessor(), processingOptions.isDeactivateAcknowledgements(), processingOptions.isDeactivateFYIs());
BlanketApproveEngine blanketApproveEngine = KEWServiceLocator.getWorkflowEngineFactory().newEngine(config);
blanketApproveEngine.process(getRouteHeader().getDocumentId(), null);
queueDocumentProcessing();
}
示例5: performDeferredBlanketApproveWork
import org.kuali.rice.kew.engine.OrchestrationConfig; //导入依赖的package包/类
public void performDeferredBlanketApproveWork(ActionTakenValue actionTaken, DocumentProcessingOptions processingOptions) throws Exception {
if (getRouteHeader().isInException()) {
LOG.debug("Moving document back to Enroute from Exception");
markDocumentEnroute(getRouteHeader());
}
OrchestrationConfig config = new OrchestrationConfig(EngineCapability.BLANKET_APPROVAL, nodeNames, actionTaken, processingOptions.isSendNotifications(), processingOptions.isRunPostProcessor());
BlanketApproveEngine blanketApproveEngine = KEWServiceLocator.getWorkflowEngineFactory().newEngine(config);
blanketApproveEngine.process(getRouteHeader().getDocumentId(), null);
queueDocumentProcessing();
}
示例6: recordAction
import org.kuali.rice.kew.engine.OrchestrationConfig; //导入依赖的package包/类
public void recordAction() throws InvalidActionTakenException {
// TODO: this is used because calling this code from SuperUserAction without
// it causes an optimistic lock
//setRouteHeader(KEWServiceLocator.getRouteHeaderService().getRouteHeader(getDocumentId(), true));
DocumentType docType = getRouteHeader().getDocumentType();
String errorMessage = validateActionRules();
if (!org.apache.commons.lang.StringUtils.isEmpty(errorMessage)) {
LOG.info("User not authorized");
List<WorkflowServiceErrorImpl> errors = new ArrayList<WorkflowServiceErrorImpl>();
errors.add(new WorkflowServiceErrorImpl(errorMessage, AUTHORIZATION));
throw new WorkflowServiceErrorException(errorMessage, errors);
}
ActionTakenValue actionTaken = saveActionTaken();
notifyActionTaken(actionTaken);
if (getRouteHeader().isInException() || getRouteHeader().isStateInitiated()) {
LOG.debug("Moving document back to Enroute");
String oldStatus = getRouteHeader().getDocRouteStatus();
getRouteHeader().markDocumentEnroute();
String newStatus = getRouteHeader().getDocRouteStatus();
notifyStatusChange(newStatus, oldStatus);
KEWServiceLocator.getRouteHeaderService().saveRouteHeader(getRouteHeader());
}
OrchestrationConfig config = new OrchestrationConfig(EngineCapability.BLANKET_APPROVAL, new HashSet<String>(), actionTaken, docType.getSuperUserApproveNotificationPolicy().getPolicyValue(), isRunPostProcessorLogic());
RequestsNode.setSuppressPolicyErrors(RouteContext.getCurrentRouteContext());
try {
completeAnyOutstandingCompleteApproveRequests(actionTaken, docType.getSuperUserApproveNotificationPolicy().getPolicyValue());
BlanketApproveEngine blanketApproveEngine = KEWServiceLocator.getWorkflowEngineFactory().newEngine(config);
blanketApproveEngine.process(getRouteHeader().getDocumentId(), null);
} catch (Exception e) {
LOG.error("Failed to orchestrate the document to SuperUserApproved.", e);
throw new InvalidActionTakenException("Failed to orchestrate the document to SuperUserApproved.", e);
}
}
示例7: SimulationEngine
import org.kuali.rice.kew.engine.OrchestrationConfig; //导入依赖的package包/类
public SimulationEngine(RouteNodeService routeNodeService, RouteHeaderService routeHeaderService,
ParameterService parameterService, OrchestrationConfig config) {
super(routeNodeService, routeHeaderService, parameterService, config);
}
示例8: createDocument
import org.kuali.rice.kew.engine.OrchestrationConfig; //导入依赖的package包/类
public DocumentRouteHeaderValue createDocument(String principalId, DocumentRouteHeaderValue routeHeader) throws WorkflowException {
if (routeHeader.getDocumentId() != null) { // this is a debateable
// check - means the
// client is off
throw new InvalidActionTakenException("Document already has a Document id");
}
Principal principal = loadPrincipal(principalId);
boolean canInitiate = KEWServiceLocator.getDocumentTypePermissionService().canInitiate(principalId, routeHeader.getDocumentType());
if (!canInitiate) {
throw new InvalidActionTakenException("Principal with name '" + principal.getPrincipalName() + "' is not authorized to initiate documents of type '" + routeHeader.getDocumentType().getName());
}
if (!routeHeader.getDocumentType().isDocTypeActive()) {
// don't allow creation if document type is inactive
throw new IllegalDocumentTypeException("Document type '" + routeHeader.getDocumentType().getName() + "' is inactive");
}
routeHeader.setInitiatorWorkflowId(principalId);
if (routeHeader.getDocRouteStatus() == null) {
routeHeader.setDocRouteStatus(KewApiConstants.ROUTE_HEADER_INITIATED_CD);
}
if (routeHeader.getDocRouteLevel() == null) {
routeHeader.setDocRouteLevel(Integer.valueOf(KewApiConstants.ADHOC_ROUTE_LEVEL));
}
if (routeHeader.getCreateDate() == null) {
routeHeader.setCreateDate(new Timestamp(new Date().getTime()));
}
if (routeHeader.getDocVersion() == null) {
routeHeader.setDocVersion(Integer.valueOf(KewApiConstants.DocumentContentVersions.CURRENT));
}
if (routeHeader.getDocContent() == null) {
routeHeader.setDocContent(KewApiConstants.DEFAULT_DOCUMENT_CONTENT);
}
routeHeader.setDateModified(new Timestamp(new Date().getTime()));
routeHeader = KEWServiceLocator.getRouteHeaderService().saveRouteHeader(routeHeader);
OrchestrationConfig config = new OrchestrationConfig(EngineCapability.STANDARD);
KEWServiceLocator.getWorkflowEngineFactory().newEngine(config).initializeDocument(routeHeader);
routeHeader = KEWServiceLocator.getRouteHeaderService().saveRouteHeader(routeHeader);
return routeHeader;
}
示例9: recordAction
import org.kuali.rice.kew.engine.OrchestrationConfig; //导入依赖的package包/类
public void recordAction() throws InvalidActionTakenException {
if (org.apache.commons.lang.StringUtils.isEmpty(nodeName)) {
throw new InvalidActionTakenException("No approval node name set");
}
DocumentType docType = getRouteHeader().getDocumentType();
String errorMessage = super.validateActionRules();
if (!org.apache.commons.lang.StringUtils.isEmpty(errorMessage)) {
LOG.info("User not authorized");
List<WorkflowServiceErrorImpl> errors = new ArrayList<WorkflowServiceErrorImpl>();
errors.add(new WorkflowServiceErrorImpl(errorMessage, SuperUserActionTakenEvent.AUTHORIZATION));
throw new WorkflowServiceErrorException(errorMessage, errors);
}
ActionTakenValue actionTaken = saveActionTaken();
notifyActionTaken(actionTaken);
if (getRouteHeader().isInException()) {
LOG.debug("Moving document back to Enroute from Exception");
String oldStatus = getRouteHeader().getDocRouteStatus();
getRouteHeader().markDocumentEnroute();
String newStatus = getRouteHeader().getDocRouteStatus();
notifyStatusChange(newStatus, oldStatus);
DocumentRouteHeaderValue routeHeaderValue = KEWServiceLocator.getRouteHeaderService().
saveRouteHeader(getRouteHeader());
setRouteHeader(routeHeaderValue);
}
OrchestrationConfig config = new OrchestrationConfig(EngineCapability.BLANKET_APPROVAL, Collections.singleton(nodeName), actionTaken, docType.getSuperUserApproveNotificationPolicy().getPolicyValue(), isRunPostProcessorLogic());
try {
BlanketApproveEngine blanketApproveEngine = KEWServiceLocator.getWorkflowEngineFactory().newEngine(config);
blanketApproveEngine.process(getRouteHeader().getDocumentId(), null);
} catch (Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException)e;
} else {
throw new WorkflowRuntimeException(e.toString(), e);
}
}
//queueDocument();
}
示例10: recordAction
import org.kuali.rice.kew.engine.OrchestrationConfig; //导入依赖的package包/类
public void recordAction() throws InvalidActionTakenException {
// TODO: this is used because calling this code from SuperUserAction without
// it causes an optimistic lock
//setRouteHeader(KEWServiceLocator.getRouteHeaderService().getRouteHeader(getDocumentId(), true));
DocumentType docType = getRouteHeader().getDocumentType();
String errorMessage = validateActionRules();
if (!org.apache.commons.lang.StringUtils.isEmpty(errorMessage)) {
LOG.info("User not authorized");
List<WorkflowServiceErrorImpl> errors = new ArrayList<WorkflowServiceErrorImpl>();
errors.add(new WorkflowServiceErrorImpl(errorMessage, AUTHORIZATION));
throw new WorkflowServiceErrorException(errorMessage, errors);
}
ActionTakenValue actionTaken = saveActionTaken();
notifyActionTaken(actionTaken);
if (getRouteHeader().isInException() || getRouteHeader().isStateInitiated()) {
LOG.debug("Moving document back to Enroute");
String oldStatus = getRouteHeader().getDocRouteStatus();
getRouteHeader().markDocumentEnroute();
String newStatus = getRouteHeader().getDocRouteStatus();
notifyStatusChange(newStatus, oldStatus);
DocumentRouteHeaderValue routeHeaderValue = KEWServiceLocator.getRouteHeaderService().
saveRouteHeader(getRouteHeader());
setRouteHeader(routeHeaderValue);
}
OrchestrationConfig config = new OrchestrationConfig(EngineCapability.BLANKET_APPROVAL, new HashSet<String>(), actionTaken, docType.getSuperUserApproveNotificationPolicy().getPolicyValue(), isRunPostProcessorLogic());
RequestsNode.setSuppressPolicyErrors(RouteContext.getCurrentRouteContext());
try {
completeAnyOutstandingCompleteApproveRequests(actionTaken, docType.getSuperUserApproveNotificationPolicy().getPolicyValue());
BlanketApproveEngine blanketApproveEngine = KEWServiceLocator.getWorkflowEngineFactory().newEngine(config);
blanketApproveEngine.process(getRouteHeader().getDocumentId(), null);
} catch (Exception e) {
LOG.error("Failed to orchestrate the document to SuperUserApproved.", e);
throw new InvalidActionTakenException("Failed to orchestrate the document to SuperUserApproved.", e);
}
}
示例11: refreshDocument
import org.kuali.rice.kew.engine.OrchestrationConfig; //导入依赖的package包/类
/**
* Requeues a document, and sets notification suppression data
*
* @see org.kuali.rice.kew.api.document.DocumentRefreshQueue#refreshDocument(java.lang.String)
*/
@Override
public void refreshDocument(String documentId) {
if (StringUtils.isBlank(documentId)) {
throw new RiceIllegalArgumentException("documentId is null or blank");
}
PerformanceLogger performanceLogger = new PerformanceLogger();
KEWServiceLocator.getRouteHeaderService().lockRouteHeader(documentId);
Collection<RouteNodeInstance> activeNodes = getRouteNodeService().getActiveNodeInstances(documentId);
List<ActionRequestValue> requestsToDelete = new ArrayList<ActionRequestValue>();
NotificationSuppression notificationSuppression = new NotificationSuppression();
for (RouteNodeInstance nodeInstance : activeNodes) {
// only "requeue" if we're dealing with a request activation node
if (helper.isRequestActivationNode(nodeInstance.getRouteNode())) {
List<ActionRequestValue> deletesForThisNode =
getActionRequestService().findPendingRootRequestsByDocIdAtRouteNode(documentId, nodeInstance.getRouteNodeInstanceId());
for (ActionRequestValue deleteForThisNode : deletesForThisNode) {
// check either the request or its first present child request to see if it is system generated
boolean containsRoleOrRuleRequests = deleteForThisNode.isRouteModuleRequest();
if (!containsRoleOrRuleRequests) {
if (CollectionUtils.isNotEmpty(deleteForThisNode.getChildrenRequests())) {
containsRoleOrRuleRequests = deleteForThisNode.getChildrenRequests().get(0).isRouteModuleRequest();
}
}
if (containsRoleOrRuleRequests) {
// remove all route or rule system generated requests
requestsToDelete.add(deleteForThisNode);
// suppress duplicate notifications
notificationSuppression.addNotificationSuppression(nodeInstance, deleteForThisNode);
}
}
// this will trigger a regeneration of requests
nodeInstance.setInitial(true);
getRouteNodeService().save(nodeInstance);
}
}
for (ActionRequestValue requestToDelete : requestsToDelete) {
getActionRequestService().deleteActionRequestGraphNoOutbox(requestToDelete);
}
try {
OrchestrationConfig config = new OrchestrationConfig(EngineCapability.STANDARD);
KEWServiceLocator.getWorkflowEngineFactory().newEngine(config).process(documentId, null);
} catch (Exception e) {
throw new WorkflowRuntimeException(e);
}
performanceLogger.log("Time to run DocumentRequeuer for document " + documentId);
}
示例12: recordAction
import org.kuali.rice.kew.engine.OrchestrationConfig; //导入依赖的package包/类
public void recordAction() throws InvalidActionTakenException {
// TODO: this is used because calling this code from SuperUserAction without
// it causes an optimistic lock
//setRouteHeader(KEWServiceLocator.getRouteHeaderService().getRouteHeader(getDocumentId(), true));
DocumentType docType = getRouteHeader().getDocumentType();
String errorMessage = validateActionRules();
if (!org.apache.commons.lang.StringUtils.isEmpty(errorMessage)) {
LOG.info("User not authorized");
List<WorkflowServiceErrorImpl> errors = new ArrayList<WorkflowServiceErrorImpl>();
errors.add(new WorkflowServiceErrorImpl(errorMessage, AUTHORIZATION));
throw new WorkflowServiceErrorException(errorMessage, errors);
}
ActionTakenValue actionTaken = saveActionTaken();
notifyActionTaken(actionTaken);
if (getRouteHeader().isInException() || getRouteHeader().isStateInitiated()) {
LOG.debug("Moving document back to Enroute");
String oldStatus = getRouteHeader().getDocRouteStatus();
getRouteHeader().markDocumentEnroute();
String newStatus = getRouteHeader().getDocRouteStatus();
notifyStatusChange(newStatus, oldStatus);
DocumentRouteHeaderValue routeHeaderValue = KEWServiceLocator.getRouteHeaderService().
saveRouteHeader(getRouteHeader());
setRouteHeader(routeHeaderValue);
}
OrchestrationConfig config = new OrchestrationConfig(EngineCapability.BLANKET_APPROVAL, new HashSet<String>(),
actionTaken, docType.getSuperUserApproveNotificationPolicy().getPolicyValue(),
isRunPostProcessorLogic(), false, false, true);
try {
completeAnyOutstandingCompleteApproveRequests(actionTaken, docType.getSuperUserApproveNotificationPolicy().getPolicyValue());
BlanketApproveEngine blanketApproveEngine = KEWServiceLocator.getWorkflowEngineFactory().newEngine(config);
blanketApproveEngine.process(getRouteHeader().getDocumentId(), null);
} catch (Exception e) {
LOG.error("Failed to orchestrate the document to SuperUserApproved.", e);
throw new InvalidActionTakenException("Failed to orchestrate the document to SuperUserApproved.", e);
}
}
示例13: createDocument
import org.kuali.rice.kew.engine.OrchestrationConfig; //导入依赖的package包/类
public DocumentRouteHeaderValue createDocument(String principalId, DocumentRouteHeaderValue routeHeader) throws WorkflowException {
if (routeHeader.getDocumentId() != null) { // this is a debateable
// check - means the
// client is off
throw new InvalidActionTakenException("Document already has a Document id");
}
Principal principal = loadPrincipal(principalId);
boolean canInitiate = KEWServiceLocator.getDocumentTypePermissionService().canInitiate(principalId, routeHeader.getDocumentType());
if (!canInitiate) {
throw new InvalidActionTakenException("Principal with name '" + principal.getPrincipalName() + "' is not authorized to initiate documents of type '" + routeHeader.getDocumentType().getName());
}
if (!routeHeader.getDocumentType().isDocTypeActive()) {
// don't allow creation if document type is inactive
throw new IllegalDocumentTypeException("Document type '" + routeHeader.getDocumentType().getName() + "' is inactive");
}
routeHeader.setInitiatorWorkflowId(principalId);
if (routeHeader.getDocRouteStatus() == null) {
routeHeader.setDocRouteStatus(KewApiConstants.ROUTE_HEADER_INITIATED_CD);
}
if (routeHeader.getDocRouteLevel() == null) {
routeHeader.setDocRouteLevel(Integer.valueOf(KewApiConstants.ADHOC_ROUTE_LEVEL));
}
if (routeHeader.getCreateDate() == null) {
routeHeader.setCreateDate(new Timestamp(new Date().getTime()));
}
if (routeHeader.getDocVersion() == null) {
routeHeader.setDocVersion(Integer.valueOf(KewApiConstants.DocumentContentVersions.CURRENT));
}
if (routeHeader.getDocContent() == null) {
routeHeader.setDocContent(KewApiConstants.DEFAULT_DOCUMENT_CONTENT);
}
routeHeader.setDateModified(new Timestamp(new Date().getTime()));
KEWServiceLocator.getRouteHeaderService().saveRouteHeader(routeHeader);
OrchestrationConfig config = new OrchestrationConfig(EngineCapability.STANDARD);
KEWServiceLocator.getWorkflowEngineFactory().newEngine(config).initializeDocument(routeHeader);
KEWServiceLocator.getRouteHeaderService().saveRouteHeader(routeHeader);
return routeHeader;
}
示例14: recordAction
import org.kuali.rice.kew.engine.OrchestrationConfig; //导入依赖的package包/类
public void recordAction() throws InvalidActionTakenException {
if (org.apache.commons.lang.StringUtils.isEmpty(nodeName)) {
throw new InvalidActionTakenException("No approval node name set");
}
DocumentType docType = getRouteHeader().getDocumentType();
String errorMessage = super.validateActionRules();
if (!org.apache.commons.lang.StringUtils.isEmpty(errorMessage)) {
LOG.info("User not authorized");
List<WorkflowServiceErrorImpl> errors = new ArrayList<WorkflowServiceErrorImpl>();
errors.add(new WorkflowServiceErrorImpl(errorMessage, SuperUserActionTakenEvent.AUTHORIZATION));
throw new WorkflowServiceErrorException(errorMessage, errors);
}
ActionTakenValue actionTaken = saveActionTaken();
notifyActionTaken(actionTaken);
if (getRouteHeader().isInException()) {
LOG.debug("Moving document back to Enroute from Exception");
String oldStatus = getRouteHeader().getDocRouteStatus();
getRouteHeader().markDocumentEnroute();
String newStatus = getRouteHeader().getDocRouteStatus();
notifyStatusChange(newStatus, oldStatus);
KEWServiceLocator.getRouteHeaderService().saveRouteHeader(getRouteHeader());
}
OrchestrationConfig config = new OrchestrationConfig(EngineCapability.BLANKET_APPROVAL, Collections.singleton(nodeName), actionTaken, docType.getSuperUserApproveNotificationPolicy().getPolicyValue(), isRunPostProcessorLogic());
try {
BlanketApproveEngine blanketApproveEngine = KEWServiceLocator.getWorkflowEngineFactory().newEngine(config);
blanketApproveEngine.process(getRouteHeader().getDocumentId(), null);
} catch (Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException)e;
} else {
throw new WorkflowRuntimeException(e.toString(), e);
}
}
//queueDocument();
}
示例15: refreshDocument
import org.kuali.rice.kew.engine.OrchestrationConfig; //导入依赖的package包/类
/**
* Requeues a document, and sets notification suppression data
*
* @see org.kuali.rice.kew.api.document.DocumentRefreshQueue#refreshDocument(java.lang.String)
*/
@Override
public void refreshDocument(String documentId) {
if (StringUtils.isBlank(documentId)) {
throw new RiceIllegalArgumentException("documentId is null or blank");
}
PerformanceLogger performanceLogger = new PerformanceLogger();
KEWServiceLocator.getRouteHeaderService().lockRouteHeader(documentId, true);
Collection<RouteNodeInstance> activeNodes = getRouteNodeService().getActiveNodeInstances(documentId);
List<ActionRequestValue> requestsToDelete = new ArrayList<ActionRequestValue>();
NotificationSuppression notificationSuppression = new NotificationSuppression();
for (RouteNodeInstance nodeInstance : activeNodes) {
// only "requeue" if we're dealing with a request activation node
if (helper.isRequestActivationNode(nodeInstance.getRouteNode())) {
List<ActionRequestValue> deletesForThisNode =
getActionRequestService().findPendingRootRequestsByDocIdAtRouteNode(documentId, nodeInstance.getRouteNodeInstanceId());
for (ActionRequestValue deleteForThisNode : deletesForThisNode) {
// only delete the request if it was generated by a route module (or the rules system)
if (deleteForThisNode.isRouteModuleRequest()) {
requestsToDelete.add(deleteForThisNode);
// suppress duplicate notifications
notificationSuppression.addNotificationSuppression(nodeInstance, deleteForThisNode);
}
}
// this will trigger a regeneration of requests
nodeInstance.setInitial(true);
getRouteNodeService().save(nodeInstance);
}
}
for (ActionRequestValue requestToDelete : requestsToDelete) {
getActionRequestService().deleteActionRequestGraph(requestToDelete);
}
try {
OrchestrationConfig config = new OrchestrationConfig(EngineCapability.STANDARD);
KEWServiceLocator.getWorkflowEngineFactory().newEngine(config).process(documentId, null);
} catch (Exception e) {
throw new WorkflowRuntimeException(e);
}
performanceLogger.log("Time to run DocumentRequeuer for document " + documentId);
}