Flowable 6.5 migration - Identity Service

Hi @filiphr @joram @martin.grofcik and others!

We have implemented and set custom IdmEngineConfigurator for V6.5 engine and identity service work fine. But we have legacy process definitions as well which run on V5 engine - and I am not sure how I can inject IdmConfigurator on V5 engine compatible mode.

We make bunch of custom calls invoking org.activiti.engine.IdentityService#createUserQuery which references getIdmIdentityService() which is empty in case of legacy V5 engine flow.

Below is Flowable code which breaks given getIdmIdentityService() is empty.

public UserQuery createUserQuery() {
    return getIdmIdentityService().createUserQuery();
}

public static IdmIdentityService getIdmIdentityService() {
IdmIdentityService idmIdentityService = null;
IdmEngineConfigurationApi idmEngineConfiguration = getIdmEngineConfiguration();
if (idmEngineConfiguration != null) {
idmIdentityService = idmEngineConfiguration.getIdmIdentityService();
}

    return idmIdentityService;
}

Below is old Activiti 5.15 code

Here we use to override the UserIdentityManager() which is now not possible even using flowable 5 compatibility library.

public class CreateUserQueryCmd implements Command, Serializable {
private static final long serialVersionUID = 1L;

public CreateUserQueryCmd() {
}

public UserQuery execute(CommandContext commandContext) {
    return commandContext.getUserIdentityManager().createNewUserQuery();
}

}

Any ideas?

Thanks
Binish

Real problem seems like commandContext is null when getIdmEngineConfiguration() method call is invoked from legacy flow (tasklistener) whereas below works fine if flow comes through an ExecutionListener …very tricky

public static IdmEngineConfigurationApi getIdmEngineConfiguration(CommandContext commandContext) {
return (IdmEngineConfigurationApi) commandContext.getEngineConfigurations().get(EngineConfigurationConstants.KEY_IDM_ENGINE_CONFIG);
}

Basically what we are trying to do is inject tasklisteners and execution listeners to V5 engine and trying to read from IdentityService.

Could you please suggest the right way to inject or read identityservice in V5 engine flow?

Thx