Hi Bob
Since currently I can not use the BPMN2 modeler on the server side, I use the org.eclipse.bpmn2.util.Bpmn2ResourceImpl from the "bpmn2" repository.
I noticed that if I load and store a BPMN2 diagram (designed in the BPMN2Modeler) on the server, I get a different output then my original modeler input.
One point is discussed here: https://www.eclipse.org/forums/index.php/m/1691906/
The next change that I noticed is the style is changed.
This is the original coming from the modeler:
<bpmn2:task id="Task_1" name="Task 1">
<bpmn2:extensionElements>
<ext:style ext:shapeBackground="#8000ff"/>
</bpmn2:extensionElements>
</bpmn2:task>
after I store it on the server I get:
<bpmn2:task id="Task_2" name="Task 1">
<bpmn2:extensionElements>
<ext:style xsi:type="tl:anyType" ext:shapeBackground="#8000ff"/>
</bpmn2:extensionElements>
</bpmn2:task>
This is bad because loading this back into the modeler, the style is not recognized/applied to the element.
After debugging I found out that this would solve the problem:
resource.getDefaultSaveOptions().put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, false);
// OR
resource.getDefaultSaveOptions().put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true);
What I don't know is if this will cause other problems since in org.eclipse.bpmn2.util.Bpmn2ResourceFactoryImpl.createResource(URI) the option is set like this:
result.getDefaultSaveOptions().put(XMLResource.OPTION_SAVE_TYPE_INFORMATION,
new OnlyContainmentTypeInfo());
I'm suspecting a bug since the original XMLTypeInfo in org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.init(XMLResource, Map<?, ?>) does not save "anyType". Maybe OnlyContainmentTypeInfo should be extended with the default behavior?
xmlTypeInfo =
new XMLTypeInfo()
{
public boolean shouldSaveType(EClass objectType, EClassifier featureType, EStructuralFeature feature)
{
return objectType != anyType;
}
public boolean shouldSaveType(EClass objectType, EClass featureType, EStructuralFeature feature)
{
return true;
}
};
What do you think is this a bug? Should I implement the default behavior into the OnlyContainmentTypeInfo?
greets
Flavio