6
votes

I have a webapp which has user/group functions, and existing user/group data.

I want to use Activiti the process engine, however, it seems Activiti manage user/group info itself.

Should I:

  1. Refactor my existing webapp, to reuse the user/group data from Activiti, or
  2. Write some adapter code, to make Activiti reuse user/group data in my existing database? Maybe, another implmentation of RepositoryService, IdentityService, etc., and recompile? It seems RepositionServiceImpl is hard coded in the Activiti sources, and there isn't a setRepositionService() method in ProcessEngine.

I can't rename the existing db tables, because there are some other apps using them.

I have read the user guide, but I didn't found any information on how to integrate Activiti with existing apps.

2

2 Answers

8
votes

I don't know what version you are currently using, but I used your second option successfully with version 5.5, overriding some Activiti classes:

  1. Extend GroupManager and UserManager (from package org.activiti.engine.impl.persistence.entity), and implement the methods you need, using the required DAOs/EntityManager/whatever pointing to your database. Code here: GroupManager / UserManager.

  2. Implement org.activiti.engine.impl.interceptor.SessionFactory.SessionFactory, for groups and users. Check out code here: ActivitiGroupManagerFactory / ActivitiUserManagerFactory.

  3. Finally, in your activity config you have to set your new SessionFactory classes. I was using spring, so there is my activiti-config bean code: activiti-config.xml (check line 14)

Hope this helps in some way :)

2
votes

You can check the Lim Chee Kin code to integrate activiti with spring security https://github.com/limcheekin/activiti-spring-security and maybe you can reuse your user/group data with spring security this way you can reuse his code.