List of usage examples for com.liferay.portal.workflow.kaleo.model KaleoInstance getRootKaleoInstanceToken
public KaleoInstanceToken getRootKaleoInstanceToken( com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException;
From source file:de.hofuniversity.iisys.liferay.workflows.LoggingWorkflowEngine.java
License:Open Source License
@Override public WorkflowInstance getWorkflowInstance(long workflowInstanceId, ServiceContext serviceContext) throws WorkflowException { try {/*from w ww. j ava 2 s.c o m*/ fLogger.println("WorkflowEngine.getWorkflowInstance"); fLogger.println("\tworkflowInstanceId: " + workflowInstanceId); fLogger.println("\tserviceContext:"); logServiceContext(serviceContext, "\t\t"); KaleoInstance kaleoInstance = kaleoInstanceLocalService.getKaleoInstance(workflowInstanceId); KaleoInstanceToken rootKaleoInstanceToken = kaleoInstance.getRootKaleoInstanceToken(serviceContext); WorkflowInstance instance = _kaleoWorkflowModelConverter.toWorkflowInstance(kaleoInstance, rootKaleoInstanceToken); if (instance != null) { fLogger.println("\tRETURN WorkflowInstance:"); logWfInstance(instance, "\t\t"); } fLogger.flush(); return instance; } catch (Exception e) { throw new WorkflowException(e); } }
From source file:de.hofuniversity.iisys.liferay.workflows.LoggingWorkflowEngine.java
License:Open Source License
@Override public WorkflowInstance signalWorkflowInstance(long workflowInstanceId, final String transitionName, Map<String, Serializable> workflowContext, ServiceContext serviceContext) throws WorkflowException { try {/*from w w w. j a v a 2 s . c om*/ fLogger.println("WorkflowEngine.signalWorkflowInstance"); fLogger.println("\tworkflowInstanceId: " + workflowInstanceId); fLogger.println("\ttransitionName: " + transitionName); fLogger.println("\tworkflowContext:"); logMap(workflowContext, "\t\t"); fLogger.println("\tserviceContext:"); logServiceContext(serviceContext, "\t\t"); KaleoInstance kaleoInstance = doUpdateContext(workflowInstanceId, workflowContext, serviceContext); KaleoInstanceToken kaleoInstanceToken = kaleoInstance.getRootKaleoInstanceToken(serviceContext); if (Validator.isNotNull(transitionName)) { // Validate that the transition actually exists before moving // forward KaleoNode currentKaleoNode = kaleoInstanceToken.getCurrentKaleoNode(); currentKaleoNode.getKaleoTransition(transitionName); } serviceContext.setScopeGroupId(kaleoInstanceToken.getGroupId()); final ExecutionContext executionContext = new ExecutionContext(kaleoInstanceToken, workflowContext, serviceContext); TransactionCommitCallbackUtil.registerCallback(new Callable<Void>() { @Override public Void call() throws Exception { try { _kaleoSignaler.signalExit(transitionName, executionContext); } catch (Exception e) { throw new WorkflowException("Unable to signal next transition", e); } return null; } }); WorkflowInstance instance = _kaleoWorkflowModelConverter.toWorkflowInstance(kaleoInstance, kaleoInstanceToken, workflowContext); fLogger.println("\tRETURN instance:"); logWfInstance(instance, "\t\t"); fLogger.flush(); return instance; } catch (Exception e) { throw new WorkflowException(e); } }
From source file:de.hofuniversity.iisys.liferay.workflows.LoggingWorkflowEngine.java
License:Open Source License
@Override public WorkflowInstance updateContext(long workflowInstanceId, Map<String, Serializable> workflowContext, ServiceContext serviceContext) throws WorkflowException { try {/*from w ww . j av a 2s . com*/ fLogger.println("WorkflowEngine.updateContext"); fLogger.println("\tworkflowInstanceId: " + workflowInstanceId); fLogger.println("\tworkflowContext:"); logMap(workflowContext, "\t\t"); fLogger.println("\tserviceContext:"); logServiceContext(serviceContext, "\t\t"); KaleoInstance kaleoInstance = doUpdateContext(workflowInstanceId, workflowContext, serviceContext); KaleoInstanceToken rootKaleoInstanceToken = kaleoInstance.getRootKaleoInstanceToken(serviceContext); WorkflowInstance instance = _kaleoWorkflowModelConverter.toWorkflowInstance(kaleoInstance, rootKaleoInstanceToken); fLogger.println("\tRETURN instance:"); logWfInstance(instance, "\t\t"); fLogger.flush(); return instance; } catch (Exception e) { throw new WorkflowException(e); } }
From source file:de.hofuniversity.iisys.liferay.workflows.LoggingWorkflowEngine.java
License:Open Source License
protected List<WorkflowInstance> toWorkflowInstances(List<KaleoInstance> kaleoInstances, ServiceContext serviceContext) throws PortalException { List<WorkflowInstance> workflowInstances = new ArrayList<>(kaleoInstances.size()); for (KaleoInstance kaleoInstance : kaleoInstances) { KaleoInstanceToken rootKaleoInstanceToken = kaleoInstance.getRootKaleoInstanceToken(serviceContext); workflowInstances//from w w w . j a v a 2s .c om .add(_kaleoWorkflowModelConverter.toWorkflowInstance(kaleoInstance, rootKaleoInstanceToken)); } return workflowInstances; }