As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
<serviceTask id="javaService" name="Read voltage" activiti:expression="#{ServiceDelegate.execute()}" activiti:resultVariable="voltage"> <extensionElements> <activiti:field name="serviceName"> <activiti:string>READ_VOLTAGE</activiti:string> </activiti:field> </extensionElements> </serviceTask> <sequenceFlow id="flow2" sourceRef="exclusiveGw" targetRef="theTask1"> <conditionExpression xsi:type="tFormalExpression">{voltage == 12.1}</conditionExpression> </sequenceFlow>
#{ServiceDelegate.execute(yourVariableName)}
#{ServiceDelegate.execute(execution)}
public void execute(DelegateExecution execution) {
public class ServiceDelegate implements JavaDelegate, Serializable {<br>…<br> public void execute(DelegateExecution execution) throws Exception {<br> String serviceNameString = (String) serviceName.getValue(execution);<br><br> if(serviceNameString.equals("READ_VOLTAGE")){<br> …<br>
public void setText(Expression serviceNameExpression){<br> this.serviceName = serviceNameExpression;<br> }<br>
<serviceTask id="javaServiceReadVoltage" name="Read voltage"<br> activiti:class="com.bosch.wfe.activity.delegate.ServiceDelegate"><br> <extensionElements><br> <activiti:field name="serviceName"><br> <activiti:string>READ_VOLTAGE</activiti:string><br> </activiti:field><br> </extensionElements><br> </serviceTask>
<serviceTask id="javaService" name="Read voltage"<br> activiti:expression="${ServiceDelegate.execute(execution)}"<br> activiti:resultVariable="voltage"><br> <extensionElements><br> <activiti:field name="serviceName"><br> <activiti:string>READ_VOLTAGE</activiti:string><br> </activiti:field><br> </extensionElements><br> </serviceTask>
The serviceName field is null. With my "activiti:class" process the serviceName is injected with: public void setText(Expression serviceNameExpression){<br> this.serviceName = serviceNameExpression;<br> }<br>
<br>…<br> <serviceTask id="javaServiceReadVoltage" name="Read voltage"<br> activiti:class="com.bigcompany.wfe.activiti.delegate.ServiceDelegate"><br> <extensionElements><br> <activiti:field name="serviceName"><br> <activiti:string>READ_VOLTAGE</activiti:string><br> </activiti:field><br> </extensionElements><br> <br> </serviceTask><br> <br> <sequenceFlow id="flow3" sourceRef="javaServiceReadVoltage" targetRef="exclusiveGw" /><br> <br> <exclusiveGateway id="exclusiveGw" name="Exclusive Gateway" /><br> <br> <sequenceFlow id="flow4" sourceRef="exclusiveGw" targetRef="theTask1"><br> <conditionExpression xsi:type="tFormalExpression">${ServiceResult == 12.0}</conditionExpression><br> </sequenceFlow><br>
double result = ServiceFacade.readVoltage();<br> execution.setVariable("ServiceResult", result);<br>
This is inheritly so for the Activiti engine, as it is a Java worflow engine in the first place.There is currently no way of providing process variables in the process.
This is inheritly so for the Activiti engine, as it is a Java worflow engine in the first place.There is currently no way of providing process variables in the process.Thank you for the clarification. I was confused because "activiti:resultVariable" let one introduce such a process variable in the process. I was wondering why this seems forbidden with an "activiti:class"-Element.
<br> <serviceTask id="serviceTask1" name="Service Taks" activiti:class="org.example.activi.servicetasks.MyService"><br> <extensionElements><br> <activiti:field name="param1"><activiti:expression>${whatever}</activiti:expression></activiti:field><br> <activiti:field name="param2" activiti:resultVariable="processVariable1" /><br> </serviceTask><br>
<serviceTask id="javaServiceReadVoltage" name="Read voltage" activiti:class="com.bigcompany.wfe.activiti.delegate.ServiceDelegate"> <extensionElements> <activiti:field name="serviceName"> <activiti:string>READ_VOLTAGE</activiti:string> </activiti:field> </extensionElements> </serviceTask>Michael