Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BPMN 2.0 Modeler » how to add a new attribute to the bpmn2 model without any extension(hi,here I have some quesions, hoping that you can take me out. I want to add a new attribute to the model, take UserTask for example. I change the model in BPMN.ecore, and regenerate the code., hoping)
how to add a new attribute to the bpmn2 model without any extension [message #1067965] Thu, 11 July 2013 13:05 Go to next message
wei na is currently offline wei naFriend
Messages: 7
Registered: July 2013
Junior Member
hi,here I have some quesions, hoping that you can take me out. I want to add a new attribute to the model, take UserTask for example. I change the model in BPMN.ecore, and regenerate the code., hoping that the new attribute can show up in the propertysheet,but it didn't. do i need to do more , like adding a model enablement in the plugin.xml? can you help me to solve this problem? thank you!
Re: how to add a new attribute to the bpmn2 model without any extension [message #1067973 is a reply to message #1067965] Thu, 11 July 2013 13:47 Go to previous messageGo to next message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Most of the bpmn2 elements have their own property tabs. For the User Task, the property tab is defined in the org.eclipse.bpmn2.modeler.ui plugin.xml and looks like this:


		<propertyTab
			id="org.eclipse.bpmn2.modeler.userTask.tab"
			replaceTab="org.eclipse.bpmn2.modeler.task.tab"
			afterTab="org.eclipse.bpmn2.modeler.description.tab"
			class="default"
			features="implementation resources renderings isForCompensation"
			type="org.eclipse.bpmn2.UserTask"
			label="User Task">
		</propertyTab>



where the class="default" means "use the default detail composite class, DefaultDetailComposite" and the features="implementation ...etc." indicates the class features that are to be rendered. The default detail composite recognizes various feature types, like boolean string, references, list, etc. (see the ObjectEditor base class and all of its subclasses).

You'll have to add your new class feature to this list if you want it to show up in the property tab. Alternatively you could write your own custom detail class - there are many examples of this already in the editor code.

Have fun!
Bob
icon10.gif  Re: how to add a new attribute to the bpmn2 model without any extension [message #1068081 is a reply to message #1067973] Fri, 12 July 2013 01:45 Go to previous messageGo to next message
wei na is currently offline wei naFriend
Messages: 7
Registered: July 2013
Junior Member
wow...seens like i made a mistake of adding a wrong name to the list.terrible mistake...thx a lot Embarrassed i may need more time to learn about plugin development.
Laughing
Re: how to add a new attribute to the bpmn2 model without any extension [message #1133012 is a reply to message #1067965] Fri, 11 October 2013 14:46 Go to previous messageGo to next message
Katharina Kaiser is currently offline Katharina KaiserFriend
Messages: 3
Registered: October 2013
Junior Member
do i understand this correctly.?

If i want for example to add a attribute for the time a task needs i have to add the attribute like described in the posts ?

Thank you
Re: how to add a new attribute to the bpmn2 model without any extension [message #1133059 is a reply to message #1067965] Fri, 11 October 2013 15:31 Go to previous messageGo to next message
Katharina Kaiser is currently offline Katharina KaiserFriend
Messages: 3
Registered: October 2013
Junior Member
I also have some questions..

I want to add an new attribute to a task to save the amount of time a task needs
(i have no preference if its an tag or an attribute in xml)

Do I have to add this like described in the posts above ?

Thank you
Re: how to add a new attribute to the bpmn2 model without any extension [message #1137751 is a reply to message #1133059] Mon, 14 October 2013 18:12 Go to previous messageGo to next message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Hi Katharina,

Unless you need a special data type or require special property display and validation, you can simply define a <modelExtension> for this attribute in your plugin.xml.

So, for example you could add this to your plugin.xml:

		
		<modelExtension
			id="org.eclipse.bpmn2.modeler.runtime.example.modelExtension.ManualTask"
			runtimeId="org.eclipse.bpmn2.modeler.runtime.example"
			name="Manual Task Extensions"
			type="ManualTask">
			<property name="timeToComplete" value="3 hours" type="EString"/>
		</modelExtension>



Be careful though because this will add the extension attribute to all instances of the same BPMN2 element type. So in this case, all ManualTask objects will have a "timeToComplete" extension attribute added to them.

You will also have to add a <modelEnablement> entry for this attribute if you want it to show up as an editable field in the Property Tab, like this:

		<modelEnablement runtimeId="org.eclipse.bpmn2.modeler.runtime.example" type="Process" profile="Default">
			<enable object="ManualTask" feature="timeToComplete"/>
		</modelEnablement>




When this object is serialized, it will look like this in the *.bpmn file:


    <bpmn2:manualTask id="ManualTask_1" tns:timeToComplete="3 hours" name="Manual Task 1"/>


where the "tns" is the URI of your Target Runtime plugin's <model>, e.g.:

		<model runtimeId="org.eclipse.bpmn2.modeler.runtime.example"
			uri="http://org.eclipse.bpmn2.modeler.runtime.example"
			resourceFactory="...">
		</model>


HTH,
Bob
Re: how to add a new attribute to the bpmn2 model without any extension [message #1140977 is a reply to message #1137751] Wed, 16 October 2013 18:59 Go to previous message
Katharina Kaiser is currently offline Katharina KaiserFriend
Messages: 3
Registered: October 2013
Junior Member
Thank you very much
Smile

Everything worked Smile.

Previous Topic:Name attribute
Next Topic:Load BPMN2 model using the API
Goto Forum:
  


Current Time: Thu Apr 25 22:09:35 GMT 2024

Powered by FUDForum. Page generated in 0.03281 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top