AnsweredAssumed Answered

Override Default Identity Session Implementation

Question asked by sorinello on Apr 8, 2013
Latest reply on Sep 14, 2016 by jansi

I am building a project which involves creating a custom implementation of Identity Service because I need to use external users/groups.

I have implemented my own Factories like I saw in the other tutorials on the internet and this forum.
I extended my UserEntityManager and GroupEntityManager classes and made my own implementation.

Everything ok until here, now I need to tell the Activiti Engine to use my custom SessionFactories.

I have read all the articles regarding this (most of them were about extending Identity Service for LDAP) but also from other sources on web.
I am not using Spring and I have to do this programmatically, but it seems that all the posts about this are from 2010-2011, and the code has changed since then, leaving me unable to accomplish my task.

I am using Activiti 5.12

Here is the code I am using at this moment:

ProcessEngineConfiguration configuration =
Map<Class< ? >, SessionFactory> sessionFactories =
            ((ProcessEngineConfigurationImpl) configuration).getSessionFactories();
        sessionFactories.put(ActivitiUserEntityManager.class, userEntityManagerFactory);
        sessionFactories.put(ActivitiGroupEntityManager.class, groupEntityManagerFactory);
        ProcessEngine engine = configuration.buildProcessEngine();

The code I tried makes a cast to ProcessEngineConfigurationImpl, which does not seem very elegant.
My question is this: Is there a better and a more elegant/recommended way of achieving this ? Or my implementation is following the current way of doing this in Activiti ? Also, am I missing something about this ? All the forum topics are old now, please guide me to the new/better/recommended way.

Sorin B.