※以下のTipsは jBPM Ver.6.0.1(コミュニティ版)で調査したものです
private void dispUserGroup(String user) { String callBackProp = System.getProperty("jbpm.usergroup.callback.properties"); System.out.println("callbackProperty=" + callBackProp); UserGroupCallback ugrpCallback = new JBossUserGroupCallbackImpl("classpath:/usergroups.properties"); List<String> grps = ugrpCallback.getGroupsForUser(user, null, null); for(String grp : grps) { System.out.println(grp); } /* こういうやり方もある RuntimeEnvironment env = RuntimeEnvironmentBuilder.Factory.get().newDefaultInMemoryBuilder() .addAsset(ResourceFactory.newClassPathResource("sample.bpmn"), ResourceType.BPMN2).get(); UserGroupCallback ugc = env.getUserGroupCallback(); grps = ugrpCallback.getGroupsForUser(user, null, null); for(String grp : grps) { System.out.println(grp); } */ }
jbpm-human-task-core 内の org.jbpm.services.task.identity.JBossUserGroupCallbackImpl
@SuppressWarnings("restriction") private void dispProcNodes(ProcessInstance processInstance) { System.out.println("---"); WorkflowProcessInstanceImpl instance = (WorkflowProcessInstanceImpl) processInstance; for (Node node : instance.getNodeContainer().getNodes()) { //NodeContainer nc = node.getNodeContainer(); //Node[] nods = nc.getNodes(); System.out.println(">>id=[" + node.getId() + "], node.Name=[" + node.getName() + "]"); Map<String,Object> map =node.getMetaData(); for (String key : map.keySet()) { System.out.println(key + " = " + map.get(key)); } } System.out.println("---"); }
private void dispProcState(ProcessInstance processInstance) { int st =processInstance.getState(); switch(st){ case ProcessInstance.STATE_ACTIVE: System.out.println("st=STATE_ACTIVE"); break; case ProcessInstance.STATE_COMPLETED: System.out.println("st=STATE_COMPLETED"); break; case ProcessInstance.STATE_ABORTED: System.out.println("st=STATE_ABORTED"); break; default: System.out.println("st=" + st); break; } }
WorkflowProcessInstanceImpl wfpi = (WorkflowProcessInstanceImpl) processInstance; wfpi.setVariable(varName, "xxx");
TransactionManager tm = TransactionManagerServices.getTransactionManager(); tm.begin(); WorkflowProcessInstance wfpi = (WorkflowProcessInstance) ksession.getProcessInstance(processinstance.getId()); wfpi.setVariable("user", "abc"); System.out.println("after set: " + wfpi.getVariable("user")); tm.commit();
String val = (String) getVariableValue(varName, processInstance.getId(), ksession); System.out.println("val=" + val);
Map<String,Object> vmap = wfpi.getVariables(); for(String s : vmap.keySet()){ System.out.println( s + "=" + vmap.get(s) ); }
ContextableInstance ci = (ContextableInstance) processInstance; VariableScopeInstance vsi = (VariableScopeInstance)ci.getContextInstance(VariableScope.VARIABLE_SCOPE); VariableScope vs = vsi.getVariableScope(); List<Variable> vars = vs.getVariables(); for(int i = 0 ; i < vars.size(); i++ ){ System.out.println(vars.get(i).getName() + "=" + vars.get(i).getValue()); }
RuntimeManager manager = createRuntimeManager( Strategy.PROCESS_INSTANCE, "sample.bpmn","subpro.bpmn"); RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get());
CommandBasedStatefulKnowledgeSession > StatefulKnowledgeSession > KieSession, KnowledgeRuntime, KnowledgeRuntimeEventManager
StatefulSession >WorkingMemory >WorkingMemoryEntryPointなので違う
org.jbpm.eclipse/jBPM.Runtimes=jBPM runtime#./runtime#true#