AnsweredAssumed Answered

How To Plugin Custom GroupEntityManager Correctly

Question asked by uprooter on May 23, 2013
Latest reply on May 24, 2013 by uprooter
Hello guys,

I am currently struggeling with my custom implementation of user and group management and hope that someone here can help me.

What I want to do is to use my own group and user tables to run process workflows. Especially the question who is allowed to start a process is interesting for me. I have found the following configuration which seems to do the right thing:

<process id="my_process" name="My Process" activiti:candidateStarterGroups="testGroup">

So I tried to get the groups that are allowed to start the process by using the following line of code:

List<Group> authorizedGroups = identService.createGroupQuery().potentialStarter(processDefId).list();

Without any further customization the list authorizedGroups is empty since the testGroup is not know to Activiti.

So I wrote my own UserEntityManager and my own GroupEntityManager and plugged them in into activiti.cfg.xml

<property name="customSessionFactories">
   <bean class="com.test.MyUserManagerFactory" />
        <bean class="com.test.MyGroupManagerFactory" />

This seems to work well but my result list was still empty although all the finders in the Manager implementations are targeting my own tables.

Further debugging revealed that the reason is the following method of the GroupEntityManager:

public List<Group> findGroupByQueryCriteria(GroupQueryImpl query, Page page)

This method is executed by the call above with the process definition id as filter criteria. My problem here is that I do not see any chance to control the target user and group tables used by this finder since it is executing a hardcoded sql query.

This query selects all groups from the activiti own tables an tries to find a join partner in the IDENTITI_LINK table. Since the testGroup above is missing in the activiti group table I get no results here.

Does anyone have a hint for me what I am doing wrong? How can I configure activiti to look for roles in my own tables?

Thanks in advace!