Search code examples
javaworkflowactiviti

Activiti6 Custom identity management by overriding standard SessionFactory not use?


I'm beginner when I use activit6, I follow below code

<bean id="processEngineConfiguration" class="...SomeProcessEngineConfigurationClass">

...

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

...

public class MyCompanyGroupManager extends GroupEntityManager {

private static Logger log = LoggerFactory.getLogger(MyCompanyGroupManager.class);

@Override
public List<Group> findGroupsByUser(String userId) {
    log.debug("findGroupByUser called with userId: " + userId);
    return super.findGroupsByUser(userId);
}

@Override
public List<Group> findGroupByQueryCriteria(GroupQueryImpl query, Page page) {
    log.debug("findGroupByQueryCriteria called, query: " + query + " page: " + page);
    return super.findGroupByQueryCriteria(query, page);
}

@Override
public long findGroupCountByQueryCriteria(GroupQueryImpl query) {
    log.debug("findGroupCountByQueryCriteria called, query: " + query);
    return super.findGroupCountByQueryCriteria(query);
}

@Override
public Group createNewGroup(String groupId) {
    throw new UnsupportedOperationException();
}

@Override
public void deleteGroup(String groupId) {
    throw new UnsupportedOperationException();
}

}

But I find some API not invalid, such as class of GroupIdentityManager not exist. Besides GroupEntityManager update interface so what should I achieve custom identity management? thanks very much


Solution

  • I found the answer in github

    The solution is as follows:

    1. Implement the GroupDataManager interface. Or, extend MybatisGroupDataManager.class

    2. ProcessEngineConfigurationImpl.setGroupDataManager(GroupDataManager groupDataManager)