Custom SequenceFlow's extended properties doesn't work for bpmn2. [message #1696208] |
Sat, 23 May 2015 04:15  |
Takahiro Yamanaka Messages: 7 Registered: May 2015 |
Junior Member |
|
|
Hi.
We've been using eclipse bpmn2 modeler with luna SR2. We originally installed this plugin:
bpmn2-modeler/updates/luna/1.1.3
We tried to extend the Sequence Connector by reference to Custom Task(https://wiki.eclipse.org/BPMN2-Modeler/DeveloperTutorials/CreateCustomTask).
In Custom Task case,We could display the extend the properties of Task.
In Sequence Connector case, We didn't.
Then We compare them and found differences.
In Custom Task case, We could get value of ModelDecorator.getAnyAttribute(object, "type") in "getId"method.
But in Sequence Connector case,We didn't. #ModelDecorator.getAnyAttribute(object, "type") return null.
Could anyone help? Let me know if more information is required.
Thanks in advance.
Sample code follow:
plugin.xml
<customTask category="Imixs-Workflow" featureContainer="org.imixs.bpmn.model.SampleCustomSequenceFlowFeatureContainer"
icon="test.png"
id="org.imixs.workflow.bpmn.customFlow"
name="Mitigation Flow"
runtimeId="org.imixs.workflow.bpmn.runtime"
type="SequenceFlow">
<property name="type" value="BaseFlow">
</property>
<property name="priority" type="EInt" value="1"> </property>
</customTask>
<customTask
category="Imixs-Workflow"
featureContainer="org.imixs.bpmn.model.TaskElementFeatureContainer"
icon="test.png"
id="org.imixs.workflow.bpmn.customTask"
name="Mitigation Task"
runtimeId="org.imixs.workflow.bpmn.runtime"
type="Task">
<property
name="type"
value="BaseTask">
</property>
<property
name="prop1"
type="EString"
value="Test">
</property>
</customTask>
</extension>
public class SampleCustomSequenceFlowFeatureContainer extends CustomConnectionFeatureContainer {
private final static String TYPE_VALUE = "BaseFlow";
private final static String CUSTOM_FLOW_ID = "org.imixs.workflow.bpmn.customFlow";
@Override
protected IFeatureContainer createFeatureContainer(IFeatureProvider fp) {
return new SequenceFlowFeatureContainer() {
@Override
public IAddFeature getAddFeature(IFeatureProvider fp) {
return new AddSequenceFlowFeature(fp) {
@Override
protected void decorateConnection(
IAddConnectionContext context,
Connection connection, SequenceFlow businessObject) {
super.decorateConnection(context, connection,
businessObject);
connection.getGraphicsAlgorithm().setLineWidth(3);
connection.getGraphicsAlgorithm().setLineStyle(
LineStyle.DASH);
}
};
}
@Override
public ICreateConnectionFeature getCreateConnectionFeature(
IFeatureProvider fp) {
return new CreateSequenceFlowFeature(fp) {
@Override
public SequenceFlow createBusinessObject(
ICreateConnectionContext context) {
SequenceFlow businessObject = super
.createBusinessObject(context);
return businessObject;
}
};
}
};
}
@Override
public String getId(EObject object) {
if (object == null)
return null;
EStructuralFeature f = ModelDecorator.getAnyAttribute(object, "type");
if (f != null) {
Object id = object.eGet(f);
if (TYPE_VALUE.equals(id))
return CUSTOM_FLOW_ID;
}
return null;
}
@Override
public ICustomFeature[] getCustomFeatures(IFeatureProvider fp) {
return new ICustomFeature[] { new ShowPropertiesFeature(fp) };
}
}
public class TaskElementFeatureContainer extends CustomShapeFeatureContainer {
private final static String TYPE_VALUE = "BaseTask";
private final static String CUSTOM_TASK_ID = "org.imixs.workflow.bpmn.customTask";
public TaskElementFeatureContainer() {
}
@Override
public String getId(EObject object) {
EStructuralFeature f = ModelDecorator.getAnyAttribute(object, "type");
if (f != null) {
Object id = object.eGet(f);
if (TYPE_VALUE.equals(id))
return CUSTOM_TASK_ID;
}
return null;
}
@Override
public ICustomFeature[] getCustomFeatures(IFeatureProvider fp) {
return new ICustomFeature[] { new ShowPropertiesFeature(fp) };
}
}
Yamanaka
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01985 seconds