[JBoss jBPM] - Re: how to use Decision nodes??????
by minam97531
i could make the process definition work. (the one that i put above with name "mytest"). it's problem was swimlanes that i assigned!
but i still have the same problem, using handler class in decision nodes! :(
when i make new instance of websale process definition, in "check-for-another-web-order" task, if i select either "yes" or "no",i get the following error:
Entering node evaluate-another-web-order
ERROR [com.liferay.jbpm.WorkflowComponentImpl] Task has already ended
i made some changes to the original websale example to make it easier to check.
this is the first time i write a unit test, so i hope it's correct.
here's the unit test:
| import java.util.Collection;
|
| import junit.framework.TestCase;
|
| import org.jbpm.graph.def.ProcessDefinition;
| import org.jbpm.graph.exe.ProcessInstance;
| import org.jbpm.taskmgmt.exe.TaskInstance;
|
| public class DecisionTest {
|
| private static final String TEST_PROCESS =
| "<?xml version=\"1.0\" >"
| +"<process-definition name=\"websale\">"
| +"<!-- Event Logging -->"
| +"<event type=\"node-enter\">"
| +"<script>System.out.println(\"Entering node \" + node.getName());</script>"
| +" </event>"
| +"<event type=\"node-leave\">"
| +"<script>System.out.println(\"Leaving node \" + node.getName());</script>"
| +"</event>"
| +"<!-- Swimlanes -->"
| +"<swimlane name=\"user\" />"
| +"<!-- Nodes -->"
| +"<start-state name=\"initiate-process\">"
| +"<task swimlane=\"user\">"
| +"<controller>"
| +"<variable name=\"textarea:description\" />"
| +"</controller>"
| +"</task>"
| +"<transition name=\"save\" to=\"create-new-web-sale-order\" />"
| +"</start-state>"
| +"<task-node name=\"create-new-web-sale-order\">"
| +"<task swimlane=\"user\">"
| +"<controller>"
| +"<variable name=\"text:item\" access=\"read,write,required\" />"
| +"</controller>"
| +"</task>"
| +"<transition name=\"submit\" to=\"check-for-another-web-order\" />"
| +"</task-node>"
| +"<task-node name=\"check-for-another-web-order\">"
| +"<task swimlane=\"user\">"
| +"<controller>"
| +"<variable name=\"radio:perform-another-order:yes,no\" />"
| +"</controller>"
| +"</task>"
| +"<transition name=\"submit\" to=\"decision\">"
| +"</transition>"
| +"</task-node>"
| +"<decision name=\"decision\">"
| +"<handler class=\"com.liferay.jbpm.handler.WebOrderDecisionHandler\" />"
| +"<transition name=\"finished\" to=\"disagree\" />"
| +"<transition name=\"another\" to=\"agree\" />"
| +"</decision>"
| +"<task-node name=\"agree\">"
| +"<task swimlane=\"user\">"
| +"<controller>"
| +"<variable name=\"text:hello\" />"
| +"</controller>"
| +"</task>"
| +"<transition name=\"submit\" to=\"end\">"
| +"</transition>"
| +"</task-node>"
| +"<task-node name=\"disagree\">"
| +"<task swimlane=\"user\">"
| +"<controller>"
| +"<variable name=\"text:goodbye\" />"
| +"</controller>"
| +"</task>"
| +"<transition name=\"submit\" to=\"end\">"
| +"</transition>"
| +"</task-node>"
| +"<end-state name=\"end\" />"
| +"</process-definition>";
|
| public void testExpression() {
| ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(TEST_PROCESS);
| ProcessInstance processInstance = processDefinition.createProcessInstance();
| processInstance.getContextInstance().setVariable("textarea:description", "something");
| processInstance.signal();
| processInstance.getContextInstance().setVariable("text:item", "book");
| processInstance.signal();
| processInstance.getContextInstance().setVariable("radio:perform-another-order:yes,no", "yes");
| processInstance.signal();
| assertEquals(processDefinition.getNode("agree"), processInstance.getRootToken().getNode());
| }
|
| }
|
and this is WebOrderDecisionHandler.java:
| import org.jbpm.context.exe.ContextInstance;
| import org.jbpm.graph.exe.ExecutionContext;
| import org.jbpm.graph.node.DecisionHandler;
|
| /**
| * <a href="WebOrderDecisionHandler.java.html"><b><i>View Source</i></b></a>
| *
| * @author Charles May
| *
| */
| public class WebOrderDecisionHandler implements DecisionHandler {
|
| public String decide(ExecutionContext executionContext) throws Exception {
| ContextInstance contextInstance = executionContext.getContextInstance();
|
| String decision = null;
|
| String buyerResponse = (String)contextInstance.getVariable(
| "radio:perform-another-order:yes,no");
|
| if (buyerResponse.equals("yes")) {
| decision = "another";
| }
| else {
| decision = "finished";
| }
|
| return decision;
| }
|
| }
|
one another question: where should i put WebOrderDecisionHandler.class?? maybe i put it in wrong path.
thanks again.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4165800#4165800
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4165800
17 years, 8 months
[JBoss jBPM] - datasource error in running a JSP in a JBPM JSP application
by ssidhanta
Hi,
I am still stuck with the same error as follows while deploying a JBPM application in JBPM Starter Toolkit.
My hibernate.cfg.xml file in the Application's bin folder is as follows:
org.hibernate.dialect.Oracle9Dialect
oracle.jdbc.driver.OracleDriver
jdbc:oracle:thin:peerless/peerless@10.31.6.215:1522:coeidm
peerless
peerless
The hibernate.cfg.xml in the JBPM.sar folder is as follows:-
org.hibernate.dialect.Oracle9Dialect
<!--JbpmDS-->
oracle.jdbc.driver.OracleDriver
jdbc:oracle:thin:peerless/peerless@10.31.6.215:1522:coeidm
peerless
peerless
<!-- other hibernate properties -->
true
true
true
My application gets deployed fine with no errors.
But when running the JSP I get an error message as follows:
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Could not find datasource
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
root cause
org.hibernate.HibernateException: Could not find datasource
org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:366)
org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1823)
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1143)
org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:90)
org.jbpm.persistence.db.DbPersistenceServiceFactory.createSchema(DbPersistenceServiceFactory.java:108)
org.jbpm.JbpmConfiguration.createSchema(JbpmConfiguration.java:415)
org.jbpm.JbpmConfiguration.createSchema(JbpmConfiguration.java:407)
com.sample.action.CallProcess.testCallProcess(CallProcess.java:24)
org.apache.jsp.JSP.CallMethod_jsp._jspService(org.apache.jsp.JSP.CallMethod_jsp:58)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5 logs.
Thanks in anticipation.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4165787#4165787
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4165787
17 years, 8 months
[JBoss jBPM] - jbpm decision node EL and Bean
by ashishc
Hi All,
I want to refer to a value from a bean in a jbpm decision node, but not able to get that using EL. I can write the decision handler and do it that way, but i would prefer using the EL. Can anyone help me in that?
Here is what i am doing.
<?xml version="1.0" encoding="UTF-8"?>
| <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="http-demo-process">
| <swimlane name="initiator">
| <assignment actor-id="manager" />
| </swimlane>
| <start-state name="start">
| <transition to="call action"></transition>
| </start-state>
| <node name="call action">
| <action class="com.sample.action.MessageActionHandler">
| <message>First message</message>
| </action>
| <transition to="hasMessage?"></transition>
| </node>
|
| <decision name="hasMessage?" expression="#{( ??????? ? 'true' : 'false')}">
| <transition name="true" to="post data"></transition>
| <transition name="false" to="end"></transition>
| </decision>
| <node name="post data">
| <action class="com.sample.action.PostActionHandler">
| </action>
| <transition to="end"></transition>
| </node>
| <end-state name="end"></end-state>
| </process-definition>
and here is the bean which i created.
package com.sample.bean;
import java.io.Serializable;
public class MyVariableBean implements Serializable{
private static final long serialVersionUID = 1L;
private Boolean myValue = true;
public MyVariableBean() {}
public Boolean getMyValue()
{
return myValue;
}
public void setMyValue(Boolean paramVal)
{
myValue = paramVal;
}
}
The value of MyValue is set in Message Action Handler...but then how should I refer to the MyValue in decision node EL??
Please help..
thanks
ashish
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4165680#4165680
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4165680
17 years, 8 months