cancel
Showing results for 
Search instead for 
Did you mean: 

Urgent - Extending TaskManager

kethur
Champ in-the-making
Champ in-the-making
Hi All,

Could someone let me know the best way to extend the TaskManager behavior?  Is it allowed to extend this class (Keeping Activiti's future versions upgrade).  How would i specify the new taskManager in my spring context.

Could you please suggest on the below aswell.

- We have users, groups in our own database with a different table structure.
- We dont use Activiti explorer to create users groups etc.  We already have a different database table set for that.  We only want to integrate those tables with Activiti's Identity Management.  Out tables should be used as read-only when activiti queries the information to check the ACLs.

- How would it help overriding the below classes in this type of integration?
ConnectionParams.java
GroupManager.java
GroupManagerFactory.java
UserManager.java
UserManagerFactory.java

Thanks in advance,
Raj
4 REPLIES 4

kethur
Champ in-the-making
Champ in-the-making
Sorry to loose my patience too quickly.  Could someone please reply to my questions?

Many thanks,
Raj

marcus1
Champ in-the-making
Champ in-the-making
Hi Raj,

What behaviour do you want to add to TaskManager?

From what you describe it seems that you want have to support for your own user/group tables. For that you don't need to extend TaskManager; you only need to implement your own GroupManager.findGroupsByUser. Here's an example:

public class MyGroupEntityManager extends GroupManager {

@Inject
private MyIdentityService myIdentityService;

@Override
public List<Group> findGroupsByUser(String userId) {
  MyUser user = myIdentityService.findUserByName(userId);
  List<Group> result = new ArrayList<Group>();
  for (MyGroup group : user.getGroups()) {
   result.add(new GroupWrapper(group));
  }
  return result;
}
}
And then add a SessionFactory for this GroupManager in your ProcessEngineConfiguration.

kethur
Champ in-the-making
Champ in-the-making
Thanks.

I did almost the same In my GroupManager class i overrode the below method as similar implementation.

    @Override
    public List<Group> findGroupsByUser(String userLogin) {
 
        Group singleGroup = new GroupEntity();
        singleGroup.setId("INCIDENT1");
        singleGroup.setName("Incident Name");
       
        List<Group> list = new ArrayList<Group>();
        list.add(singleGroup);
        return list;
  }

And I was hoping that the task is assigned to userLogin.  But no tasks assigned to that user.

taskService.createTaskQuery().
                    processInstanceId(processInstanceId)
                    .taskAssignee(userId)
                    .list ()
The above does not give me any tasks.

I have tried with taskCandidateUser and it calls my findGroupByUser (above) but still the task is not assigned to the user.

taskService.createTaskQuery().
                    processInstanceId(processInstanceId)
                    .taskCandidateUser(userId)
                    .list ()

Could you let me know what I am doing wrong here?

Thanks,
Raj

marcus1
Champ in-the-making
Champ in-the-making
1) What version of Activiti do you use?

2) Are you sure that the tasks have the right group assignments (i.e. including "INCIDENT1" in your example)?

3) Does it work if you use TaskQuery.taskCandidateGroupIn(groupIds) like this:

taskService
.createTaskQuery()
.taskCandidateGroupIn("INCIDENT1")
.list();
Getting started

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.