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);
}
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);
}
Aggregations