6

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.

Lenik
  • 13,946
  • 17
  • 75
  • 103

2 Answers2

8

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 :)

jelies
  • 9,110
  • 5
  • 50
  • 65
  • can you please share these codes and config file to my mailbox, i can't open your link at all. always show "stolen content from pastebin.com. your request has been blocked! visit pastebin.com for the original content.", my email: sendreams@hotmail.com, thanks – sendreams Jan 19 '16 at 03:50
  • i use a ec2 vpn, and now pastebin is ok. – sendreams Jan 19 '16 at 04:41
  • tip:i used version 5.17, the GroupManager's name has changed to "GroupEntityManager", UserManager -> "UserEntityManager" – sendreams Jan 19 '16 at 08:08
2

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.

Nickmancol
  • 1,034
  • 7
  • 16