[BPMN2] extending attribute of Process node [message #653921] |
Fri, 11 February 2011 15:57  |
Eclipse User |
|
|
|
I was wondering how to add custom attributes do node types. For my app I need to have for example:
<bpmn2:process id="_zoxqUDVBEeCqf5cJFwvEIg" name="myProcess" packageName="myPackage">
the packageName attribute is specific for my use only, however I am struggling to find out how to achieve this without going all the way back to the bpmn.ecore and adding a new property etc...and also cannot find any examples on maybe creating an extension only for the Process node. Is this possible?
Thanks in advance for any input!
[Updated on: Fri, 11 February 2011 15:58] by Moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: [BPMN2] extending attribute of Process node [message #1005114 is a reply to message #697152] |
Thu, 24 January 2013 08:53  |
Eclipse User |
|
|
|
Sorry for reviving this old thread.
But I still get trouble with the XML namespace prefix.
With the code:
EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
"www.mycompany.com/myns", "style", true, false);
I got the following XML File:
<definitions [...] xmlns:myns="www.mycompany.com/myns" [...]>
[...]
<myns:extensionElement>
[...]
</myns:extensionElement>
[...]
But I need the following output:
<definitions [...] xmlns:myns="www.mycompany.com" [...]>
[...]
<myns:extensionElement>
[...]
</myns:extensionElement>
[...]
Is there an easy way to archive this?
I tried to create and register a separated ecore file with my desired ns prefix and ns uri. Seems to have no effect at all...
The ecore registration code:
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
ResourceSet rs = new ResourceSetImpl();
final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(rs.getPackageRegistry());
rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
URI test = URI.createFileURI(new File("file.ecore").getAbsolutePath());
Resource r = rs.getResource(test, true);
EObject eObject = r.getContents().get(0);
if (eObject instanceof EPackage) {
EPackage p = (EPackage)eObject;
rs.getPackageRegistry().put(p.getNsURI(), p);
}
The ecore file:
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="www.omg.org/XMI" xmlns:ecore="www.eclipse.org/emf/2002/Ecore" name="www.mycompany.com"
nsURI="www.mycompany.com" nsPrefix="myns"/>
Thanks for any advise...
P.S.: Sorry, for the missing https of the namespaces. Workaround for the eclipse spam protection -.-
[Updated on: Thu, 24 January 2013 08:56] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.08156 seconds