Search in sources :

Example 1 with GenericServiceTask

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

the class AbstractDataTypeCacheTest method testExtractGenericServiceTask.

@Test
public void testExtractGenericServiceTask() {
    GenericServiceTask genericServiceTask = new GenericServiceTask();
    GenericServiceTask genericServiceTask2 = new GenericServiceTask();
    when(firstView.getDefinition()).thenReturn(genericServiceTask);
    when(lastView.getDefinition()).thenReturn(genericServiceTask2);
    dataTypeCache.extractFromItem(firstView);
    dataTypeCache.extractFromItem(lastView);
    assertTrue(dataTypeCache.allDataTypes.contains("MyType"));
    assertTrue(dataTypeCache.allDataTypes.contains("com.myspace.Person"));
}
Also used : GenericServiceTask(org.kie.workbench.common.stunner.bpmn.definition.GenericServiceTask) Test(org.junit.Test)

Example 2 with GenericServiceTask

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

the class GenericServiceTaskFilterProviderTest method newNonMultipleInstanceDefinition.

@Override
protected Object newNonMultipleInstanceDefinition() {
    GenericServiceTask task = new GenericServiceTask();
    task.getExecutionSet().getIsMultipleInstance().setValue(false);
    return task;
}
Also used : GenericServiceTask(org.kie.workbench.common.stunner.bpmn.definition.GenericServiceTask)

Example 3 with GenericServiceTask

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

the class GenericServiceTaskFilterProviderTest method newMultipleInstanceDefinition.

@Override
protected Object newMultipleInstanceDefinition() {
    GenericServiceTask task = new GenericServiceTask();
    task.getExecutionSet().getIsMultipleInstance().setValue(true);
    return task;
}
Also used : GenericServiceTask(org.kie.workbench.common.stunner.bpmn.definition.GenericServiceTask)

Example 4 with GenericServiceTask

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

the class TaskConverter method genericServiceTask.

private PropertyWriter genericServiceTask(Node<View<GenericServiceTask>, ?> n) {
    org.eclipse.bpmn2.ServiceTask task = bpmn2.createServiceTask();
    task.setId(n.getUUID());
    GenericServiceTask definition = n.getContent().getDefinition();
    GenericServiceTaskPropertyWriter p = propertyWriterFactory.of(task);
    TaskGeneralSet general = definition.getGeneral();
    GenericServiceTaskExecutionSet executionSet = definition.getExecutionSet();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    p.setAbsoluteBounds(n);
    p.setSimulationSet(definition.getSimulationSet());
    p.setValue(executionSet.getGenericServiceTaskInfo().getValue());
    p.setAsync(executionSet.getIsAsync().getValue());
    p.setAdHocAutostart(executionSet.getAdHocAutostart().getValue());
    if (Boolean.TRUE.equals(executionSet.getIsMultipleInstance().getValue())) {
        p.setIsSequential(executionSet.getMultipleInstanceExecutionMode().isSequential());
        p.setCollectionInput(executionSet.getMultipleInstanceCollectionInput().getValue());
        p.setInput(executionSet.getMultipleInstanceDataInput().getValue());
        p.setCollectionOutput(executionSet.getMultipleInstanceCollectionOutput().getValue());
        p.setOutput(executionSet.getMultipleInstanceDataOutput().getValue());
        p.setCompletionCondition(executionSet.getMultipleInstanceCompletionCondition().getValue());
    }
    p.setOnEntryAction(executionSet.getOnEntryAction());
    p.setOnExitAction(executionSet.getOnExitAction());
    p.setSLADueDate(executionSet.getSlaDueDate().getValue());
    p.setAssignmentsInfo(executionSet.getAssignmentsinfo());
    p.setMetaData(definition.getAdvancedData().getMetaDataAttributes());
    return p;
}
Also used : GenericServiceTaskPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.GenericServiceTaskPropertyWriter) GenericServiceTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskExecutionSet) GenericServiceTask(org.kie.workbench.common.stunner.bpmn.definition.GenericServiceTask) TaskGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet) Factories.bpmn2(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2)

Example 5 with GenericServiceTask

use of org.kie.workbench.common.stunner.bpmn.definition.GenericServiceTask 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)

Aggregations

GenericServiceTask (org.kie.workbench.common.stunner.bpmn.definition.GenericServiceTask)8 Test (org.junit.Test)3 GenericServiceTaskPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.GenericServiceTaskPropertyReader)2 TaskGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet)2 GenericServiceTaskExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskExecutionSet)2 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)1 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)1 Factories.bpmn2 (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2)1 GenericServiceTaskPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.GenericServiceTaskPropertyWriter)1 BpmnNode (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode)1 AdHocSubprocess (org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess)1 BPMNDiagramImpl (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl)1 BusinessRuleTask (org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask)1 DataObject (org.kie.workbench.common.stunner.bpmn.definition.DataObject)1 EmbeddedSubprocess (org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess)1 EndErrorEvent (org.kie.workbench.common.stunner.bpmn.definition.EndErrorEvent)1 EndEscalationEvent (org.kie.workbench.common.stunner.bpmn.definition.EndEscalationEvent)1 EndMessageEvent (org.kie.workbench.common.stunner.bpmn.definition.EndMessageEvent)1 EndSignalEvent (org.kie.workbench.common.stunner.bpmn.definition.EndSignalEvent)1 EventSubprocess (org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess)1