12-13-2022 12:24 PM
Hello,
I am having some issues in how to call a class using Delegate expression inside a UserTask in activiti , this is what i did :
-Called my Task Listener like this with a create Event using Delegate Expression ${DelegationTaskListener}
-This is my class:
package com.order;
import java.util.Arrays;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.PersonService;
public class DelegationTaskListener implements TaskListener {
private ServiceRegistry serviceRegistry ;
public void setServiceRegistry(ServiceRegistry serviceRegistry){
this.serviceRegistry = serviceRegistry;
}
@override
public void notify(DelegateTask delegateTask) {
String userName = "admin";
System.out.println("userName "+userName);
NodeService nodeService = serviceRegistry.getNodeService();
PersonService personService = serviceRegistry.getPersonService();
//do stuff
}
}
-and this my bean declaration in service-context.xml:
<bean id="DelegationTaskListener" class="com.order.DelegationTaskListener">
<property name="serviceRegistry">
<ref bean="ServiceRegistry" />
</property>
</bean>
what is missing???
Explore our Alfresco products with the links below. Use labels to filter content by product module.