Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BPMN 2.0 Modeler » Adding attributes, specifying their type at runtime
Adding attributes, specifying their type at runtime [message #1415614] Wed, 03 September 2014 07:39 Go to next message
Francesco Scialpi is currently offline Francesco ScialpiFriend
Messages: 5
Registered: August 2014
Junior Member

I am trying to extend the BPMN metamodel, as follows.

Suppose I want to add to a ServiceTask a "processingTime" parameter, whose type is numeric. So, for a Service Task we want a new PropertyTab containing this parameter.
Fine, I can do that.

Now suppose the parameter can be:
- a hard-coded number (i.e. we want the final user to specify a number, plain and simple)
- a sample from a distribution (i.e. we want the final user to specify the kind of distribution: normal, lognormal etc., and also the parameters for the chosen distribution: mean, standardDeviation, mode, min, max, etc.)

The final user, when compiling the Processing Time fields, should be able to choose between "Numeric" and "Distribution" kind of parameter, and shown fields to be filled should change accordingly.

I don't know how to accomplish this. Would you kindly offer some support?

Re: Adding attributes, specifying their type at runtime [message #1416163 is a reply to message #1415614] Thu, 04 September 2014 13:15 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

Wow. this is an odd use case Wink

The attribute's data type will have to be specified as "EString" so that it can accomodate both of these values. This can be done in your extension's plugin.xml like so:

			name="Service Task Extension"
			<property name="processingTime" type="EString"/>

Then you'll have to provide your own Property Tab rendering class, like so:

			label="Service Task">

In your ServiceTaskPropertySection implementation, instantiate a Detail Composite class, like so:

public class ServiceTaskPropertySection extends ActivityPropertySection {

	/* (non-Javadoc)
	 * @see
	protected AbstractDetailComposite createSectionRoot() {
		return new ServiceTaskDetailComposite(this);

	public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
		return new ServiceTaskDetailComposite(parent,style);

Finally, your ServiceTaskDetailComposite implementation needs to determine what actually needs to be rendered for your "processingTime" attribute and construct the appropriate field editor, maybe something like this:

public static class ServiceTaskDetailComposite extends DefaultDetailComposite {

	public ServiceTaskDetailComposite(AbstractBpmn2PropertySection section) {

	public ServiceTaskDetailComposite(Composite parent, int style) {
		super(parent, style);

	protected void bindAttribute(Composite parent, EObject object, EAttribute attribute, String label) {
		if ("processingTime".equals(attribute.getName())) {
			if (processingTimeIsIntegerField()) {
				ObjectEditor editor = new IntObjectEditor(this,object,attribute);
			else if (processingTimeIsEnumField()) {
				ObjectEditor editor = new ComboObjectEditor(this,object,attribute) {

					protected Hashtable<String, Object> getChoiceOfValues(EObject object, EStructuralFeature feature) {
						Hashtable<String,Object> choices = new Hashtable<String,Object>();
						choices.put("Normal", "normal");
						choices.put("Log Normal", "lognormal");
				// create other field editors here for your distribution-specific values
			super.bindAttribute(parent, object, attribute, label);

I haven't actually tried this, and you may need to fiddle with overriding getValue() and setValue() on the field editors to convert data types to/from EString.

Also, you haven't said if "processingTime" needs to be an XML element if it represents a probability distribution type, which should probably contain the distribution-specific variables (mean, standard deviation, etc.) If that's the case, then we have a completely different can of worms Wink

Re: Adding attributes, specifying their type at runtime [message #1753461 is a reply to message #1416163] Mon, 06 February 2017 17:43 Go to previous message
im hello world is currently offline im hello worldFriend
Messages: 44
Registered: February 2017
No Message Body

[Updated on: Fri, 10 February 2017 09:27]

Report message to a moderator

Previous Topic:how to execute a business process
Next Topic:CustomTaskFeautureContainer is missing
Goto Forum:

Current Time: Tue Jun 06 21:10:40 GMT 2023

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

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

Back to the top