I want to generate executable code from bpmn and I am missing an ‘assignments’ property for that. I want to be able to first create a process variable (with type), then (in a task) select the variable and assign an expression. In bpmn 1.x versions there was a property for exactly that, but I was not able to find the same in the bpmn 2.0 specification or in the properties panel extensions. (I know about Input and Output, but they are not exactly what I had in mind)
I just want to make sure I am not missing anything, before creating an extension myself.
Hello nikku and thanks for the reply!
I want something like this:
<pools xmi:type="vsdt:Pool" xmi:id="_j6m_ItN-Ed6IL7PHwv22lw" name="Mathematican" documentation="In this process the square root of the input value is approximated." id="_mkhLsIaSEd6vMcmgfX7H1A" participant="_j6oNR9N-Ed6IL7PHwv22lw" boundaryVisible="false">
<properties xmi:type="vsdt:Property" xmi:id="_j6m_JNN-Ed6IL7PHwv22lw" name="number" type="double"/>
<properties xmi:type="vsdt:Property" xmi:id="_j6m_JdN-Ed6IL7PHwv22lw" name="current" type="double"/>
<properties xmi:type="vsdt:Property" xmi:id="_j6m_JtN-Ed6IL7PHwv22lw" name="eps" type="double"/>
<properties xmi:type="vsdt:Property" xmi:id="_j6m_J9N-Ed6IL7PHwv22lw" name="lastLesser" type="double"/>
<properties xmi:type="vsdt:Property" xmi:id="_j6m_KNN-Ed6IL7PHwv22lw" name="lastGreater" type="double"/>
<properties xmi:type="vsdt:Property" xmi:id="_j6m_KdN-Ed6IL7PHwv22lw" name="d" type="double"/>
<lanes xmi:type="vsdt:Lane" xmi:id="_j6m_KtN-Ed6IL7PHwv22lw" id="_mkhLsYaSEd6vMcmgfX7H1A">
<containedFlowObjects xmi:type="vsdt:Start" xmi:id="_j6m_K9N-Ed6IL7PHwv22lw" name="start" documentation="The input message is received and its payload is bound to the respective process properties." id="_qJMMUIaSEd6vMcmgfX7H1A" trigger="MESSAGE" implementation="_j6oNTtN-Ed6IL7PHwv22lw">
<assignments xmi:type="vsdt:Assignment" xmi:id="_j6nmMNN-Ed6IL7PHwv22lw" to="_j6m_JNN-Ed6IL7PHwv22lw" assignTime="END">
<from xmi:type="vsdt:Expression" xmi:id="_MAaRsEyREd-Ilfmw5Rk-Mw" expression="input"/>
</assignments>
<assignments xmi:type="vsdt:Assignment" xmi:id="_j6nmMtN-Ed6IL7PHwv22lw" to="_j6m_JtN-Ed6IL7PHwv22lw" assignTime="END">
<from xmi:type="vsdt:Expression" xmi:id="_MeLy0EyREd-Ilfmw5Rk-Mw" expression="epsilon"/>
</assignments>
<containedFlowObjects xmi:type="vsdt:Gateway" xmi:id="_j6nmNdN-Ed6IL7PHwv22lw" name="input valid?" documentation="Here it is checked whether the input is valid. Epsilon must be greater than zero and the number must not be negative." id="_VzrwMJIhEd6PkL1AU2eJuA"/>
<containedFlowObjects xmi:type="vsdt:End" xmi:id="_j6nmNtN-Ed6IL7PHwv22lw" name="invalid input" documentation="In case of invalid input, the return value will be zero. Further, an error message is returned." id="_aH9BwJIhEd6PkL1AU2eJuA" trigger="MESSAGE" implementation="_j6oNTtN-Ed6IL7PHwv22lw">
<assignments xmi:type="vsdt:Assignment" xmi:id="_j6nmN9N-Ed6IL7PHwv22lw" to="_j6oNTNN-Ed6IL7PHwv22lw">
<from xmi:type="vsdt:Expression" xmi:id="_eirCMG3gEeGpCcusgefDDg" expression="0.0"/>
</assignments>
<assignments xmi:type="vsdt:Assignment" xmi:id="_j6nmOdN-Ed6IL7PHwv22lw" to="_j6oNTdN-Ed6IL7PHwv22lw">
<from xmi:type="vsdt:Expression" xmi:id="_QVTOUEyREd-Ilfmw5Rk-Mw" expression="'input ' ++ number ++',' ++ eps++ ' is invalid'"/>
</assignments>
</containedFlowObjects>
...
</pools>
There are 6 variables defined for that pool with id, name and type. And there are elements inside the pool which assign an expression to one of the defined variables.
This could then turn into a Java class like this:
public class Mathematican_ExtractRoot extends AbstractWorkflowBean {
public final static String ACTION_WORKFLOW = "SquareRoot";
/** @generated */
protected Double number;
protected Double current;
protected Double eps;
protected Double lastLesser;
protected Double lastGreater;
protected Double d;
...
/**
* Workflow Method
*
* @generated
*/
@Expose(name=ACTION_WORKFLOW, scope=ActionScope.WEBSERVICE, returnTypes={Double.class, String.class})
public Serializable[] workflow(Double input, Double epsilon) {
// START EVENT
number = input;
eps = epsilon;
// GATEWAY
if (number < 0 || eps <= 0) {
Double result = null;
String message = null;
result = 0.0;
message = "input " + number + "," + eps + " is invalid";
return new Serializable[] {result, message};
} else {
...
}
}
...
}
What we see over there is a custom vendor extension to BPMN 1.2 I believe? Or is this an entirely custom workflow definition?
In BPMN 2.0 vendor extensions are fully supported, however not as property and assignment but under the extensionElements tag that is available for all BPMN elements: