Search in sources :

Example 6 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 testUnmarshallUserTaskProperties.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallUserTaskProperties() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKPROPERTIES);
    assertDiagram(diagram, 4);
    assertEquals("MyBP", diagram.getMetadata().getTitle());
    UserTaskExecutionSet userTaskExecutionSet = 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;
                userTaskExecutionSet = userTask.getExecutionSet();
                break;
            }
        }
    }
    assertEquals("MyUserTask", userTaskExecutionSet.getTaskName().getValue());
    assertEquals("true", userTaskExecutionSet.getIsAsync().getValue().toString());
    assertEquals("false", userTaskExecutionSet.getSkippable().getValue().toString());
    assertEquals("my subject", userTaskExecutionSet.getSubject().getValue());
    assertEquals("admin", userTaskExecutionSet.getCreatedBy().getValue());
    assertEquals("my description", userTaskExecutionSet.getDescription().getValue());
    assertEquals("3", userTaskExecutionSet.getPriority().getValue());
    assertEquals("true", userTaskExecutionSet.getAdHocAutostart().getValue().toString());
    assertEquals("System.out.println(\"Hello\");", userTaskExecutionSet.getOnEntryAction().getValue().getValues().get(0).getScript());
    assertEquals("java", userTaskExecutionSet.getOnEntryAction().getValue().getValues().get(0).getLanguage());
    assertEquals("System.out.println(\"Bye\");", userTaskExecutionSet.getOnExitAction().getValue().getValues().get(0).getScript());
    assertEquals("java", userTaskExecutionSet.getOnExitAction().getValue().getValues().get(0).getLanguage());
}
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 7 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 testUnmarshallUserTaskProperties.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallUserTaskProperties() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKPROPERTIES);
    assertDiagram(diagram, 4);
    assertEquals("MyBP", diagram.getMetadata().getTitle());
    UserTaskExecutionSet userTaskExecutionSet = 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;
                userTaskExecutionSet = userTask.getExecutionSet();
                break;
            }
        }
    }
    assertEquals("MyUserTask", userTaskExecutionSet.getTaskName().getValue());
    assertEquals("true", userTaskExecutionSet.getIsAsync().getValue().toString());
    assertEquals("false", userTaskExecutionSet.getSkippable().getValue().toString());
    assertEquals("my subject", userTaskExecutionSet.getSubject().getValue());
    assertEquals("admin", userTaskExecutionSet.getCreatedBy().getValue());
    assertEquals("my description", userTaskExecutionSet.getDescription().getValue());
    assertEquals("3", userTaskExecutionSet.getPriority().getValue());
    assertEquals("true", userTaskExecutionSet.getAdHocAutostart().getValue().toString());
    assertEquals("System.out.println(\"Hello\");", userTaskExecutionSet.getOnEntryAction().getValue().getValues().get(0).getScript());
    assertEquals("java", userTaskExecutionSet.getOnEntryAction().getValue().getValues().get(0).getLanguage());
    assertEquals("System.out.println(\"Bye\");", userTaskExecutionSet.getOnExitAction().getValue().getValues().get(0).getScript());
    assertEquals("java", userTaskExecutionSet.getOnExitAction().getValue().getValues().get(0).getLanguage());
}
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 8 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 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)

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