-
1. Re: [jbpm 5.0] Dynamic process creation
Stephen McConnell Jan 2, 2012 9:41 PM (in response to Atul Kotwale)Don't know about version 5.0, but from the 5.2 documentation I've been reading ...
Section 5.1.3 of the User's Guide seems to have the dynamic process creation covered.
http://docs.jboss.org/jbpm/v5.2/userguide/ch05.html#d0e783
There is not a "template" construct as such, however, there are reusable sub-processes.
http://docs.jboss.org/jbpm/v5.2/userguide/ch05.html#d0e1303
/Steve.
-
2. Re: [jbpm 5.0] Dynamic process creation
Atul Kotwale Jan 3, 2012 2:28 AM (in response to Stephen McConnell)Hi Steve,
Thanks for your help. I created the dynamic process as mentioned in the userguide but it does not mentioned that how we can start the process instance ? I tried every possible way but i am not able to start it.
-
3. Re: [jbpm 5.0] Dynamic process creation
Stephen McConnell Jan 3, 2012 8:16 PM (in response to Atul Kotwale)Atul:
I have absolutly no idea if this will be useful or not - but for what it's worth, I found the following fragment of code under a samples package.
I've hilighted the lines that may help.
package org.jbpm.bpmn2;
import org.drools.KnowledgeBase;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.io.ResourceFactory;
import org.drools.runtime.StatefulKnowledgeSession;
import org.jbpm.bpmn2.xml.XmlBPMNProcessDumper;
import org.jbpm.ruleflow.core.RuleFlowProcess;
import org.jbpm.ruleflow.core.RuleFlowProcessFactory;
public class ProcessFactoryTest extends JbpmJUnitTestCase {
public void testProcessFactory() {
RuleFlowProcessFactory factory = RuleFlowProcessFactory.createProcess("org.jbpm.process");
factory
// header
.name("My process").packageName("org.jbpm")
// nodes
.startNode(1).name("Start").done()
.actionNode(2).name("Action")
.action("java", "System.out.println(\"Action\");").done()
.endNode(3).name("End").done()
// connections
.connection(1, 2)
.connection(2, 3);
RuleFlowProcess process = factory.validate().getProcess();
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(
ResourceFactory.newByteArrayResource(
XmlBPMNProcessDumper.INSTANCE.dump(process).getBytes()),
ResourceType.BPMN2);
KnowledgeBase kbase = kbuilder.newKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ksession.startProcess("org.jbpm.process");
}}
Please let me know how this goes.
If it works then it needs to be included in the User's Guide (or perhaps an equivalent that uses a nice utility method that keeps some of the noise out of the picture).
Cheers, Steve.
-
4. Re: [jbpm 5.0] Dynamic process creation
Atul Kotwale Jan 4, 2012 12:11 AM (in response to Stephen McConnell)Hi Steve,
Thanks a lot. It works for me !!!
-
5. Re: [jbpm 5.0] Dynamic process creation
Stephen McConnell Jan 4, 2012 6:16 PM (in response to Atul Kotwale)Atul:
Thank you for the confirmation.
We now have four problems to deal with:
- the User Guide is incomplete and someone needs to take care of updating things to include the additional code
- the published APIs do not include any of the org.jbpm.** content
- the quality of org.jbpm package, class, and method documentation is not production ready
- and probably a roadmap dealing with documentation
Cheers, Steve.