Search in sources :

Example 6 with TaskGeneralSet

use of org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet 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));
}
Also used : ExclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.ExclusiveGateway) ScriptTask(org.kie.workbench.common.stunner.bpmn.definition.ScriptTask) InclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway) ArrayList(java.util.ArrayList) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) TaskGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) Before(org.junit.Before)

Example 7 with TaskGeneralSet

use of org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet in project kie-wb-common by kiegroup.

the class TaskConverter method scriptTask.

private PropertyWriter scriptTask(Node<View<ScriptTask>, ?> n) {
    org.eclipse.bpmn2.ScriptTask task = bpmn2.createScriptTask();
    task.setId(n.getUUID());
    ScriptTask definition = n.getContent().getDefinition();
    ScriptTaskPropertyWriter p = propertyWriterFactory.of(task);
    TaskGeneralSet general = definition.getGeneral();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    ScriptTaskExecutionSet executionSet = definition.getExecutionSet();
    p.setScript(executionSet.getScript().getValue());
    p.setAsync(executionSet.getIsAsync().getValue());
    p.setSimulationSet(definition.getSimulationSet());
    p.setBounds(n.getContent().getBounds());
    return p;
}
Also used : ScriptTaskPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ScriptTaskPropertyWriter) ScriptTask(org.kie.workbench.common.stunner.bpmn.definition.ScriptTask) TaskGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet) Factories.bpmn2(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2) ScriptTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTaskExecutionSet)

Example 8 with TaskGeneralSet

use of org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet in project kie-wb-common by kiegroup.

the class ScriptTaskConverter method convert.

public Node<? extends View<? extends BPMNViewDefinition>, ?> convert(org.eclipse.bpmn2.ScriptTask task) {
    Node<View<ScriptTask>, Edge> node = factoryManager.newNode(task.getId(), ScriptTask.class);
    ScriptTask definition = node.getContent().getDefinition();
    ScriptTaskPropertyReader p = propertyReaderFactory.of(task);
    definition.setGeneral(new TaskGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
    definition.setExecutionSet(new ScriptTaskExecutionSet(new Script(p.getScript()), new IsAsync(p.isAsync())));
    node.getContent().setBounds(p.getBounds());
    definition.setDimensionsSet(p.getRectangleDimensionsSet());
    definition.setBackgroundSet(p.getBackgroundSet());
    definition.setFontSet(p.getFontSet());
    definition.setSimulationSet(p.getSimulationSet());
    return node;
}
Also used : Script(org.kie.workbench.common.stunner.bpmn.definition.property.task.Script) ScriptTask(org.kie.workbench.common.stunner.bpmn.definition.ScriptTask) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) TaskGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet) IsAsync(org.kie.workbench.common.stunner.bpmn.definition.property.task.IsAsync) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) ScriptTaskPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ScriptTaskPropertyReader) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) ScriptTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTaskExecutionSet)

Example 9 with TaskGeneralSet

use of org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet in project kie-wb-common by kiegroup.

the class TaskConverter method noneTask.

private BpmnNode noneTask(Task task) {
    Node<View<NoneTask>, Edge> node = factoryManager.newNode(task.getId(), NoneTask.class);
    TaskPropertyReader p = propertyReaderFactory.of(task);
    NoneTask definition = node.getContent().getDefinition();
    definition.setGeneral(new TaskGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
    definition.setExecutionSet(new EmptyTaskExecutionSet());
    definition.setSimulationSet(p.getSimulationSet());
    node.getContent().setBounds(p.getBounds());
    definition.setDimensionsSet(p.getRectangleDimensionsSet());
    definition.setBackgroundSet(p.getBackgroundSet());
    definition.setFontSet(p.getFontSet());
    return BpmnNode.of(node);
}
Also used : UserTaskPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.UserTaskPropertyReader) TaskPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.TaskPropertyReader) BusinessRuleTaskPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.BusinessRuleTaskPropertyReader) ScriptTaskPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ScriptTaskPropertyReader) NoneTask(org.kie.workbench.common.stunner.bpmn.definition.NoneTask) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) TaskGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet) EmptyTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.EmptyTaskExecutionSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) TaskName(org.kie.workbench.common.stunner.bpmn.definition.property.task.TaskName)

Aggregations

TaskGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet)9 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)6 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)5 Edge (org.kie.workbench.common.stunner.core.graph.Edge)5 View (org.kie.workbench.common.stunner.core.graph.content.view.View)5 ScriptTask (org.kie.workbench.common.stunner.bpmn.definition.ScriptTask)4 IsAsync (org.kie.workbench.common.stunner.bpmn.definition.property.task.IsAsync)4 TaskName (org.kie.workbench.common.stunner.bpmn.definition.property.task.TaskName)4 Factories.bpmn2 (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2)3 ScriptTaskPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ScriptTaskPropertyReader)3 UserTask (org.kie.workbench.common.stunner.bpmn.definition.UserTask)3 ScriptTaskExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTaskExecutionSet)3 BusinessRuleTaskPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.BusinessRuleTaskPropertyReader)2 UserTaskPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.UserTaskPropertyReader)2 BusinessRuleTask (org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask)2 AdHocAutostart (org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocAutostart)2 BusinessRuleTaskExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.task.BusinessRuleTaskExecutionSet)2 OnEntryAction (org.kie.workbench.common.stunner.bpmn.definition.property.task.OnEntryAction)2 OnExitAction (org.kie.workbench.common.stunner.bpmn.definition.property.task.OnExitAction)2 Script (org.kie.workbench.common.stunner.bpmn.definition.property.task.Script)2