public WorkflowTask createTask (String id, WorkflowTaskDefinition taskDef, String name, String defaultTitle, String defaultDescription, WorkflowTaskState state, WorkflowPath path, String workflowDefinitionName, Map<QName, Serializable> properties) { String actualId = buildGlobalId(id); String processKey = getProcessKey(workflowDefinitionName) + ".task." + name; TypeDefinition metadata = taskDef.getMetadata(); String title = getLabel(processKey, TITLE_LABEL, metadata.getTitle(dictionaryService), defaultTitle, name); defaultDescription = (defaultDescription !=null && defaultDescription.trim().length() == 0) ? null : defaultDescription; String description = getLabel(processKey, DESC_LABEL, defaultDescription, metadata.getDescription(dictionaryService), title); return new WorkflowTask(actualId, taskDef, name, title, description, state, path, properties); }
public WorkflowTask createTask (String id, WorkflowTaskDefinition taskDef, String name, String defaultTitle, String defaultDescription, WorkflowTaskState state, WorkflowPath path, String workflowDefinitionName, Map<QName, Serializable> properties) { String actualId = buildGlobalId(id); String processKey = getProcessKey(workflowDefinitionName) + ".task." + name; TypeDefinition metadata = taskDef.getMetadata(); String title = getLabel(processKey, TITLE_LABEL, metadata.getTitle(dictionaryService), defaultTitle, name); defaultDescription = (defaultDescription !=null && defaultDescription.trim().length() == 0) ? null : defaultDescription; String description = getLabel(processKey, DESC_LABEL, defaultDescription, metadata.getDescription(dictionaryService), title); return new WorkflowTask(actualId, taskDef, name, title, description, state, path, properties); }
this.newTask = new WorkflowTask(TASK_ID, null, null, null, null, null, null, null);
@SuppressWarnings("unchecked") private WorkflowService makeWorkflowService() { WorkflowService service = mock(WorkflowService.class); when(service.getDefinitionByName(WF_DEF_NAME)).thenReturn(definition); String instanceId = "foo$instanceId"; newInstance = new WorkflowInstance(instanceId, definition, null, null, null, null, true, null, null); WorkflowTask startTask = new WorkflowTask("foo$taskId", null, null, null, null, null, null, null); String pathId = "foo$pathId"; final WorkflowPath path = new WorkflowPath(pathId, newInstance, null, true); when(service.startWorkflow(eq(definition.getId()), anyMap())) .thenAnswer(new Answer<WorkflowPath>() { public WorkflowPath answer(InvocationOnMock invocation) throws Throwable { Object[] arguments = invocation.getArguments(); actualProperties = (Map<QName, Serializable>) arguments[1]; return path; } }); when(service.getTasksForWorkflowPath(path.getId())) .thenReturn(Collections.singletonList(startTask)); when(service.createPackage(null)).thenReturn(PCKG_NODE); return service; }
private WorkflowTask makeTask(WorkflowTransition... transitions) { String id = TASK_ID; String title = "Test"; WorkflowTaskState state = WorkflowTaskState.IN_PROGRESS; WorkflowTaskDefinition taskDef = makeTaskDefinition(transitions); Map<QName, Serializable> properties = makeTaskProperties(); WorkflowDefinition definition = new WorkflowDefinition("42", "Test", "1.0", "Test", "Test", null); NodeRef wfPackage = PCKG_NODE; WorkflowInstance instance = new WorkflowInstance(null, definition, null, null, wfPackage, null, true, null, null); WorkflowNode node = new WorkflowNode("", "", "", "", true, new WorkflowTransition[0]); WorkflowPath path = new WorkflowPath(null, instance, node, true); return new WorkflowTask(id, taskDef, null, title, null, state, path, properties); }