cancel
Showing results for 
Search instead for 
Did you mean: 

How To Plugin Custom GroupEntityManager Correctly

uprooter
Champ in-the-making
Champ in-the-making
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">
   <list>
   <bean class="com.test.MyUserManagerFactory" />
        <bean class="com.test.MyGroupManagerFactory" />
</list>
</property>


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!
4 REPLIES 4

frederikherema1
Star Contributor
Star Contributor
did you actually override the findGroupByQueryCriteria method?

uprooter
Champ in-the-making
Champ in-the-making
No I did not because I had no idea what to put in there. Should I execute my own query which joins the IDENTITY_LINK table with my own group table or whats the best approach?

It seems to me a little cumbersome to replace all Activiti queries with my own in order to be able to work with custom user management tables.

frederikherema1
Star Contributor
Star Contributor
If you want to have full support for you're own identity-management, you should replace that one query (not all activiti-queries). That's the whole point, all group-related queries are in there. The group-query doesn't contain that much fields.

uprooter
Champ in-the-making
Champ in-the-making
Thank you. I will try that out.