Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.flowable.bpmn.converter.export.CollaborationExport;
import org.flowable.bpmn.converter.export.DataStoreExport;
import org.flowable.bpmn.converter.export.DefinitionsRootExport;
import org.flowable.bpmn.converter.export.ErrorDefinitionExport;
import org.flowable.bpmn.converter.export.EscalationDefinitionExport;
import org.flowable.bpmn.converter.export.FlowableListenerExport;
import org.flowable.bpmn.converter.export.MultiInstanceExport;
Expand Down Expand Up @@ -567,6 +568,7 @@ public byte[] convertToXML(BpmnModel model, String encoding) {
CollaborationExport.writePools(model, xtw);
DataStoreExport.writeDataStores(model, xtw);
SignalAndMessageDefinitionExport.writeSignalsAndMessages(model, xtw);
ErrorDefinitionExport.writeErrors(model, xtw);
EscalationDefinitionExport.writeEscalations(model, xtw);

for (Process process : model.getProcesses()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.flowable.bpmn.converter.export;

import java.util.Map;

import javax.xml.stream.XMLStreamWriter;

import org.apache.commons.lang3.StringUtils;
import org.flowable.bpmn.constants.BpmnXMLConstants;
import org.flowable.bpmn.model.BpmnModel;

public class ErrorDefinitionExport implements BpmnXMLConstants {

public static void writeErrors(BpmnModel model, XMLStreamWriter xtw) throws Exception {

for (Map.Entry<String, String> error : model.getErrors().entrySet()) {
xtw.writeStartElement(ELEMENT_ERROR);
xtw.writeAttribute(ATTRIBUTE_ID, error.getKey());
if (StringUtils.isNotEmpty(error.getValue())) {
xtw.writeAttribute(ATTRIBUTE_ERROR_CODE, error.getValue());
}
xtw.writeEndElement();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
package org.flowable.editor.language.xml;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.entry;
import static org.assertj.core.api.Assertions.tuple;

import org.flowable.bpmn.model.BoundaryEvent;
Expand All @@ -28,6 +29,8 @@ class BoundaryErrorEventConverterTest {

@BpmnXmlConverterTest("boundaryErrorEventWithInParameters.bpmn")
void validateErrorBoundaryWithInParameters(BpmnModel model) {
assertThat(model.getErrors()).containsExactly(entry("errorOne", "errorCodeOne"));

FlowElement flowElement = model.getFlowElement("theErrorBoundary");
assertThat(flowElement).isInstanceOfSatisfying(BoundaryEvent.class, event -> {
assertThat(event.getInParameters())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
id="_1384552647085" name="" targetNamespace="http://sourceforge.net/bpmn/definitions/_1384552647085"
typeLanguage="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL http://bpmn.sourceforge.net/schemas/BPMN20.xsd">
<error id="errorOne" name="Error One" errorCode="errorOne"/>
<error id="errorOne" name="Error One" errorCode="errorCodeOne"/>
<process id="testProcess" isExecutable="true" name="Test Process">
<startEvent id="theStart"/>
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="theTask"/>
Expand Down