@Override protected TypeDefinition getBaseType(WorkflowTask task) { return task.getDefinition().getMetadata(); }
@Override protected TypeDefinition getBaseType(WorkflowDefinition item) { // TODO: I'm not sure this is safe as getStartTaskDefinition() is 'optional'. WorkflowTaskDefinition startTask = item.getStartTaskDefinition(); return startTask.getMetadata(); }
@Override protected TypeDefinition getBaseType(WorkflowDefinition item) { // TODO: I'm not sure this is safe as getStartTaskDefinition() is 'optional'. WorkflowTaskDefinition startTask = item.getStartTaskDefinition(); return startTask.getMetadata(); }
@Override protected TypeDefinition getBaseType(WorkflowTask task) { return task.getDefinition().getMetadata(); }
private boolean taskTypeMatches(WorkflowTask task, QName... types) { QName taskDefName = task.getDefinition().getMetadata().getName(); return Arrays.asList(types).contains(taskDefName); }
private boolean taskTypeMatches(WorkflowTask task, QName... types) { QName taskDefName = task.getDefinition().getMetadata().getName(); return Arrays.asList(types).contains(taskDefName); }
/** * {@inheritDoc} */ @Override protected String getItemType(WorkflowTask item) { TypeDefinition typeDef = item.getDefinition().getMetadata(); return typeDef.getName().toPrefixString(namespaceService); }
/** * {@inheritDoc} */ @Override protected String getItemType(WorkflowTask item) { TypeDefinition typeDef = item.getDefinition().getMetadata(); return typeDef.getName().toPrefixString(namespaceService); }
@SuppressWarnings("unchecked") private DictionaryService makeDictionaryService() { DictionaryService mock = mock(DictionaryService.class); TypeDefinition taskTypeDef = definition.getStartTaskDefinition().getMetadata(); when(mock.getAnonymousType((QName) any(), (Collection<QName>) any())).thenReturn(taskTypeDef); return mock; }
@SuppressWarnings("unchecked") private DictionaryService makeDictionaryService() { DictionaryService mock = mock(DictionaryService.class); when(mock.getAnonymousType((QName) any(), (Collection<QName>) any())).thenReturn(task.getDefinition().getMetadata()); return mock; }
/** * @param path WorkflowPath * @param instance ProcessInstance */ private void endStartTaskAutomatically(WorkflowPath path, ProcessInstance instance) { // Check if StartTask Needs to be ended automatically WorkflowDefinition definition = path.getInstance().getDefinition(); TypeDefinition metadata = definition.getStartTaskDefinition().getMetadata(); Set<QName> aspects = metadata.getDefaultAspectNames(); if(aspects.contains(WorkflowModel.ASPECT_END_AUTOMATICALLY)) { String taskId = ActivitiConstants.START_TASK_PREFIX + instance.getId(); endStartTask(taskId); } }
/** * @param path WorkflowPath * @param instance ProcessInstance */ private void endStartTaskAutomatically(WorkflowPath path, ProcessInstance instance) { // Check if StartTask Needs to be ended automatically WorkflowDefinition definition = path.getInstance().getDefinition(); TypeDefinition metadata = definition.getStartTaskDefinition().getMetadata(); Set<QName> aspects = metadata.getDefaultAspectNames(); if(aspects.contains(WorkflowModel.ASPECT_END_AUTOMATICALLY)) { String taskId = ActivitiConstants.START_TASK_PREFIX + instance.getId(); endStartTask(taskId); } }
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); }
@Test public void testGetDefinitionById() throws Exception { WorkflowDefinition definition = deployTestTaskDefinition(); WorkflowDefinition result = workflowEngine.getDefinitionById(definition.getId()); assertNotNull("The workflow definition was not found!", result); assertEquals(definition.getId(), result.getId()); assertEquals(definition.getDescription(), result.getDescription()); assertEquals(definition.getName(), result.getName()); assertEquals(definition.getTitle(), result.getTitle()); assertEquals(definition.getVersion(), result.getVersion()); WorkflowTaskDefinition resultStartDef = result.getStartTaskDefinition(); assertNotNull("Start task is null!", resultStartDef); WorkflowTaskDefinition originalStartDef = definition.getStartTaskDefinition(); assertEquals("Start task Id does not match!", originalStartDef.getId(), resultStartDef.getId()); WorkflowNode resultNode = resultStartDef.getNode(); assertNotNull("Start Task Node is null!", resultNode); assertEquals("Start Task Node Name does not match!", originalStartDef.getNode().getName(), resultNode.getName()); TypeDefinition metaData = resultStartDef.getMetadata(); assertNotNull("Start Task Metadata is null!", metaData); assertEquals("Start Task Metadata name does not match!", originalStartDef.getMetadata().getName(), metaData.getName()); workflowEngine.undeployDefinition(definition.getId()); WorkflowDefinition nullResult = workflowEngine.getDefinitionById(definition.getId()); assertNull("The workflow definition was found but should be null!", nullResult); }
/** * Actually tests if the priority is the default value. This is based on the assumption that custom * tasks are defaulted to a priority of 50 (which is invalid). I'm testing that the code I wrote decides this is an * invalid number and sets it to the default value (2). */ @Test public void testPriorityIsValid() { WorkflowDefinition definition = deployDefinition("activiti/testCustomActiviti.bpmn20.xml"); personManager.setUser(USER1); // Start the Workflow WorkflowPath path = workflowService.startWorkflow(definition.getId(), null); String instanceId = path.getInstance().getId(); // Check the Start Task is completed. WorkflowTask startTask = workflowService.getStartTask(instanceId); assertEquals(WorkflowTaskState.COMPLETED, startTask.getState()); List<WorkflowTask> tasks = workflowService.getTasksForWorkflowPath(path.getId()); for (WorkflowTask workflowTask : tasks) { Map<QName, Serializable> props = workflowTask.getProperties(); TypeDefinition typeDefinition = workflowTask.getDefinition().getMetadata(); Map<QName, PropertyDefinition> propertyDefs = typeDefinition.getProperties(); PropertyDefinition priorDef = propertyDefs.get(WorkflowModel.PROP_PRIORITY); assertEquals(props.get(WorkflowModel.PROP_PRIORITY),Integer.valueOf(priorDef.getDefaultValue())); } }
if(!query.getTaskName().equals(workflowTask.getDefinition().getMetadata().getName()))
if(!query.getTaskName().equals(workflowTask.getDefinition().getMetadata().getName()))
TypeDefinition definition = task.getDefinition().getMetadata(); assertNotNull(definition); String name = definition.getName().toPrefixString(namespaceService).replace(':', '_'); definition = task.getDefinition().getMetadata(); assertNotNull(definition); name = definition.getName().toPrefixString(namespaceService).replace(':', '_');