-
1. Re: Communication between JBoss jBPM application and a web a
kukeltje Oct 22, 2007 10:44 AM (in response to kamleshkr)the same steps you would do in just using the api, or the ones done in the webconsole or in the struts example in the wiki:
Get a reference to a JbpmContext and perform all operations on that api.
Look at the examples/source/testcases a little and all will become clear ;-) -
2. Re: Communication between JBoss jBPM application and a web a
kamleshkr Oct 23, 2007 1:31 AM (in response to kamleshkr)Hi Ronald,
Thanks for your response..
I am still not able to get it. I have seen the testcase class. In this class the ProcessDefinition is instantiated by parsing the corresponding xml file and then ProcessInstance is created using the ProcessDefinition.
But the thing is, what code i will write inside my jsp to call the application. Means suppose i want to call the example/websale application from my index.jsp, what code i should write? can you elaborate it with some piece of code.
Thanks
Kamlesh -
3. Re: Communication between JBoss jBPM application and a web a
dleerob Oct 23, 2007 3:59 AM (in response to kamleshkr)All the code you require is in the jbpm-console web application source code. That's probably where most people will learn how to interact with the Jbpm lilbraries.
For example, here is a method in one of my action classes, which shows how I start a process in my own web application:public ActionForward startProcess(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { if (log.isDebugEnabled()) { log.debug("Entering 'startProcess' method"); } User currentUser = getUser(request); String processDefinitionIdStr = request.getParameter("processDefinitionId"); long processDefinitionId = Long.parseLong(processDefinitionIdStr); jbpmContext.setActorId(currentUser.getUsername()); GraphSession graphSession = jbpmContext.getGraphSession(); ProcessDefinition processDefinition = graphSession.getProcessDefinition(processDefinitionId); ProcessInstance processInstance = processDefinition.createProcessInstance(); // Signal the root token based on the following criteria: // 1. If there is no start task, and // 2. If the root token is still at the start state, and // 3. If the start state has a default leaving transition, then // signal the token along the default transition. TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance(); //set the current user as the initiator processInstance.getContextInstance().setVariable("sys_initiator", currentUser.getUsername()); TaskInstance startTaskInstance = taskMgmtInstance.createStartTaskInstance(); if (startTaskInstance == null) { // There is no start task Node initialNode = processDefinition.getStartState(); Token rootToken = processInstance.getRootToken(); Node rootTokenNode = rootToken.getNode(); if (initialNode.getId() == rootTokenNode.getId()) { // The root token is still at the start node Transition defaultLeavingTransition = initialNode.getDefaultLeavingTransition(); if (defaultLeavingTransition != null) { // There's a default transition rootToken.signal(defaultLeavingTransition); System.out.println("Signalled Root Token"); } } } System.out.println("Started"); if (processInstance.hasEnded()) { System.out.println("Finished"); } // Nothing else saves the process, so we must jbpmContext.save(processInstance); return mapping.findForward("myTasks"); }
And guess what, if I remember correctly, that was taken almost exactly as it from the jbpm-console webapp source code. So take a look there if you need help.
Good luck! -
4. Re: Communication between JBoss jBPM application and a web a
kamleshkr Oct 24, 2007 4:26 AM (in response to kamleshkr)I understood a bit about how to call the process from a servlet. But in order to run this piece of code how should I integrate my jbpm application which is in eclipse workspace into my web-application ? Please tell me the steps. .
-
5. Re: Communication between JBoss jBPM application and a web a
kamleshkr Oct 24, 2007 6:56 AM (in response to kamleshkr)Where is the jbpm-console source code. I have the jbpm-console.war, but after unzipping it i find no *.jsf files in it
-
6. Re: Communication between JBoss jBPM application and a web a
kamleshkr Oct 24, 2007 7:30 AM (in response to kamleshkr)Sorry by *.jsf files i mean the source code of the class file to which the *.jsf files are mapped in web.xml
-
7. Re: Communication between JBoss jBPM application and a web a
dleerob Oct 24, 2007 8:26 AM (in response to kamleshkr)This thread can help you get the source code: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=114954