Search in sources :

Example 1 with ServiceTaskPropertyReader

use of org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ServiceTaskPropertyReader in project kie-wb-common by kiegroup.

the class BaseTaskConverter method jbpmServiceTask.

private BpmnNode jbpmServiceTask(org.eclipse.bpmn2.Task task) {
    final ServiceTaskPropertyReader serviceTaskPropertyReader = propertyReaderFactory.ofCustom(task);
    final Node<View<CustomTask>, Edge> node = factoryManager.newNode(task.getId(), CustomTask.class);
    final CustomTask definition = node.getContent().getDefinition();
    definition.setName(serviceTaskPropertyReader.getServiceTaskName());
    definition.getTaskType().setRawType(serviceTaskPropertyReader.getServiceTaskName());
    definition.setDescription(serviceTaskPropertyReader.getServiceTaskDescription());
    definition.setCategory(serviceTaskPropertyReader.getServiceTaskCategory());
    definition.setDefaultHandler(serviceTaskPropertyReader.getServiceTaskDefaultHandler());
    definition.setGeneral(new TaskGeneralSet(new Name(serviceTaskPropertyReader.getName()), new Documentation(serviceTaskPropertyReader.getDocumentation())));
    definition.setDataIOSet(new DataIOSet(serviceTaskPropertyReader.getAssignmentsInfo()));
    definition.setExecutionSet(new CustomTaskExecutionSet(new TaskName(serviceTaskPropertyReader.getTaskName()), new IsAsync(serviceTaskPropertyReader.isAsync()), new AdHocAutostart(serviceTaskPropertyReader.isAdHocAutoStart()), new OnEntryAction(serviceTaskPropertyReader.getOnEntryAction()), new OnExitAction(serviceTaskPropertyReader.getOnExitAction()), new SLADueDate(serviceTaskPropertyReader.getSlaDueDate())));
    definition.setSimulationSet(serviceTaskPropertyReader.getSimulationSet());
    definition.setAdvancedData(new AdvancedData(serviceTaskPropertyReader.getMetaDataAttributes()));
    node.getContent().setBounds(serviceTaskPropertyReader.getBounds());
    definition.setDimensionsSet(serviceTaskPropertyReader.getRectangleDimensionsSet());
    definition.setBackgroundSet(serviceTaskPropertyReader.getBackgroundSet());
    definition.setFontSet(serviceTaskPropertyReader.getFontSet());
    return BpmnNode.of(node, serviceTaskPropertyReader);
}
Also used : ServiceTaskPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ServiceTaskPropertyReader) GenericServiceTaskPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.GenericServiceTaskPropertyReader) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) CustomTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.workitem.CustomTaskExecutionSet) TaskGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet) 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) DmnModelName(org.kie.workbench.common.stunner.bpmn.definition.property.task.DmnModelName) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) DecisionName(org.kie.workbench.common.stunner.bpmn.definition.property.task.DecisionName) TaskName(org.kie.workbench.common.stunner.bpmn.definition.property.task.TaskName) DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) SLADueDate(org.kie.workbench.common.stunner.bpmn.definition.property.general.SLADueDate) AdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData) TaskName(org.kie.workbench.common.stunner.bpmn.definition.property.task.TaskName) CustomTask(org.kie.workbench.common.stunner.bpmn.workitem.CustomTask) IsAsync(org.kie.workbench.common.stunner.bpmn.definition.property.task.IsAsync) Edge(org.kie.workbench.common.stunner.core.graph.Edge)

Example 2 with ServiceTaskPropertyReader

use of org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ServiceTaskPropertyReader in project kie-wb-common by kiegroup.

the class BaseTaskConverterTest method convertServiceTask.

@Test
public void convertServiceTask() {
    org.eclipse.bpmn2.ServiceTask task = mock(org.eclipse.bpmn2.ServiceTask.class);
    ServiceTaskPropertyReader serviceTaskPropertyReader = mock(ServiceTaskPropertyReader.class);
    CustomTask definition = new CustomTask();
    FeatureMap attributes = mock(FeatureMap.class);
    FeatureMap.Entry ruleAttr = mock(FeatureMap.Entry.class);
    EStructuralFeature ruleFeature = mock(EStructuralFeature.class);
    when(factoryManager.newNode(any(), eq(CustomTask.class))).thenReturn(serviceTaskNode);
    when(serviceTaskNode.getContent()).thenReturn(serviceTaskContent);
    when(serviceTaskContent.getDefinition()).thenReturn(definition);
    when(propertyReaderFactory.ofCustom(task)).thenReturn(serviceTaskPropertyReader);
    when(task.getAnyAttribute()).thenReturn(attributes);
    when(attributes.stream()).thenReturn(Stream.of(ruleAttr));
    when(ruleAttr.getEStructuralFeature()).thenReturn(ruleFeature);
    when(ruleAttr.getValue()).thenReturn("");
    when(ruleFeature.getName()).thenReturn(CustomAttribute.serviceImplementation.name());
    final BpmnNode converted = (BpmnNode) tested.convert(task).value();
    assertNotEquals(converted.value(), noneTaskNode);
    assertEquals(converted.value(), serviceTaskNode);
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) GenericServiceTaskPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.GenericServiceTaskPropertyReader) ServiceTaskPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ServiceTaskPropertyReader) EStructuralFeature(org.eclipse.emf.ecore.EStructuralFeature) BpmnNode(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode) CustomTask(org.kie.workbench.common.stunner.bpmn.workitem.CustomTask) Test(org.junit.Test)

Aggregations

GenericServiceTaskPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.GenericServiceTaskPropertyReader)2 ServiceTaskPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ServiceTaskPropertyReader)2 CustomTask (org.kie.workbench.common.stunner.bpmn.workitem.CustomTask)2 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)1 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)1 Test (org.junit.Test)1 BpmnNode (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode)1 DataIOSet (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet)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 SLADueDate (org.kie.workbench.common.stunner.bpmn.definition.property.general.SLADueDate)1 TaskGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet)1 AdHocAutostart (org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocAutostart)1 DecisionName (org.kie.workbench.common.stunner.bpmn.definition.property.task.DecisionName)1 DmnModelName (org.kie.workbench.common.stunner.bpmn.definition.property.task.DmnModelName)1 IsAsync (org.kie.workbench.common.stunner.bpmn.definition.property.task.IsAsync)1 OnEntryAction (org.kie.workbench.common.stunner.bpmn.definition.property.task.OnEntryAction)1 OnExitAction (org.kie.workbench.common.stunner.bpmn.definition.property.task.OnExitAction)1 TaskName (org.kie.workbench.common.stunner.bpmn.definition.property.task.TaskName)1 AdvancedData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData)1