Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of isMarkerVisible at ExclusiveGateway according to BPMN 2.0 #3393

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ public interface BpmnXMLConstants {
public static final String ELEMENT_GATEWAY_INCLUSIVE = "inclusiveGateway";
public static final String ELEMENT_GATEWAY_PARALLEL = "parallelGateway";
public static final String ELEMENT_GATEWAY_COMPLEX = "complexGateway";
public static final String ATTRIBUTE_GATEWAY_EXCLUSIVE_ISMARKERVISIBLE = "isMarkerVisible";

public static final String ELEMENT_EVENT_START = "startEvent";
public static final String ELEMENT_EVENT_END = "endEvent";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,27 @@
*/
package org.flowable.bpmn.converter;

import java.util.Arrays;
import java.util.List;

import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;

import org.flowable.bpmn.converter.util.BpmnXMLUtil;
import org.flowable.bpmn.model.BaseElement;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.ExclusiveGateway;
import org.flowable.bpmn.model.ExtensionAttribute;

/**
* @author Tijs Rademakers
*/
public class ExclusiveGatewayXMLConverter extends BaseBpmnXMLConverter {

/** default attributes taken from bpmn spec and from extension namespace */
protected static final List<ExtensionAttribute> defaultExclusiveGatewayAttributes = Arrays.asList(
new ExtensionAttribute(ATTRIBUTE_GATEWAY_EXCLUSIVE_ISMARKERVISIBLE));

@Override
public Class<? extends BaseElement> getBpmnElementType() {
return ExclusiveGateway.class;
Expand All @@ -41,14 +49,20 @@ protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model)
ExclusiveGateway gateway = new ExclusiveGateway();
BpmnXMLUtil.addXMLLocation(gateway, xtr);

BpmnXMLUtil.addCustomAttributes(xtr, gateway, defaultElementAttributes, defaultActivityAttributes);
gateway.setMarkerVisible(Boolean.valueOf(BpmnXMLUtil.getAttributeValue(ATTRIBUTE_GATEWAY_EXCLUSIVE_ISMARKERVISIBLE, xtr)));

BpmnXMLUtil.addCustomAttributes(xtr, gateway, defaultElementAttributes, defaultActivityAttributes, defaultExclusiveGatewayAttributes);

parseChildElements(getXMLElementName(), gateway, model, xtr);
return gateway;
}

@Override
protected void writeAdditionalAttributes(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
ExclusiveGateway gateway = (ExclusiveGateway) element;
if (gateway.isMarkerVisible()) {
writeQualifiedAttribute(ATTRIBUTE_GATEWAY_EXCLUSIVE_ISMARKERVISIBLE, "true", xtw);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
*/
public class ExclusiveGateway extends Gateway {

protected boolean markerVisible;

public boolean isMarkerVisible() {
return markerVisible;
}

public void setMarkerVisible(boolean markerVisible) {
this.markerVisible = markerVisible;
}

@Override
public ExclusiveGateway clone() {
ExclusiveGateway clone = new ExclusiveGateway();
Expand All @@ -26,5 +36,6 @@ public ExclusiveGateway clone() {

public void setValues(ExclusiveGateway otherElement) {
super.setValues(otherElement);
setMarkerVisible(otherElement.isMarkerVisible());
}
}