@Test public void startProcess() { JbpmContext jbpmContext = null; try { jbpmContext = ProcessContainer.getContainer().createJbpmContext(); ProcessContext ctx = new ProcessContext(); ctx.setRowId(UUID32.getUUID()); // 审核表的记录ID,类型要匹配 ctx.setActorId("joy"); // 参与者,登录用户帐户 ctx.setTitle("单据编号:" + ctx.getRowId()); // 流程标题 ctx.setProcessName("SimpleProcess"); // 流程名称(英文的名称) Collection<DataField> datafields = new java.util.concurrent.CopyOnWriteArrayList<DataField>(); DataField datafield = new DataField(); datafield.setName("isAgree"); // 控制参数名称 datafield.setValue("true"); // 控制参数值 datafields.add(datafield); DataField datafield2 = new DataField(); datafield2.setName("money"); datafield2.setValue(2345.88D); datafields.add(datafield2); DataField datafield3 = new DataField(); datafield3.setName("Auditor1"); // 控制参数名称 datafield3.setValue("joe,dane"); // 控制参数值 datafields.add(datafield3); DataField datafield4 = new DataField(); datafield4.setName("Auditor2"); // 控制参数名称 datafield4.setValue("jack,rick"); // 控制参数值 datafields.add(datafield4); DataField datafield5 = new DataField(); datafield5.setName("signatureDate"); datafield5.setValue(new Date()); datafields.add(datafield5); ctx.setDataFields(datafields); // 控制参数 processInstanceId = ProcessContainer.getContainer().startProcess(ctx); // 如果流程实例编号不为空,那么已经成功创建流程实例,否则抛出异常 if (processInstanceId != null) { System.out.println("processInstanceId=" + processInstanceId); System.out.println("OK!"); } } catch (Exception ex) { if (jbpmContext != null) { jbpmContext.setRollbackOnly(); } ex.printStackTrace(); throw new JbpmException(ex); } finally { Context.close(jbpmContext); } complateTask(processInstanceId); }