Hello,
I want to create xml with input/output parameters.
I am using this code at java and how can I add input/output parameters before to create xml.
public String updateServiceTaskModel(ServiceTaskModelDto input) {
input.setXml(checkAndAddAttribute(input.getXml()));
ByteArrayInputStream byteArrayInputStream = null;
try {
byteArrayInputStream = new ByteArrayInputStream(input.getXml().getBytes(UTF8));
} catch (Exception e) {
throw new BusinessValidationException(“M001”, “can.not.get.xml.input.stream”, e.getMessage());
}BpmnModelInstance modelInstance = Bpmn.readModelFromStream(byteArrayInputStream); ServiceTask serviceTask = modelInstance.getModelElementById(input.getOldServiceTaskName()); Collection<Process> processes = modelInstance.getDefinitions().getChildElementsByType(Process.class); Process process = processes.iterator().next(); Definitions definitions = modelInstance.getDefinitions(); BpmnDiagram diagram = modelInstance.getDefinitions().getBpmDiagrams().iterator().next(); BpmnPlane plane = diagram.getBpmnPlane(); ModelElementInstance modelElement = modelInstance.getModelElementById(input.getOldServiceTaskName()); process.removeChildElement(modelElement); plane.setBpmnElement(process); diagram.setBpmnPlane(plane); definitions.addChildElement(diagram); ServiceTask task = createElement(modelInstance, process, input.getServiceTaskName().toLowerCase(), GENERALSERVICEMODEL, ServiceTask.class, plane, ThreadLocalRandom.current().nextDouble(MIN_POSITION, MAX_POSITION), ThreadLocalRandom.current().nextDouble(MIN_POSITION, MAX_POSITION), MODEL_BOUND_HEIGTH, MODEL_BOUND_WIDTH, true); task.setName(input.getServiceTaskName()); task.setImplementation(JAVACLASS); task.setCamundaClass(input.getServiceTaskClassQualifiedName()); process.addChildElement(task); process.setExecutable(true); Bpmn.validateModel(modelInstance); return Bpmn.convertToString(modelInstance);
}
thank you.