[JBoss jBPM] - Help getting a condition to work
by earniedyke
Greetings all!!!!
I have been trying all day to get, what I think, is a simple process to work. I can never get it to think the account is NOT locked. No matter what value I set the locked variable to it always takes the default transition. I have tried every style of condition I could find referenced in this forum all to no avail.
Any and all help would be appreciated.
Earnie!
processdefinition.xml
<?xml version="1.0" encoding="UTF-8"?>
|
| <process-definition
| xmlns="urn:jbpm.org:jpdl-3.1" name="test2">
| <start-state name="BeginLogin">
| <transition name="toCheckForLock" to="CheckForLockedAccount"></transition>
| </start-state>
| <end-state name="End"></end-state>
| <decision name="CheckForLockedAccount">
| <transition name="Account is locked" to="AccountIsLocked"></transition>
| <transition name="Account is not locked" to="AccountIsNotLocked">
| <condition expression="#{contextInstance.variables['locked'] == 'N'}"/>
| </transition>
| </decision>
| <node name="AccountIsLocked">
| <controller>
| <variable name="message">Is</variable>
| </controller>
| <transition name="toEnd" to="End"></transition>
| </node>
| <node name="AccountIsNotLocked">
| <controller>
| <variable name="message">Is NOT</variable>
| </controller>
| <transition name="toEnd" to="End"></transition>
| </node>
| </process-definition>
test case:
package com.sample;
|
| import java.io.FileInputStream;
|
| import junit.framework.TestCase;
|
| import org.jbpm.*;
| import org.jbpm.graph.def.ProcessDefinition;
| import org.jbpm.graph.exe.ProcessInstance;
|
| public class SimpleProcessTest extends TestCase {
| public void testSimpleProcess() throws Exception {
| JbpmConfiguration cfg = JbpmConfiguration.getInstance();
| JbpmContext ctx = cfg.createJbpmContext();
| try {
| FileInputStream fis = new FileInputStream("processes/test2/processdefinition.xml");
| ProcessDefinition processDefinition = ProcessDefinition.parseXmlInputStream(fis);
| ctx.deployProcessDefinition(processDefinition);
|
| ProcessInstance instance = ctx.getGraphSession().findLatestProcessDefinition("test2").createProcessInstance();
|
| instance.getContextInstance().setVariable("locked","N");
|
| instance.signal();
| System.out.println(instance.getContextInstance().getVariable("message") + " Locked? " + instance.getContextInstance().getVariable("locked"));
| } finally {
| ctx.close();
| cfg.close();
| }
| }
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970827#3970827
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970827
19 years, 7 months
[JBoss Seam] - Re: Scope/Context feedback
by texan
While I have to agree with you that the blog example does use this, it's not exactly the best way to show it. That is, that example is showing an already-complicated flow of control and it hard to compare that with more straightforward code.
Although I do use the pull approach for one of my pages that doesn't need any inputs, I wouldn't dream of using the RESTful approach as shown in the tutorial (bookmarkable search results). What I mean is, I want to be able to take vacations and count on the fact that my peers can decipher the flow of the application without calling me.
I think it's great that this kind of stuff exists, but it's hard enough to read other people's code without having to figure out the magic of @Factory and @Unwrap code. Maybe as we use Seam a little more, we'll start taking advantage of more sophisticated features and will laugh at how closed-minded we were "back then", but for now, we have to keep it simple so we can keep our heads above the rising flood of new technology.
We're all from a Struts/JSP background and are struggling to absorb JSF/MyFaces, Facelets, Seam, and EJB3 all at once. The chain of events went like this:
1. Struts is just plain old news: I hear that JSF 1.2 was released and is much improved.
2. Supposedly, 1.2 solves "all the hassles" that caused us to ignore JSF for years
3. Oops, 1.2 fixed some problems, but JSF is still really messy due to the XML configuration complexity and other hassles.
4. Hey, I hear that JBoss released this Seam thing that is supposed to make JSF development more intuitive.
5. Wow, it's amazing how much configuration and glue Seam eliminates, and it provides some new features as well that aren't really provided elsewhere.
6. What the $#^@! ??? Did you see what they said about EJB3 in the Seam manual? We just ignored the EJB articles because it was always too clumsy, but now it's awesome!
7. Unbelievable, look what they did with Entity Beans! About damn time.
8. Okay, we'll use JSF, Seam, and EJB3
9. Man, JSPs still kind of suck, but the Seam tutorial and some examples use this Facelets thing that eliminates JSP and adds some templating featues. Okay, we'll use that too.
10. Well, the JSF data table is okay, but I hear that MyFaces has a nicer version with sorting and paging. Okay, we'll use that too, and we'll get some of the other MyFaces features we've heard about.
11. And here we are, learning it all at once.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970821#3970821
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970821
19 years, 7 months