01-03-2016 07:20 AM
public class ProcessEngineFactoryBeanX extends ProcessEngineFactoryBean {
@Autowired
UserDao userDao;
@Autowired
GroupDao groupDao;
public ProcessEngineFactoryBeanX() {
super();
}
@Override
public ProcessEngine getObject() throws Exception {
ProcessEngine processEngineObject = super.getObject();
Map<Class<?>, SessionFactory> sF =((ProcessEngineConfigurationImpl)
processEngineObject.getProcessEngineConfiguration()).getSessionFactories();
//There should be error thrown here if sF is null
CustomUserEntityManagerFactory userEntityManagerFactory = new CustomUserEntityManagerFactory(
userDao);
CustomGroupEntityManagerFactory groupEntityManagerFactory = new CustomGroupEntityManagerFactory(
groupDao);
if (!sF.containsKey(CustomUserEntityManager.class)) {
sF.put(CustomUserEntityManager.class,
userEntityManagerFactory);
}
if (!sF.containsKey(CustomGroupEntityManager.class)) {
sF.put(CustomGroupEntityManager.class,
groupEntityManagerFactory);
}
return processEngineObject;
}
@Configuration
public class ProcessEngineConfig {
@Autowired
ProcessEngineConfigurationImpl processEngineConfiguration;
@Primary
@Bean
public ProcessEngineFactoryBean processEngineFactoryBean(){
ProcessEngineFactoryBean bean = new ProcessEngineFactoryBeanX();
bean.setProcessEngineConfiguration(processEngineConfiguration);
return bean;
}
}
@Bean
InitializingBean usersAndGroupsInitializer(
final IdentityService identityService) {
final Logger log = LoggerFactory.getLogger(this.getClass());
return new InitializingBean() {
public void afterPropertiesSet() throws Exception {
Group group = identityService.newGroup("user");
group.setName("users");
group.setType("security-role");
identityService.saveGroup(group);
User admin = identityService.newUser("rootadmin");
admin.setPassword("admin");
identityService.saveUser(admin);
}
};
}
01-03-2016 08:05 AM
01-03-2016 10:38 PM
01-05-2016 04:37 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.