use of org.kie.api.task.UserGroupCallback in project jbpm by kiegroup.
the class EvaluationExample2 method getRuntimeManager.
private static RuntimeManager getRuntimeManager(String process) {
// load up the knowledge base
JBPMHelper.startH2Server();
JBPMHelper.setupDataSource();
RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().userGroupCallback(new UserGroupCallback() {
public List<String> getGroupsForUser(String userId) {
List<String> result = new ArrayList<String>();
if ("mary".equals(userId)) {
result.add("HR");
} else if ("john".equals(userId)) {
result.add("PM");
}
return result;
}
public boolean existsUser(String arg0) {
return true;
}
public boolean existsGroup(String arg0) {
return true;
}
}).addAsset(KieServices.Factory.get().getResources().newClassPathResource(process), ResourceType.BPMN2).get();
return RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);
}
use of org.kie.api.task.UserGroupCallback in project jbpm by kiegroup.
the class HumanTaskExample method getRuntimeManager.
private static RuntimeManager getRuntimeManager(String process) {
// load up the knowledge base
JBPMHelper.startH2Server();
JBPMHelper.setupDataSource();
RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().userGroupCallback(new UserGroupCallback() {
public List<String> getGroupsForUser(String userId) {
List<String> result = new ArrayList<String>();
if ("sales-rep".equals(userId)) {
result.add("sales");
} else if ("john".equals(userId)) {
result.add("PM");
}
return result;
}
public boolean existsUser(String arg0) {
return true;
}
public boolean existsGroup(String arg0) {
return true;
}
}).addAsset(KieServices.Factory.get().getResources().newClassPathResource(process), ResourceType.BPMN2).get();
return RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);
}
use of org.kie.api.task.UserGroupCallback in project jbpm by kiegroup.
the class MvelResolverDeploymentDescriptorManagerTest method testDeploymentDescriptorFromKieContainer.
@Test
public void testDeploymentDescriptorFromKieContainer() throws IOException {
Map<String, String> resources = new HashMap<String, String>();
KieServices ks = KieServices.Factory.get();
ReleaseId releaseId = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, VERSION);
String kmoduleString = IOUtils.toString(this.getClass().getResourceAsStream("/kmodule-custom-wih.xml"), "UTF-8");
resources.put("src/main/resources/META-INF/kmodule.xml", kmoduleString);
String processString = IOUtils.toString(this.getClass().getResourceAsStream("/BPMN2-CustomTask.bpmn2"), "UTF-8");
resources.put("src/main/resources/BPMN2-CustomTask.bpmn2", processString);
InternalKieModule kJar1 = createKieJar(ks, releaseId, resources);
installKjar(releaseId, kJar1);
Properties properties = new Properties();
UserGroupCallback userGroupCallback = new JBossUserGroupCallbackImpl(properties);
RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder(releaseId).userGroupCallback(userGroupCallback).get();
manager = RuntimeManagerFactory.Factory.get().newPerProcessInstanceRuntimeManager(environment);
manager.getRuntimeEngine(ProcessInstanceIdContext.get()).getKieSession().startProcess("customtask");
}
use of org.kie.api.task.UserGroupCallback in project jbpm by kiegroup.
the class LDAPUserGroupCallbackImplTest method testGroupsOneLevelScopeEngContext.
@Test
public void testGroupsOneLevelScopeEngContext() {
UserGroupCallback ldapUserGroupCallback = createLdapUserGroupCallbackWithRoleCtx(SearchScope.ONELEVEL_SCOPE, "ou=ENG,ou=Roles,dc=jbpm,dc=org");
assertGroups(ldapUserGroupCallback, false, false, true, false);
}
use of org.kie.api.task.UserGroupCallback in project jbpm by kiegroup.
the class LDAPUserGroupCallbackImplTest method testGroupsSubtreeScopeRolesContext.
@Test
public void testGroupsSubtreeScopeRolesContext() {
UserGroupCallback ldapUserGroupCallback = createLdapUserGroupCallbackWithRoleCtx(SearchScope.SUBTREE_SCOPE, "ou=Roles,dc=jbpm,dc=org");
assertGroups(ldapUserGroupCallback, true, true, true, true);
}
Aggregations