Search in sources :

Example 1 with UserTaskExecutionSet

use of org.kie.workbench.common.stunner.bpmn.definition.property.task.UserTaskExecutionSet 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;
}
Also used : UserTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.UserTaskExecutionSet) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) TaskGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet) Factories.bpmn2(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2) UserTaskPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.UserTaskPropertyWriter)

Example 2 with UserTaskExecutionSet

use of org.kie.workbench.common.stunner.bpmn.definition.property.task.UserTaskExecutionSet 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);
}
Also used : Description(org.kie.workbench.common.stunner.bpmn.definition.property.task.Description) CreatedBy(org.kie.workbench.common.stunner.bpmn.definition.property.task.CreatedBy) Priority(org.kie.workbench.common.stunner.bpmn.definition.property.connectors.Priority) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) UserTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.UserTaskExecutionSet) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) TaskGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet) UserTaskPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.UserTaskPropertyReader) OnExitAction(org.kie.workbench.common.stunner.bpmn.definition.property.task.OnExitAction) AdHocAutostart(org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocAutostart) OnEntryAction(org.kie.workbench.common.stunner.bpmn.definition.property.task.OnEntryAction) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Subject(org.kie.workbench.common.stunner.bpmn.definition.property.task.Subject) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) TaskName(org.kie.workbench.common.stunner.bpmn.definition.property.task.TaskName) Groupid(org.kie.workbench.common.stunner.bpmn.definition.property.assignee.Groupid) TaskName(org.kie.workbench.common.stunner.bpmn.definition.property.task.TaskName) Skippable(org.kie.workbench.common.stunner.bpmn.definition.property.task.Skippable) IsAsync(org.kie.workbench.common.stunner.bpmn.definition.property.task.IsAsync) Edge(org.kie.workbench.common.stunner.core.graph.Edge)

Example 3 with UserTaskExecutionSet

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

the class BPMNDirectDiagramMarshallerTest method testUnmarshallUserTaskAssignments.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallUserTaskAssignments() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKASSIGNMENTS);
    assertDiagram(diagram, 8);
    assertEquals("UserTaskAssignments", diagram.getMetadata().getTitle());
    Node<? extends Definition, ?> selfEvaluationNode = diagram.getGraph().getNode("_6063D302-9D81-4C86-920B-E808A45377C2");
    UserTask selfEvaluationTask = (UserTask) selfEvaluationNode.getContent().getDefinition();
    assertEquals(selfEvaluationTask.getTaskType().getValue(), TaskTypes.USER);
    UserTaskExecutionSet executionSet = selfEvaluationTask.getExecutionSet();
    AssignmentsInfo assignmentsinfo = executionSet.getAssignmentsinfo();
    assertEquals(assignmentsinfo.getValue(), "|reason:com.test.Reason,Comment:Object,Skippable:Object||performance:Object|[din]reason->reason,[dout]performance->performance");
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) UserTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.UserTaskExecutionSet) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) Test(org.junit.Test)

Example 4 with UserTaskExecutionSet

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

the class BPMNDirectDiagramMarshallerTest method testUnmarshallUserTaskAssignees.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallUserTaskAssignees() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKASSIGNEES);
    assertDiagram(diagram, 6);
    assertEquals("UserGroups", diagram.getMetadata().getTitle());
    UserTaskExecutionSet executionSet = null;
    Iterator<Element> it = nodesIterator(diagram);
    while (it.hasNext()) {
        Element element = it.next();
        if (element.getContent() instanceof View) {
            Object oDefinition = ((View) element.getContent()).getDefinition();
            if (oDefinition instanceof UserTask) {
                UserTask userTask = (UserTask) oDefinition;
                executionSet = userTask.getExecutionSet();
                break;
            }
        }
    }
    assertEquals("user,user1", executionSet.getActors().getValue());
    assertEquals("admin,kiemgmt", executionSet.getGroupid().getValue());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) UserTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.UserTaskExecutionSet) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) FlowElement(org.eclipse.bpmn2.FlowElement) RootElement(org.eclipse.bpmn2.RootElement) Element(org.kie.workbench.common.stunner.core.graph.Element) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Test(org.junit.Test)

Example 5 with UserTaskExecutionSet

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

the class BPMNDiagramMarshallerTest method testUnmarshallUserTaskAssignments.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallUserTaskAssignments() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKASSIGNMENTS);
    assertDiagram(diagram, 8);
    assertEquals("UserTaskAssignments", diagram.getMetadata().getTitle());
    Node<? extends Definition, ?> selfEvaluationNode = diagram.getGraph().getNode("_6063D302-9D81-4C86-920B-E808A45377C2");
    UserTask selfEvaluationTask = (UserTask) selfEvaluationNode.getContent().getDefinition();
    assertEquals(selfEvaluationTask.getTaskType().getValue(), TaskTypes.USER);
    UserTaskExecutionSet executionSet = selfEvaluationTask.getExecutionSet();
    AssignmentsInfo assignmentsinfo = executionSet.getAssignmentsinfo();
    assertEquals(assignmentsinfo.getValue(), "|reason:com.test.Reason,Comment:Object,Skippable:Object||performance:Object|[din]reason->reason,[dout]performance->performance");
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) UserTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.UserTaskExecutionSet) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) Test(org.junit.Test)

Aggregations

UserTask (org.kie.workbench.common.stunner.bpmn.definition.UserTask)8 UserTaskExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.task.UserTaskExecutionSet)8 Test (org.junit.Test)6 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)6 Graph (org.kie.workbench.common.stunner.core.graph.Graph)6 View (org.kie.workbench.common.stunner.core.graph.content.view.View)5 FlowElement (org.eclipse.bpmn2.FlowElement)4 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)4 RootElement (org.eclipse.bpmn2.RootElement)4 Element (org.kie.workbench.common.stunner.core.graph.Element)4 AssignmentsInfo (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo)2 TaskGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet)2 Factories.bpmn2 (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2)1 UserTaskPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.UserTaskPropertyWriter)1 UserTaskPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.UserTaskPropertyReader)1 Groupid (org.kie.workbench.common.stunner.bpmn.definition.property.assignee.Groupid)1 Priority (org.kie.workbench.common.stunner.bpmn.definition.property.connectors.Priority)1 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)1 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)1 AdHocAutostart (org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocAutostart)1