[BPMN2] Using the BPMN2 editor XML as input for ATL [message #549320] |
Mon, 26 July 2010 09:11  |
Eclipse User |
|
|
|
Hi all,
I'm defnining a transformation in ATL, which uses the BPMN2 metamodel as source.
I'd like to use the output XML from the BPMN2 editor as input for the ATL transformation. This does however not work. The output XML from the editor looks like this (conforming the BPMN2 xsd schema):
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI" id="sid-Definitions">
<bpmn2:process id="sid-Process">
<bpmn2:startEvent id="sid-StartEvent">
<bpmn2:outgoing>sid-SF1</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:task id="sid-Task">
<bpmn2:incoming>sid-SF1</bpmn2:incoming>
<bpmn2:outgoing>sid-SF2</bpmn2:outgoing>
</bpmn2:task>
<bpmn2:endEvent id="sid-EndEvent">
<bpmn2:incoming>sid-SF2</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:sequenceFlow id="sid-SF1" sourceRef="sid-StartEvent" targetRef="sid-Task"/>
<bpmn2:sequenceFlow id="sid-SF2" sourceRef="sid-Task" targetRef="sid-EndEvent"/>
</bpmn2:process>
</bpmn2:definitions>
This does conform to the BPMN metamodel, however, this is not excepted by ATL, because "definitions", "task", etc. ain't classes defined in the metamodel (rather they are attributes). A valid XML format accepted by ATL is the following:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns="platform:/resource/Cent2Decent/BPMN.ecore">
<Definitions id="Process1" xmi:id="Process1">
<rootElements xmi:type="Process" id="sid-Process" name="Process1" xmi:id="sid-Process">
<flowElements xmi:type="Task" name="Task1" id="sid-Task1" xmi:id="sid-Task"/>
<flowElements xmi:type="StartEvent" name="StartEvent" id="sid-StartEvent" xmi:id="sid-StartEvent"/>
<flowElements xmi:type="EndEvent" name="EndEvent" id="sid-EndEvent" xmi:id="sid-EndEvent"/>
<flowElements xmi:type="SequenceFlow" name="SF1" id="sid-SF1" sourceRef="sid-StartEvent" targetRef="sid-Task1" xmi:id="sid-SF1"/>
<flowElements xmi:type="SequenceFlow" name="SF2" id="sid-SF2" sourceRef="sid-Task1" targetRef="sid-EndEvent" xmi:id="sid-SF2"/>
</rootElements>
</TDefinitions>
</xmi:XMI>
Is there a way to switch between the two representations? Or is there a way to load the first XML file directly in ATL?
|
|
|
|
Re: [BPMN2] Using the BPMN2 editor XML as input for ATL [message #551942 is a reply to message #549320] |
Tue, 10 August 2010 05:05  |
Eclipse User |
|
|
|
Hi Peter,
the MDT BPMN2 project supports both official file formats: XML (accrording to the OMG schema) and XMI (according to CMOF Metamodel).
The editor by default saves in XML format, as we consider it to be used more frequently. However, the editor has a "Save as" functionality. "Use File->Save as" and enter a file name with ".xmi" extension - then the file will appear in XMI format.
The code that does the conversion is rather simple - quoting now from BPMNEditor.java:
protected void doSaveAs(URI uri, IEditorInput editorInput) {
if (uri.toString().endsWith("xmi")) {
Resource oldResource = editingDomain.getResourceSet().getResources().get(0);
XMIResource newResource = new XMIResourceImpl();
editingDomain.getResourceSet().getResources().add(newResourc e);
newResource.setURI(uri);
List<EObject> content = new ArrayList<EObject>(oldResource.getContents());
for (EObject eObject : content) {
if (eObject.eClass().getName().equals("DocumentRoot")) {
newResource.getContents().addAll(eObject.eContents());
} else {
newResource.getContents().add(eObject);
}
}
oldResource.unload();
editingDomain.getResourceSet().getResources().remove(oldReso urce);
} else {
(editingDomain.getResourceSet().getResources().get(0)).setUR I(uri);
}
setInputWithNotify(editorInput);
setPartName(editorInput.getName());
IProgressMonitor progressMonitor = getActionBars().getStatusLineManager() != null ? getActionBars()
.getStatusLineManager().getProgressMonitor() : new NullProgressMonitor();
doSave(progressMonitor);
}
|
|
|
Powered by
FUDForum. Page generated in 0.03139 seconds