use of org.kie.workbench.common.stunner.bpmn.definition.UserTask in project kie-wb-common by kiegroup.
the class TaskConverter method userTask.
private PropertyWriter userTask(Node<View<UserTask>, ?> n) {
org.eclipse.bpmn2.UserTask task = bpmn2.createUserTask();
task.setId(n.getUUID());
UserTask definition = n.getContent().getDefinition();
UserTaskPropertyWriter p = propertyWriterFactory.of(task);
TaskGeneralSet general = definition.getGeneral();
p.setName(general.getName().getValue());
p.setDocumentation(general.getDocumentation().getValue());
p.setSimulationSet(definition.getSimulationSet());
UserTaskExecutionSet executionSet = definition.getExecutionSet();
p.setTaskName(executionSet.getTaskName().getValue());
p.setActors(executionSet.getActors());
p.setGroupId(executionSet.getGroupid().getValue());
p.setAssignmentsInfo(executionSet.getAssignmentsinfo());
p.setAsync(executionSet.getIsAsync().getValue());
p.setSkippable(executionSet.getSkippable().getValue());
p.setPriority(executionSet.getPriority().getValue());
p.setSubject(executionSet.getSubject().getValue());
p.setDescription(executionSet.getDescription().getValue());
p.setAdHocAutostart(executionSet.getAdHocAutostart().getValue());
p.setCreatedBy(executionSet.getCreatedBy().getValue());
p.setOnEntryAction(executionSet.getOnEntryAction());
p.setOnExitAction(executionSet.getOnExitAction());
p.setBounds(n.getContent().getBounds());
return p;
}
use of org.kie.workbench.common.stunner.bpmn.definition.UserTask in project kie-wb-common by kiegroup.
the class TaskConverter method userTask.
private BpmnNode userTask(org.eclipse.bpmn2.UserTask task) {
Node<View<UserTask>, Edge> node = factoryManager.newNode(task.getId(), UserTask.class);
UserTask definition = node.getContent().getDefinition();
UserTaskPropertyReader p = propertyReaderFactory.of(task);
definition.setGeneral(new TaskGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
definition.setSimulationSet(p.getSimulationSet());
definition.setExecutionSet(new UserTaskExecutionSet(new TaskName(p.getTaskName()), p.getActors(), new Groupid(p.getGroupid()), p.getAssignmentsInfo(), new IsAsync(p.isAsync()), new Skippable(p.isSkippable()), new Priority(p.getPriority()), new Subject(p.getSubject()), new Description(p.getDescription()), new CreatedBy(p.getCreatedBy()), new AdHocAutostart(p.isAdHocAutostart()), new OnEntryAction(p.getOnEntryAction()), new OnExitAction(p.getOnExitAction())));
node.getContent().setBounds(p.getBounds());
definition.setDimensionsSet(p.getRectangleDimensionsSet());
definition.setBackgroundSet(p.getBackgroundSet());
definition.setFontSet(p.getFontSet());
return BpmnNode.of(node);
}
use of org.kie.workbench.common.stunner.bpmn.definition.UserTask in project kie-wb-common by kiegroup.
the class UserTaskTest method testUserTaskTaskNameInvalid.
@Test
public void testUserTaskTaskNameInvalid() {
UserTask userTask = new UserTask.UserTaskBuilder().build();
userTask.getExecutionSet().setTaskName(new TaskName(TASK_NAME_INVALID));
Set<ConstraintViolation<UserTask>> violations = this.validator.validate(userTask);
assertEquals(1, violations.size());
}
use of org.kie.workbench.common.stunner.bpmn.definition.UserTask in project kie-wb-common by kiegroup.
the class BPMNProcessVariableDeleteHandler method isVariableBoundToNode.
private boolean isVariableBoundToNode(Node node, String propertyId) {
Object content = node.getContent();
if (content instanceof Definition) {
Object nodeDefinition = ((Definition) content).getDefinition();
Collection<String> variablesName = new ArrayList();
if (nodeDefinition instanceof UserTask) {
UserTask userTask = (UserTask) nodeDefinition;
final String userTaskAssignmentsinfo = userTask.getExecutionSet().getAssignmentsinfo().getValue();
variablesName.addAll(getVariablesName(userTaskAssignmentsinfo, PROPERTY_IN_PREFIX, PROPERTY_OUT_PREFIX));
variablesName.addAll(getVariablesName(userTaskAssignmentsinfo, PROPERTY_OUT_PREFIX));
}
if ((nodeDefinition instanceof BusinessRuleTask)) {
BusinessRuleTask businessRuleTaskTask = (BusinessRuleTask) nodeDefinition;
final String businessRuleTaskAssignmentsinfo = businessRuleTaskTask.getDataIOSet().getAssignmentsinfo().getValue();
variablesName.addAll(getVariablesName(businessRuleTaskAssignmentsinfo, PROPERTY_IN_PREFIX, PROPERTY_OUT_PREFIX));
variablesName.addAll(getVariablesName(businessRuleTaskAssignmentsinfo, PROPERTY_OUT_PREFIX));
}
return variablesName.stream().filter(id -> propertyId.equals(id)).findAny().isPresent();
}
return false;
}
use of org.kie.workbench.common.stunner.bpmn.definition.UserTask in project kie-wb-common by kiegroup.
the class DefaultRouteFormProviderTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
when(definitionManager.adapters()).thenReturn(adapterManager);
when(adapterManager.forDefinition()).thenReturn(definitionAdapter);
when(session.getSelectionControl()).thenReturn(selectionControl);
Collection<String> selectedItems = new ArrayList<>();
when(selectedNode.getUUID()).thenReturn(SELECTED_UUID);
selectedItems.add(selectedNode.getUUID());
when(selectionControl.getSelectedItems()).thenReturn(selectedItems);
when(graph.getNode(SELECTED_UUID)).thenReturn(selectedNode);
outEdges = new ArrayList<>();
UserTask userTask1 = new UserTask(new TaskGeneralSet(new Name("UserTask1"), null), null, null, null, null, null, null);
when(definitionAdapter.getTitle(eq(userTask1))).thenReturn("User Task");
outEdges.add(mockEdge("Edge1", userTask1));
UserTask userTask2 = new UserTask(new TaskGeneralSet(new Name("UserTask2"), null), null, null, null, null, null, null);
when(definitionAdapter.getTitle(eq(userTask2))).thenReturn("User Task");
outEdges.add(mockEdge("Edge2", userTask2));
ScriptTask scriptTask3 = new ScriptTask(new TaskGeneralSet(new Name("ScriptTask3"), null), null, null, null, null, null, null);
when(definitionAdapter.getTitle(eq(scriptTask3))).thenReturn("Script Task");
outEdges.add(mockEdge("Edge3", scriptTask3));
ExclusiveGateway gateway4 = new ExclusiveGateway(new BPMNGeneralSet("Gateway4"), null, null, null, null);
when(definitionAdapter.getTitle(eq(gateway4))).thenReturn("Exclusive Gateway");
outEdges.add(mockEdge("Edge4", gateway4));
InclusiveGateway gateway5 = new InclusiveGateway(new BPMNGeneralSet(""), null, null, null, null);
when(definitionAdapter.getTitle(eq(gateway5))).thenReturn("Inclusive Gateway");
outEdges.add(mockEdge("Edge5", gateway5));
}
Aggregations