02-08-2012 09:33 AM
<bean id="externalReviewNotification" class="com.someco.bpm.ExternalReviewNotification">
<property name="actionService">
<ref bean="ActionService" />
</property>
</bean>
<activiti:taskListener event="create" delegateExpression="${externalReviewNotification}"></activiti:taskListener>
02-21-2012 11:21 AM
<util:map id="activitiBeanRegistry" map-class="java.util.HashMap">
<entry key="services" value-ref="ServiceRegistry" />
<entry key="simpleLoggerServiceTask" value-ref="simpleLoggerServiceTask" />
</util:map>
02-22-2012 09:36 AM
<activiti:taskListener event="create" class="com.someco.bpm.ExternalReviewNotification"></activiti:taskListener>
protected ServiceRegistry getServiceRegistry() {
ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
if (config != null) {
// Fetch the registry that is injected in the activiti spring-configuration
ServiceRegistry registry = (ServiceRegistry) config.getBeans().get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
if (registry == null) {
throw new RuntimeException(
"Service-registry not present in ProcessEngineConfiguration beans, expected ServiceRegistry with key" +
ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
}
return registry;
}
throw new IllegalStateException("No ProcessEngineCOnfiguration found in active context");
}
03-20-2014 10:26 AM
<?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="Examples">
<process id="MyTest" name="MyTest">
<startEvent id="theStart" name="Start">
</startEvent>
<serviceTask id="javaService" name="Java service invocation" activiti:class="org.activiti.examples.bpmn.test.manager2.SetterTest">
<extensionElements>
<activiti:field name="text">
<activiti:string>Success</activiti:string>
</activiti:field>
<activiti:taskListener event="create" class="org.activiti.examples.bpmn.test.manager2.SetterTest">
</activiti:taskListener>
</extensionElements>
</serviceTask>
<userTask id="usertask1" name="User Task" activiti:candidateGroups="user"></userTask>
<endEvent id="theEnd" name="End"></endEvent>
<sequenceFlow id="flow1" name="" sourceRef="theStart" targetRef="javaService"></sequenceFlow>
<sequenceFlow id="flow2" name="" sourceRef="javaService" targetRef="usertask1"></sequenceFlow>
<sequenceFlow id="flow4" name="" sourceRef="usertask1" targetRef="theEnd"></sequenceFlow>
</process>
</definitions>
package org.activiti.examples.bpmn.test.manager2;
import …
……….
public class SetterTest implements JavaDelegate {
private static final String VARIABLE_NAME = "testVariable";
private Expression text;
ServiceRegistry serviceRegistry=null;
//public ServiceRegistry getServiceRegistry() {return serviceRegistry;}
protected ServiceRegistry getServiceRegistry() {
ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
if (config != null) {
ServiceRegistry registry = (ServiceRegistry) config.getBeans().get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
if (registry == null) {
throw new RuntimeException(
"Service-registry not present in ProcessEngineConfiguration beans, expected ServiceRegistry with key" +
ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
}
else
System.out.println("————— config =null");
return registry;
}
throw new IllegalStateException("No ProcessEngineCOnfiguration found in active context");
}
public void setServiceRegistry(ServiceRegistry serviceRegistry) {this.serviceRegistry = serviceRegistry;}
public void execute(DelegateExecution execution)
{
if (serviceRegistry==null)
System.out.println("serviceRegistry is null!!");
}
}
02-22-2012 09:53 AM
03-02-2012 04:29 AM
04-03-2012 04:54 AM
According to them, it's not the spring bean id the one we need to put in the delegateExpression property but the base name of the java class (for Jeff's example if would be ExternalReviewNotification)
04-03-2012 07:47 AM
04-08-2012 07:12 PM
I faced the same problem and found the same work around (register the bean manually overriding the activitiBeanRegistry).
This is not the best solution as if you have more than one module, and want to register beans within the AMP file not in shared/classes/alfresco/extension… There'll be a workflow that won't work.
I've already raised a ticket with Alfresco Support, fingers crossed they fix that!
Regards,
Adei
04-10-2012 08:34 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.