Search in sources :

Example 1 with GenericServiceTaskPropertyReader

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

the class BaseTaskConverterTest method convertGenericServiceTask.

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

Example 2 with GenericServiceTaskPropertyReader

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

the class BaseTaskConverter method bpmnServiceTask.

BpmnNode bpmnServiceTask(org.eclipse.bpmn2.ServiceTask task) {
    Node<View<GenericServiceTask>, Edge> node = factoryManager.newNode(task.getId(), GenericServiceTask.class);
    GenericServiceTask definition = node.getContent().getDefinition();
    GenericServiceTaskPropertyReader p = propertyReaderFactory.of(task);
    if (p == null) {
        throw new NullPointerException(task.getClass().getCanonicalName());
    }
    definition.setGeneral(new TaskGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
    definition.setExecutionSet(new GenericServiceTaskExecutionSet(new GenericServiceTaskInfo(p.getGenericServiceTask()), p.getAssignmentsInfo(), new AdHocAutostart(p.isAdHocAutostart()), new IsAsync(p.isAsync()), new IsMultipleInstance(p.isMultipleInstance()), new MultipleInstanceExecutionMode(p.isSequential()), new MultipleInstanceCollectionInput(p.getCollectionInput()), new MultipleInstanceDataInput(p.getDataInput()), new MultipleInstanceCollectionOutput(p.getCollectionOutput()), new MultipleInstanceDataOutput(p.getDataOutput()), new MultipleInstanceCompletionCondition(p.getCompletionCondition()), new OnEntryAction(p.getOnEntryAction()), new OnExitAction(p.getOnExitAction()), new SLADueDate(p.getSLADueDate())));
    node.getContent().setBounds(p.getBounds());
    definition.setDimensionsSet(p.getRectangleDimensionsSet());
    definition.setBackgroundSet(p.getBackgroundSet());
    definition.setFontSet(p.getFontSet());
    definition.setSimulationSet(p.getSimulationSet());
    definition.setAdvancedData(new AdvancedData(p.getMetaDataAttributes()));
    return BpmnNode.of(node, p);
}
Also used : GenericServiceTaskInfo(org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskInfo) GenericServiceTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskExecutionSet) GenericServiceTask(org.kie.workbench.common.stunner.bpmn.definition.GenericServiceTask) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) MultipleInstanceCollectionOutput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionOutput) 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) SLADueDate(org.kie.workbench.common.stunner.bpmn.definition.property.general.SLADueDate) AdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData) MultipleInstanceCompletionCondition(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCompletionCondition) IsMultipleInstance(org.kie.workbench.common.stunner.bpmn.definition.property.task.IsMultipleInstance) MultipleInstanceCollectionInput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionInput) MultipleInstanceExecutionMode(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceExecutionMode) MultipleInstanceDataInput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceDataInput) GenericServiceTaskPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.GenericServiceTaskPropertyReader) IsAsync(org.kie.workbench.common.stunner.bpmn.definition.property.task.IsAsync) Edge(org.kie.workbench.common.stunner.core.graph.Edge) MultipleInstanceDataOutput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceDataOutput)

Aggregations

GenericServiceTaskPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.GenericServiceTaskPropertyReader)2 GenericServiceTask (org.kie.workbench.common.stunner.bpmn.definition.GenericServiceTask)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 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 GenericServiceTaskExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskExecutionSet)1 GenericServiceTaskInfo (org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskInfo)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 IsMultipleInstance (org.kie.workbench.common.stunner.bpmn.definition.property.task.IsMultipleInstance)1 MultipleInstanceCollectionInput (org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionInput)1 MultipleInstanceCollectionOutput (org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionOutput)1 MultipleInstanceCompletionCondition (org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCompletionCondition)1