[BPMN2] extending attribute of Process node [message #653921] |
Fri, 11 February 2011 20:57  |
tsurdilo  Messages: 41 Registered: February 2011 |
Member |
|
|
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 20:58] Report message to a moderator
|
|
|
|
Re: [BPMN2] extending attribute of Process node [message #654303 is a reply to message #654223] |
Tue, 15 February 2011 01:15   |
tsurdilo  Messages: 41 Registered: February 2011 |
Member |
|
|
Hi Reiner, thank you for the info!
Regarding your first approach - I am creating the bpmn2 structure programatically and wanted to ask you how I could add this attribute through the API?
For example I have:
Process p = Bpmn2Factory.eINSTANCE.createProcess();
p.setProcessType(....);
p.process.setIsExecutable(...);
...
p.getAnyAttribute().add(what_goes_here??)
if you could show me an example on how to create and use an Entry here, or do I have to create a structural feature and add it, I am just not sure.
Regarding your second approach, that's really cool, do you happen to have example on how to apply the extension schema in the API?
Thanks for any input.
[Updated on: Tue, 15 February 2011 01:16] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: [BPMN2] extending attribute of Process node [message #758391 is a reply to message #758192] |
Wed, 23 November 2011 04:28   |
Karthikeyan Missing name Messages: 47 Registered: July 2011 |
Member |
|
|
Hi,
Thank you for your reply. I have checked with extension its working fine, but my doubt is, whether is there any optional way of using EObject Annotation for saving the attribute values using its key and value. Because if we use extension then, the colored elements in our file does not apply while opening in other editor, but if we use annotation I can be achieved.
Thanks & Regards,
Karthikeyan
[Updated on: Wed, 23 November 2011 04:29] Report message to a moderator
|
|
|
Re: [BPMN2] extending attribute of Process node [message #1005114 is a reply to message #697152] |
Thu, 24 January 2013 13:53  |
Marcel Michel Messages: 10 Registered: January 2011 |
Junior Member |
|
|
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 13:56] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.06434 seconds