if (activeProcess != null) { BaseBpmnXMLConverter converter = convertersToBpmnMap.get(xtr.getLocalName()); converter.convertToBpmnModel(xtr, model, activeProcess, activeSubProcessList);
protected void createXML(Artifact artifact, BpmnModel model, XMLStreamWriter xtw) throws Exception { BaseBpmnXMLConverter converter = convertersToXMLMap.get(artifact.getClass()); if (converter == null) { throw new XMLException("No converter for " + artifact.getClass() + " found"); } converter.convertToXML(xtw, artifact, model); } }
boolean async = parseAsync(xtr); boolean notExclusive = parseNotExclusive(xtr); String defaultFlow = xtr.getAttributeValue(null, ATTRIBUTE_DEFAULT); boolean isForCompensation = parseForCompensation(xtr); BaseElement parsedElement = convertXMLToElement(xtr, model);
public void convertToXML(XMLStreamWriter xtw, BaseElement baseElement, BpmnModel model) throws Exception { xtw.writeStartElement(getXMLElementName()); boolean didWriteExtensionStartElement = false; writeDefaultAttribute(ATTRIBUTE_ID, baseElement.getId(), xtw); if (baseElement instanceof FlowElement) { writeDefaultAttribute(ATTRIBUTE_NAME, ((FlowElement) baseElement).getName(), xtw); final FlowNode flowNode = (FlowNode) baseElement; if (flowNode.isAsynchronous()) { writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_ASYNCHRONOUS, ATTRIBUTE_VALUE_TRUE, xtw); if (flowNode.isNotExclusive()) { writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_EXCLUSIVE, ATTRIBUTE_VALUE_FALSE, xtw); final Activity activity = (Activity) baseElement; if (activity.isForCompensation()) { writeDefaultAttribute(ATTRIBUTE_ACTIVITY_ISFORCOMPENSATION, ATTRIBUTE_VALUE_TRUE, xtw); writeDefaultAttribute(ATTRIBUTE_DEFAULT, activity.getDefaultFlow(), xtw); FlowElement defaultFlowElement = model.getFlowElement(gateway.getDefaultFlow()); if (defaultFlowElement instanceof SequenceFlow) { writeDefaultAttribute(ATTRIBUTE_DEFAULT, gateway.getDefaultFlow(), xtw); writeAdditionalAttributes(baseElement, model, xtw); didWriteExtensionStartElement = writeExtensionChildElements(baseElement, didWriteExtensionStartElement, xtw); didWriteExtensionStartElement = writeListeners(baseElement, didWriteExtensionStartElement, xtw); didWriteExtensionStartElement = BpmnXMLUtil.writeExtensionElements(baseElement, didWriteExtensionStartElement, model.getNamespaces(), xtw); if (baseElement instanceof Activity) {
protected void writeCompensateDefinition(Event parentEvent, CompensateEventDefinition compensateEventDefinition, XMLStreamWriter xtw) throws Exception { xtw.writeStartElement(ELEMENT_EVENT_COMPENSATEDEFINITION); writeDefaultAttribute(ATTRIBUTE_COMPENSATE_ACTIVITYREF, compensateEventDefinition.getActivityRef(), xtw); boolean didWriteExtensionStartElement = BpmnXMLUtil.writeExtensionElements(compensateEventDefinition, false, xtw); if (didWriteExtensionStartElement) { xtw.writeEndElement(); } xtw.writeEndElement(); }
public static void addConverter(BaseBpmnXMLConverter converter, Class<? extends BaseElement> elementType) { convertersToBpmnMap.put(converter.getXMLElementName(), converter); convertersToXMLMap.put(elementType, converter); }
xtw.writeStartElement(getXMLElementName()); didWriteExtensionStartElement = false; writeDefaultAttribute(ATTRIBUTE_ID, baseElement.getId(), xtw); if (baseElement instanceof FlowElement) { writeDefaultAttribute(ATTRIBUTE_NAME, ((FlowElement) baseElement).getName(), xtw); final Activity activity = (Activity) baseElement; if (activity.isAsynchronous()) { writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_ASYNCHRONOUS, ATTRIBUTE_VALUE_TRUE, xtw); writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_EXCLUSIVE, ATTRIBUTE_VALUE_FALSE, xtw); writeDefaultAttribute(ATTRIBUTE_DEFAULT, activity.getDefaultFlow(), xtw); writeDefaultAttribute(ATTRIBUTE_DEFAULT, gateway.getDefaultFlow(), xtw); writeAdditionalAttributes(baseElement, xtw); writeExtensionChildElements(baseElement, xtw); didWriteExtensionStartElement = writeListeners(baseElement, xtw); if (didWriteExtensionStartElement) { xtw.writeEndElement(); writeAdditionalChildElements(baseElement, xtw);
protected void writeErrorDefinition(Event parentEvent, ErrorEventDefinition errorDefinition, XMLStreamWriter xtw) throws Exception { xtw.writeStartElement(ELEMENT_EVENT_ERRORDEFINITION); writeDefaultAttribute(ATTRIBUTE_ERROR_REF, errorDefinition.getErrorCode(), xtw); boolean didWriteExtensionStartElement = BpmnXMLUtil.writeExtensionElements(errorDefinition, false, xtw); if (didWriteExtensionStartElement) { xtw.writeEndElement(); } xtw.writeEndElement(); }
public static void addConverter(BaseBpmnXMLConverter converter, Class<? extends BaseElement> elementType) { convertersToBpmnMap.put(converter.getXMLElementName(), converter); convertersToXMLMap.put(elementType, converter); }
public void convertToXML(XMLStreamWriter xtw, BaseElement baseElement, BpmnModel model) throws Exception { xtw.writeStartElement(getXMLElementName()); boolean didWriteExtensionStartElement = false; writeDefaultAttribute(ATTRIBUTE_ID, baseElement.getId(), xtw); if (baseElement instanceof FlowElement) { writeDefaultAttribute(ATTRIBUTE_NAME, ((FlowElement) baseElement).getName(), xtw); final FlowNode flowNode = (FlowNode) baseElement; if (flowNode.isAsynchronous()) { writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_ASYNCHRONOUS, ATTRIBUTE_VALUE_TRUE, xtw); if (flowNode.isNotExclusive()) { writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_EXCLUSIVE, ATTRIBUTE_VALUE_FALSE, xtw); final Activity activity = (Activity) baseElement; if (activity.isForCompensation()) { writeDefaultAttribute(ATTRIBUTE_ACTIVITY_ISFORCOMPENSATION, ATTRIBUTE_VALUE_TRUE, xtw); writeDefaultAttribute(ATTRIBUTE_DEFAULT, activity.getDefaultFlow(), xtw); FlowElement defaultFlowElement = model.getFlowElement(gateway.getDefaultFlow()); if (defaultFlowElement instanceof SequenceFlow) { writeDefaultAttribute(ATTRIBUTE_DEFAULT, gateway.getDefaultFlow(), xtw); writeAdditionalAttributes(baseElement, model, xtw); didWriteExtensionStartElement = writeExtensionChildElements(baseElement, didWriteExtensionStartElement, xtw); didWriteExtensionStartElement = writeListeners(baseElement, didWriteExtensionStartElement, xtw); didWriteExtensionStartElement = BpmnXMLUtil.writeExtensionElements(baseElement, didWriteExtensionStartElement, model.getNamespaces(), xtw); if (baseElement instanceof Activity) {
boolean async = parseAsync(xtr); boolean notExclusive = parseNotExclusive(xtr); String defaultFlow = xtr.getAttributeValue(null, ATTRIBUTE_DEFAULT); boolean isForCompensation = parseForCompensation(xtr); BaseElement parsedElement = convertXMLToElement(xtr); currentArtifact.setId(elementId); if (isInSubProcess(activeSubProcessList)) { final SubProcess currentSubProcess = activeSubProcessList.get(activeSubProcessList.size() - 2); currentSubProcess.addArtifact(currentArtifact);
protected void writeSignalDefinition(Event parentEvent, SignalEventDefinition signalDefinition, XMLStreamWriter xtw) throws Exception { xtw.writeStartElement(ELEMENT_EVENT_SIGNALDEFINITION); writeDefaultAttribute(ATTRIBUTE_SIGNAL_REF, signalDefinition.getSignalRef(), xtw); if (parentEvent instanceof ThrowEvent && signalDefinition.isAsync()) { BpmnXMLUtil.writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_ASYNCHRONOUS, "true", xtw); } boolean didWriteExtensionStartElement = BpmnXMLUtil.writeExtensionElements(signalDefinition, false, xtw); if (didWriteExtensionStartElement) { xtw.writeEndElement(); } xtw.writeEndElement(); }
converter.convertToXML(xtw, flowElement, model);
if (activeProcess != null) { BaseBpmnXMLConverter converter = convertersToBpmnMap.get(xtr.getLocalName()); converter.convertToBpmnModel(xtr, model, activeProcess, activeSubProcessList);
boolean async = parseAsync(xtr); boolean notExclusive = parseNotExclusive(xtr); String defaultFlow = xtr.getAttributeValue(null, ATTRIBUTE_DEFAULT); boolean isForCompensation = parseForCompensation(xtr); BaseElement parsedElement = convertXMLToElement(xtr, model);
writeDefaultAttribute(ATTRIBUTE_FORM_ID, property.getId(), xtw); writeDefaultAttribute(ATTRIBUTE_FORM_NAME, property.getName(), xtw); writeDefaultAttribute(ATTRIBUTE_FORM_TYPE, property.getType(), xtw); writeDefaultAttribute(ATTRIBUTE_FORM_EXPRESSION, property.getExpression(), xtw); writeDefaultAttribute(ATTRIBUTE_FORM_VARIABLE, property.getVariable(), xtw); writeDefaultAttribute(ATTRIBUTE_FORM_DEFAULT, property.getDefaultExpression(), xtw); writeDefaultAttribute(ATTRIBUTE_FORM_DATEPATTERN, property.getDatePattern(), xtw); if (!property.isReadable()) { writeDefaultAttribute(ATTRIBUTE_FORM_READABLE, ATTRIBUTE_VALUE_FALSE, xtw); writeDefaultAttribute(ATTRIBUTE_FORM_WRITABLE, ATTRIBUTE_VALUE_FALSE, xtw); writeDefaultAttribute(ATTRIBUTE_FORM_REQUIRED, ATTRIBUTE_VALUE_TRUE, xtw);
private void createXML(Artifact artifact, BpmnModel model, XMLStreamWriter xtw) throws Exception { Class<? extends BaseBpmnXMLConverter> converter = convertersToXMLMap.get(artifact.getClass()); if (converter == null) { throw new XMLException("No converter for " + artifact.getClass() + " found"); } converter.newInstance().convertToXML(xtw, artifact, model); } }
converter.convertToBpmnModel(xtr, model, activeProcess, activeSubProcessList);
protected void writeMessageDefinition(Event parentEvent, MessageEventDefinition messageDefinition, BpmnModel model, XMLStreamWriter xtw) throws Exception { xtw.writeStartElement(ELEMENT_EVENT_MESSAGEDEFINITION); String messageRef = messageDefinition.getMessageRef(); if (StringUtils.isNotEmpty(messageRef)) { // remove the namespace from the message id if set if (messageRef.startsWith(model.getTargetNamespace())) { messageRef = messageRef.replace(model.getTargetNamespace(), ""); messageRef = messageRef.replaceFirst(":", ""); } else { for (String prefix : model.getNamespaces().keySet()) { String namespace = model.getNamespace(prefix); if (messageRef.startsWith(namespace)) { messageRef = messageRef.replace(model.getTargetNamespace(), ""); messageRef = prefix + messageRef; } } } } writeDefaultAttribute(ATTRIBUTE_MESSAGE_REF, messageRef, xtw); boolean didWriteExtensionStartElement = BpmnXMLUtil.writeExtensionElements(messageDefinition, false, xtw); if (didWriteExtensionStartElement) { xtw.writeEndElement(); } xtw.writeEndElement(); }
protected void createXML(Artifact artifact, BpmnModel model, XMLStreamWriter xtw) throws Exception { BaseBpmnXMLConverter converter = convertersToXMLMap.get(artifact.getClass()); if (converter == null) { throw new XMLException("No converter for " + artifact.getClass() + " found"); } converter.convertToXML(xtw, artifact, model); } }