我尝试使用jBPM 6.2创建BPM。过程如下:
用户创建请求。他的经理将评估接受或拒绝。在他的经理接受的情况下,IT部门的人员将实施该请求
但我不能从我所属的小组那里得到任务。在我的BPM中,人工任务被分配给IT小组。我尝试使用帐户:salaboy,jack(在IT部门),但我没有看到与这些帐户相关的任何任务
以下是我的流程的屏幕截图,您可以看到群组ID是IT
我没有更改服务器的任何配置。角色如下:
admin=admin,analyst,kiemgmt
krisv=admin,analyst
john=analyst,Accounting,PM
mary=analyst,HR
sales-rep=analyst,sales
jack=analyst,IT
katy=analyst,HR
salaboy=admin,analyst,IT,HR,Accounting
要测试的代码是:
public static void main(String[] args) {
KieServices ks = KieServices.Factory.get();
KieContainer kContainer = ks.getKieClasspathContainer();
KieBase kbase = kContainer.getKieBase("kbase");
RuntimeManager manager = createRuntimeManager(kbase);
RuntimeEngine engine = manager.getRuntimeEngine(null);
KieSession ksession = engine.getKieSession();
TaskService taskService = engine.getTaskService();
ksession.startProcess("com.sample.bpmn.hello");
// let john execute Task 1
List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK");
TaskSummary task = list.get(0);
System.out.println("John is executing task " + task.getName());
taskService.start(task.getId(), "john");
taskService.complete(task.getId(), "john", null);
// let mary execute Task 2
list = taskService.getTasksAssignedAsPotentialOwner("mary", "en-UK");
task = list.get(0);
System.out.println("Mary is executing task " + task.getName());
taskService.start(task.getId(), "mary");
Map<String, Object> params = new HashMap<>();
params.put("output", true);
taskService.complete(task.getId(), "mary", params);
// let salaboy execute Task 3
list = taskService.getTasksAssignedAsPotentialOwner("salaboy", "en-UK");
task = list.get(0);
System.out.println("salaboy is executing task " + task.getName());
taskService.start(task.getId(), "salaboy");
taskService.complete(task.getId(), "salaboy", null);
manager.disposeRuntimeEngine(engine);
System.exit(0);
}
private static RuntimeManager createRuntimeManager(KieBase kbase) {
JBPMHelper.startH2Server();
JBPMHelper.setupDataSource();
EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");
RuntimeEnvironmentBuilder builder = RuntimeEnvironmentBuilder.Factory.get()
.newDefaultBuilder().entityManagerFactory(emf)
.knowledgeBase(kbase);
return RuntimeManagerFactory.Factory.get()
.newSingletonRuntimeManager(builder.get(), "com.sample:example:1.0");
}
如果我将实施任务分配给salaboy,它就像魅力一样
如果您有任何建议,请告诉我
由于
答案 0 :(得分:0)
我们应该使用Workbench(Web版本)而不是Eclipse。