10-13-2012 03:31 PM
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
<process id="my_test_process" name="MyTestProcess">
<startEvent id="startevent1" name="Start" activiti:initiator="kermit"></startEvent>
<exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
<userTask id="details" name="Enter Details" activiti:assignee="kermit" activiti:candidateUsers="fozzie">
<documentation>This is a Test Form Documentation 2</documentation>
<extensionElements>
<activiti:formProperty id="user_name" name="Name" type="string"></activiti:formProperty>
<activiti:formProperty id="salary" name="salary" type="long"></activiti:formProperty>
</extensionElements>
</userTask>
<userTask id="usertask4" name="Gold Member" activiti:assignee="kermit" activiti:candidateUsers="fozzie">
<documentation>This is documentation for Gold Member</documentation>
</userTask>
<exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
<endEvent id="endevent1" name="End"></endEvent>
<serviceTask id="servicetask1" name="Platinum Member" activiti:expression="#{platinum.doSomething()}"></serviceTask>
<sequenceFlow id="flow2" name="" sourceRef="details" targetRef="exclusivegateway1"></sequenceFlow>
<sequenceFlow id="flow3" name="salary_flow_a" sourceRef="exclusivegateway1" targetRef="servicetask1">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${salary > 2000}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow4" name="" sourceRef="startevent1" targetRef="details"></sequenceFlow>
<sequenceFlow id="flow5" name="salary_flow_b" sourceRef="exclusivegateway1" targetRef="usertask4">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${salary <= 2000}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow6" name="" sourceRef="usertask4" targetRef="exclusivegateway2"></sequenceFlow>
<sequenceFlow id="flow7" name="" sourceRef="servicetask1" targetRef="exclusivegateway2"></sequenceFlow>
<sequenceFlow id="flow8" name="" sourceRef="exclusivegateway2" targetRef="endevent1"></sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_my_test_process">
…
…
…
</bpmndi:BPMNDiagram>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<!– Database configurations –>
<property name="databaseSchemaUpdate" value="true" />
<property name="jdbcUrl" value="jdbc:h2:tcp://localhost/activiti" />
<property name="jdbcDriver" value="org.h2.Driver" />
<property name="jdbcUsername" value="sa" />
<property name="jdbcPassword" value="" />
<property name="jobExecutorActivate" value="true" />
</property>
</bean>
<bean id="platinum" class="com.osr.test.PlatinumService"/>
</beans>
<copy todir="${activiti.home}/setup/build/activiti-cfg" overwrite="false">
c:\activiti-5.9\setup> ant demo.start
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'platinum'
10-15-2012 04:07 AM
10-16-2012 02:18 AM
Exposing configuration beans in expressions and scripts
By default, all beans that you specify in the activiti.cfg.xml configuration or in your own spring configuration file are available to expressions and in the scripts. If you want to limit the visibility of beans in your configuration file, then you can configure a property called beans in your process engine configuration. The beans property in ProcessEngineConfiguration is a map. When you specify that property, only beans specified in that map will be visible to expressions and scripts. The exposed beans will be exposed with the names as you specify in that map.
10-16-2012 05:44 AM
Do you mean the only way to expose beans to expressions is through a script by using execution.setVariable().
10-16-2012 08:52 AM
// see ExpressionManager for the rest of the code
public MyExpressionManager(Map<Object, Object> beans) {
super();
this.beans = beans;
}
protected ELResolver createElResolver(VariableScope variableScope) {
…
if (beans != null) {
compositeELResolver.add(new MyReadOnlyMapELResolver(beans));
}
…
}
MyReadOnlyMapELResolver is an extension of org.activiti.engine.impl.javax.el.ELResolver and has access to the map of configured beans:
public MyReadOnlyMapELResolver(Map<Object, Object> beans) {
this.wrappedBeans = beans;
}
@Override
public Object getValue(ELContext context, Object base, Object property) {
if (base == null) {
if (wrappedBeans.containsKey(property)) {
log.info("getValue für Bean " + property + ": " + wrappedBeans.get(property));
context.setPropertyResolved(true);
return wrappedBeans.get(property);
}
}
return null;
}
10-17-2012 03:45 AM
10-19-2012 05:19 AM
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="platinum" class="com.osr.test.PlatinumService" />
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<!– Database configurations –>
<property name="databaseSchemaUpdate" value="true" />
<property name="jdbcUrl" value="jdbc:h2:tcp://localhost/activiti" />
<property name="jdbcDriver" value="org.h2.Driver" />
<property name="jdbcUsername" value="sa" />
<property name="jdbcPassword" value="" />
<property name="jobExecutorActivate" value="true" />
</bean>
<property name="beans">
<map>
<entry key="platinum" value-ref="platinum" />
</map>
</property>
</beans>
10-19-2012 09:19 AM
04-06-2015 03:03 AM
04-06-2015 11:18 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.