AnsweredAssumed Answered

GroupEntityManager.findGroupsByUser() is invoked multiple times on taskQuery execution

Question asked by sam_a on May 10, 2018
Latest reply on May 25, 2018 by bassam.al-sarori

The issue is pretty similar to the below one that was discussed many years ago and I'm unable to refer to the fixes provided to that issue.

GroupManager.findGroupsByUser called twice 

-----------------------------------------------------------------------------------------------------------------------------

GroupEntityManager.findGroupsByUser() is invoked 5 times on taskQuery execution. I'm using SpringBoot along with Activiti, I have provided the code snippets below. Please advise if I'm missing anything for the query to function correctly.

 

Query:

List<Task> tasks = taskQuery.taskCandidateOrAssigned(userId)
        .list();

 

Config:

@Override
public ProcessEngineFactoryBean processEngine(SpringProcessEngineConfiguration configuration) throws Exception{
    configuration.setIdGenerator(new StrongUuidGenerator());

    GroupManagerFactory groupManagerFactory = new GroupManagerFactory(customGroupEntityManager);
    configuration.setCustomSessionFactories(CollectionUtil.createListOfOne(groupManagerFactory));
    configuration.setGroupEntityManager(customGroupEntityManager);

    configuration.setDbIdentityUsed(false);
    return super.processEngine(configuration);
}

 

GroupEntityManager:

@Component
public class CustomGroupEntityManager implements GroupEntityManager, Session{

    @Override
    public List<Group> findGroupsByUser(String userId) {
        //ACTUAL IMPLEMENTATION AND THIS METHOD IS GETTING INVOKED "FIVE" TIMES
    }
    @Override
    public Group createNewGroup(String groupId) {
        return null;
    }

    @Override
    public GroupQuery createNewGroupQuery() {
        return null;
    }

    @Override
    public List<Group> findGroupByQueryCriteria(GroupQueryImpl query, Page page) {
        return null;
    }

    @Override
    public long findGroupCountByQueryCriteria(GroupQueryImpl query) {
        return 0;
    }


    @Override
    public List<Group> findGroupsByNativeQuery(Map<String, Object> parameterMap, int firstResult, int maxResults) {
        return null;
    }

    @Override
    public long findGroupCountByNativeQuery(Map<String, Object> parameterMap) {
        return 0;
    }

    @Override
    public boolean isNewGroup(Group group) {
        return false;
    }

    @Override
    public GroupEntity create() {
        return null;
    }

    @Override
    public GroupEntity findById(String entityId) {
        return null;
    }

    @Override
    public void insert(GroupEntity entity) {

    }

    @Override
    public void insert(GroupEntity entity, boolean fireCreateEvent) {

    }

    @Override
    public GroupEntity update(GroupEntity entity) {
        return null;
    }

    @Override
    public GroupEntity update(GroupEntity entity, boolean fireUpdateEvent) {
        return null;
    }

    @Override
    public void delete(String id) {

    }

    @Override
    public void delete(GroupEntity entity) {

    }

    @Override
    public void delete(GroupEntity entity, boolean fireDeleteEvent) {

    }

    @Override
    public void flush() {
    }

    @Override
    public void close() {
    }
    // CLOVER:ON
}

Outcomes