use of org.eclipse.bpmn2.FlowElement in project kie-wb-common by kiegroup.
the class GenericServiceTaskTest method marshallServiceTask.
@Test
public void marshallServiceTask() throws Exception {
Diagram<Graph, Metadata> d = unmarshall(marshaller, BPMN_FILE_PATH);
DefinitionsConverter definitionsConverter = new DefinitionsConverter(d.getGraph());
Definitions definitions = definitionsConverter.toDefinitions();
Process p = (Process) definitions.getRootElements().get(0);
assertEquals(ServiceTaskImpl.class, p.getFlowElements().stream().filter(e -> e.getId().equals(TASK_ID)).findFirst().get().getClass());
org.eclipse.bpmn2.ServiceTask flowElement = (org.eclipse.bpmn2.ServiceTask) p.getFlowElements().stream().filter(e -> e.getId().equals(TASK_ID)).findFirst().get();
assertEquals("Service", flowElement.getName());
assertEquals("op", flowElement.getOperationRef().getName());
assertEquals("Java", CustomAttribute.serviceImplementation.of(flowElement).get());
assertEquals("op", CustomAttribute.serviceOperation.of(flowElement).get());
assertEquals("hgfhfgh", CustomAttribute.serviceInterface.of(flowElement).get());
}
use of org.eclipse.bpmn2.FlowElement in project kie-wb-common by kiegroup.
the class Processes method addChildElement.
static void addChildElement(BasePropertyWriter p, Map<String, BasePropertyWriter> childElements, FlowElementsContainer process, Collection<ElementParameters> simulationParameters, List<ItemDefinition> itemDefinitions, List<RootElement> rootElements) {
childElements.put(p.getElement().getId(), p);
if (p.getElement() instanceof FlowElement) {
// otherwise they will be drawn at an incorrect position on load
if ((p instanceof BoundaryEventPropertyWriter) || (p instanceof DataObjectPropertyWriter)) {
process.getFlowElements().add((FlowElement) p.getElement());
} else {
process.getFlowElements().add(0, (FlowElement) p.getElement());
}
} else if (p.getElement() instanceof Artifact) {
if (process instanceof Process) {
((Process) process).getArtifacts().add((Artifact) p.getElement());
} else if (process instanceof SubProcess) {
((SubProcess) process).getArtifacts().add((Artifact) p.getElement());
}
}
if (p instanceof PropertyWriter) {
ElementParameters sp = ((PropertyWriter) p).getSimulationParameters();
if (sp != null) {
simulationParameters.add(sp);
}
}
itemDefinitions.addAll(p.getItemDefinitions());
rootElements.addAll(p.getRootElements());
rootElements.addAll(p.getInterfaces());
if (p instanceof DataObjectPropertyWriter) {
maybeAddDataObjects(process, ((DataObjectPropertyWriter) p).getDataObjects());
}
}
Aggregations