0
votes

My JBPM system uses LDAP for identity management. Since the user Administrator and the group Administrators are not valid in my environment, I need to set my own group BPMUL-admin as the business administrator for all tasks. According to this answer, I added 'Human Task' work item handler to CustomWorkItemHandlers.conf:

[
  "Log": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler(),
  "WebService": new org.jbpm.process.workitem.webservice.WebServiceWorkItemHandler(ksession),
  "Rest": new org.jbpm.process.workitem.rest.RESTWorkItemHandler(),
  "Service Task" : new org.jbpm.process.workitem.bpmn2.ServiceTaskHandler(ksession),
  "Human Task" : new ru.rshb.kie.LeaHTWorkItemHandler(runtimeManager)
]

drools.session.conf:

drools.workItemHandlers = CustomWorkItemHandlers.conf

And here is LeaHTWorkItemHandler:

public class LeaHTWorkItemHandler extends LocalHTWorkItemHandler {

    public static final String ADMIN_GROUP = "BPMUL-admin";

    public LeaHTWorkItemHandler(RuntimeManager runtimeManager){
        super.setRuntimeManager(runtimeManager);
    }

    @Override
    protected Task createTaskBasedOnWorkItemParams(KieSession session, WorkItem workItem) {
        InternalTask task =(InternalTask)super.createTaskBasedOnWorkItemParams(session,workItem);
        Group adminGroup = TaskModelProvider.getFactory().newGroup();
        ((InternalOrganizationalEntity) adminGroup).setId(ADMIN_GROUP);

        task.getPeopleAssignments().getBusinessAdministrators().add(adminGroup);
        return task;
    }
}

1. When I try to deploy this, I get an error:

Caused by: javax.ejb.EJBException: [Error: no such method or function: runtimeManager] [Near : {... "Human Task" : new ru.rshb.kie.LeaHTWorkItemHandl ....}]

  1. If I delete runtimeManager from the constructor, then I see that the constructor is called, but the method createTaskBasedOnWorkItemParams is never invoked by JBPM.

What am I doing wrong? Or perhaps is there a better way to define custom business administrators?

I use JBPM 6.3.

1

1 Answers

0
votes

Ok, I figured it out. I removed my work item handler from CustomWorkItemHandlers.conf and added the following line before I start the process:

ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new LeaHTWorkItemHandler(runtimeManager));