/** * Get active workflow instances of this workflow definition * * @return the active workflow instances spawned from this workflow definition */ public synchronized Scriptable getActiveInstances() { WorkflowService workflowService = this.serviceRegistry.getWorkflowService(); List<WorkflowInstance> cmrWorkflowInstances = workflowService.getActiveWorkflows(this.id); ArrayList<Serializable> activeInstances = new ArrayList<Serializable>(); for (WorkflowInstance cmrWorkflowInstance : cmrWorkflowInstances) { activeInstances.add(new JscriptWorkflowInstance(cmrWorkflowInstance, this.serviceRegistry, this.scope)); } Scriptable activeInstancesScriptable = (Scriptable)getValueConverter().convertValueForScript(this.serviceRegistry, this.scope, null, activeInstances); return activeInstancesScriptable; }
/** * Get active workflow instances of this workflow definition * * @return the active workflow instances spawned from this workflow definition */ public synchronized Scriptable getActiveInstances() { WorkflowService workflowService = this.serviceRegistry.getWorkflowService(); List<WorkflowInstance> cmrWorkflowInstances = workflowService.getActiveWorkflows(this.id); ArrayList<Serializable> activeInstances = new ArrayList<Serializable>(); for (WorkflowInstance cmrWorkflowInstance : cmrWorkflowInstances) { activeInstances.add(new JscriptWorkflowInstance(cmrWorkflowInstance, this.serviceRegistry, this.scope)); } Scriptable activeInstancesScriptable = (Scriptable)getValueConverter().convertValueForScript(this.serviceRegistry, this.scope, null, activeInstances); return activeInstancesScriptable; }
private void checkActiveWorkflows(String defId, String... expectedIds) { List<WorkflowInstance> workflows = workflowService.getActiveWorkflows(defId); checkWorkflows(workflows, expectedIds); }
List<WorkflowInstance> workflows = workflowService.getActiveWorkflows(def.getId()); for (WorkflowInstance workflow : workflows) List<WorkflowInstance> workflows = workflowService.getActiveWorkflows(id); for (WorkflowInstance workflow : workflows) List<WorkflowInstance> workflows = workflowService.getActiveWorkflows(def.getId()); for (WorkflowInstance workflow : workflows) List<WorkflowInstance> workflows = workflowService.getActiveWorkflows(id); for (WorkflowInstance workflow : workflows) List<WorkflowInstance> workflows = workflowService.getActiveWorkflows(def.getId()); for (WorkflowInstance workflow : workflows)
List<WorkflowInstance> workflows = workflowService.getActiveWorkflows(def.getId()); for (WorkflowInstance workflow : workflows) List<WorkflowInstance> workflows = workflowService.getActiveWorkflows(id); for (WorkflowInstance workflow : workflows) List<WorkflowInstance> workflows = workflowService.getActiveWorkflows(def.getId()); for (WorkflowInstance workflow : workflows) List<WorkflowInstance> workflows = workflowService.getActiveWorkflows(id); for (WorkflowInstance workflow : workflows) List<WorkflowInstance> workflows = workflowService.getActiveWorkflows(def.getId()); for (WorkflowInstance workflow : workflows)
public void testGetWorkflows() throws Exception List<WorkflowInstance> workflows = workflowService.getActiveWorkflows(fakeDefId); assertTrue(workflows.isEmpty()); workflows = workflowService.getCompletedWorkflows(fakeDefId); String defId = definition.getId(); workflows = workflowService.getActiveWorkflows(defId); assertTrue(workflows.isEmpty()); workflows = workflowService.getCompletedWorkflows(defId); checkWorkflows(defId, instance1, instance2); checkWorkflowsContains(workflowService.getActiveWorkflows(), instance2); checkWorkflowsDontContain(workflowService.getActiveWorkflows(), instance1); checkWorkflowsContains(workflowService.getCompletedWorkflows(), instance1); checkWorkflowsDontContain(workflowService.getCompletedWorkflows(), instance2);
@Test public void testBuildWorkflowWithNoUserTasks() throws Exception { // Deploy a definition containing only a service task WorkflowDefinition testDefinition = deployDefinition("activiti/testWorkflowNoUserTasks.bpmn20.xml"); WorkflowBuilder builder = new WorkflowBuilder(testDefinition, workflowService, nodeService, null); // Build a workflow WorkflowInstance builtInstance = builder.build(); assertNotNull(builtInstance); // Check that there is no active workflow for the deployed definition(it should have finished already due to absence of user tasks) List<WorkflowInstance> activeInstances = workflowService.getActiveWorkflows(testDefinition.getId()); assertNotNull(activeInstances); assertEquals(0, activeInstances.size()); // Check that there's a historic record of our 'only service task' workflow being run. HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .finishedAfter(builtInstance.getStartDate()) .singleResult(); assertNotNull(historicProcessInstance); }