cancel
Showing results for 
Search instead for 
Did you mean: 

condition tag is not working properly

sofie24
Champ in-the-making
Champ in-the-making
Hi everyone,

I've developed a workflow, and he's working just fine. Except for the condition tag.
The goal of this workflow is that A starts with it, and send the document to B. B checks is the bill (that's the type of document which is send) is correct and fills in the amount on the bill. If the amount is less than 10000, the document must be sent to C otherwise if the amount is more than 10000, the document must be sent to D.

I have following code in my processdefinition:
<?xml version="1.0" encoding="UTF-8"?>

<process-definition
  xmlns="urn:jbpm.org:jpdl-3.1"  name="Facturatie2">
 
  <swimlane name="initiator" />
 
  <start-state name="start">
     <task name="wf:submitFirstReviewTask" swimlane="initiator" />
     <transition name="" to="start review" />
  </start-state>
 
  <node name="start review">
     <event type="node-enter">
        <script>
           <variabele name="wf_approveCount" access="read,write" />
           <variabele name="wf_outcome" access="read,write" />
           <expression>
              wf_approveCount = 0;
              wf_outcome = "";
           </expression>
        </script>
     </event>
     <transition name="review" to="review" />
  </node>
 
  <task-node name="review">
     <task name="wf:checkBillTask">
        <assignment actor-id="vandenackers" />
     </task>
     <transition name="reject" to="rejected" />
     <transition name="approve" to="isApproved">
        <script>
           <variabele name="wf_actualAmount" access="read,write" />
           <expression>
              wf_actualAmount = wf_amount;
           </expression>
        </script>
     </transition>
  </task-node>
 
  <decision name="isApproved">
     <transition name="groter" to="controleDoorC">
        <condition>#{wf_actualAmount >= 10000}</condition>
     </transition>
     <transition name="kleiner" to="controleDoorB">
        <condition>#{wf_actualAmount &lt; 10000}</condition>
     </transition>
  </decision>
 
  <task-node name="rejected">
     <task name="wf:billRejectedTask" swimlane="initiator" />
     <transition name="" to="end" />
  </task-node>
 
  <task-node name="controleDoorB">
     <task name="billReviewTask">
        <assignment actor-id="vandenackere" />
     </task>
     <transition name="reject" to="rejected" />
     <transition name = "approve" to="approved" />
  </task-node>
 
  <task-node name="controleDoorC">
     <task name="billReviewTask">
        <assignment actor-id="vandenackerk" />
     </task>
     <transition name="reject" to="rejected" />
     <transition name="approve" to="approved" />
  </task-node>
 
  <task-node name="approved">
     <task name="wf:billApprovedTask">
        <assignment actor-id="vandenackers"/>
     </task>
     <transition name="" to="end"/>
  </task-node>
 
  <end-state name="end" />
</process-definition>

The changes I maid to the other xml-files are following:
workflowModel.xml

<type name="wf:submitFirstReviewTask">
         <parent>bpm:startTask</parent>
      </type>

<type name="wf:checkBillTask">
         <parent>bpm:workflowTask</parent>
        <overrides>
            <property name="bpm:packageItemActionGroup">
               <default>edit_package_item_actions</default>
            </property>
        </overrides>
       <mandatory-aspects>
            <aspect>wf:firstReviewStats</aspect>
         </mandatory-aspects>
      </type>

<type name="wf:billReviewTask">
         <parent>bpm:workflowTask</parent>
         <overrides>
            <property name="bpm:packageItemActionGroup">
               <default>edit_package_item_actions</default>
            </property>
         </overrides>
      </type>
     
      <type name="wf:billApprovedTask">
         <parent>bpm:workflowTask</parent>
      </type>

<type name="wf:billRejectedTask">
         <parent>bpm:workflowTask</parent>
      </type>

<aspect name="wf:firstReviewStats">
            <properties>
               <property name="wf:outcome">
                  <type>d:text</type>
               </property>
               <property name="wf:amount">
                  <type>d:double</type>
               </property>
            </properties>
        </aspect>

The problem is that A fills in an amount, and it doesn't matter how big or how little the amount is, it is always send to C.

I think that the problem has something to do with the following lines:
<decision name="isApproved">
     <transition name="groter" to="controleDoorC">
        <condition>#{wf_actualAmount >= 10000}</condition>
     </transition>
     <transition name="kleiner" to="controleDoorB">
        <condition>#{wf_actualAmount &lt; 10000}</condition>
     </transition>
  </decision>



I've tried in the condition tag "&ge;" "<" but I got errors here. It sais that I can't use "&ge;"  or that with "<" the closing tag is missing.

Does anyone knows where the problem is, because I can't see it.
If you don't know it, could you please tell me where I had to put the java-class with a decisionHandler in it.

I hope someone answers me soon, because I'm really desperate. This project decides if I pass my final year at university or not!

So please help me

Sofie
5 REPLIES 5

davidc
Star Contributor
Star Contributor
First, you may want to check the value of wf_actualAmount and second, the first transition is taken if all others do not match their condition.

<decision name="isApproved"> 
  <event type="node-enter">
      <script>
         System.out.println(wf_actualAmount);
      </script>
  </event>
  <transition name="groter" to="controleDoorC" />
  <transition name="kleiner" to="controleDoorB">
     <condition>#{wf_actualAmount &lt; 10000}</condition>
  </transition>
</decision>

sofie24
Champ in-the-making
Champ in-the-making
Hi David,

I've tried this, but I always get the same error:

ERROR [org.alfresco.web.ui.common.Utils] A system error happened during the operation: Failed to signal transition 'approve' from workflow task 'jbpm$287'
org.alfresco.service.cmr.workflow.WorkflowException: Failed to signal transition 'approve' from workflow task 'jbpm$287'
   at org.alfresco.repo.workflow.jbpm.JBPMEngine.endTask(JBPMEngine.java:1064)
   at org.alfresco.repo.workflow.WorkflowServiceImpl.endTask(WorkflowServiceImpl.java:347)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
   at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:116)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentImpl.java:219)
   at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:165)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
   at $Proxy22.endTask(Unknown Source)
   at org.alfresco.web.bean.workflow.ManageTaskDialog.transition(ManageTaskDialog.java:389)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
   at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
   at javax.faces.component.UICommand.broadcast(UICommand.java:106)
   at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
   at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
   at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
   at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:105)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:81)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
Caused by: org.jbpm.graph.def.DelegationException
   at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:352)
   at org.jbpm.graph.def.GraphElement$$FastClassByCGLIB$$7a7d6aa6.invoke(<generated>)
   at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:163)
   at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:161)
   at org.jbpm.graph.def.ProcessDefinition$$EnhancerByCGLIB$$d9e3753a.raiseException(<generated>)
   at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:346)
   at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:249)
   at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:212)
   at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:182)
   at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:166)
   at org.jbpm.graph.def.Node.enter(Node.java:301)
   at org.jbpm.graph.def.Node$$FastClassByCGLIB$$d187eeda.invoke(<generated>)
   at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:163)
   at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:161)
   at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$772ac8ca.enter(<generated>)
   at org.jbpm.graph.def.Transition.take(Transition.java:119)
   at org.jbpm.graph.def.Node.leave(Node.java:383)
   at org.jbpm.graph.node.TaskNode.leave(TaskNode.java:198)
   at org.jbpm.graph.node.TaskNode$$FastClassByCGLIB$$923668a4.invoke(<generated>)
   at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:163)
   at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:161)
   at org.jbpm.graph.node.TaskNode$$EnhancerByCGLIB$$b170bf14.leave(<generated>)
   at org.jbpm.graph.exe.Token.signal(Token.java:174)
   at org.jbpm.graph.exe.Token.signal(Token.java:145)
   at org.jbpm.graph.exe.Token$$FastClassByCGLIB$$74df1c6e.invoke(<generated>)
   at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:163)
   at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:161)
   at org.jbpm.graph.exe.Token$$EnhancerByCGLIB$$23b96f5e.signal(<generated>)
   at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:444)
   at org.alfresco.repo.workflow.jbpm.WorkflowTaskInstance.end(WorkflowTaskInstance.java:126)
   at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:383)
   at org.alfresco.repo.workflow.jbpm.JBPMEngine$19.doInJbpm(JBPMEngine.java:1049)
   at org.springmodules.workflow.jbpm31.JbpmTemplate$1.doInHibernate(JbpmTemplate.java:87)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:365)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:333)
   at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:80)
   at org.alfresco.repo.workflow.jbpm.JBPMEngine.endTask(JBPMEngine.java:1017)
   … 52 more
Caused by: Sourced file: inline evaluation of: ``System.out.println(wf_actualAmount);'' : Undefined argument: wf_actualAmount  : at Line: 1 : in file: inline evaluation of: ``System.out.println(wf_actualAmount);'' : ( wf_actualAmount )

   at bsh.BSHArguments.getArguments(Unknown Source)
   at bsh.BSHMethodInvocation.eval(Unknown Source)
   at bsh.BSHPrimaryExpression.eval(Unknown Source)
   at bsh.BSHPrimaryExpression.eval(Unknown Source)
   at bsh.Interpreter.eval(Unknown Source)
   at bsh.Interpreter.eval(Unknown Source)
   at bsh.Interpreter.eval(Unknown Source)
   at org.jbpm.graph.action.Script.eval(Script.java:129)
   at org.jbpm.graph.action.Script.eval(Script.java:72)
   at org.jbpm.graph.action.Script.execute(Script.java:61)
   at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:235)
   … 82 more

Any idea what went wrong?

Sofie

sofie24
Champ in-the-making
Champ in-the-making
Hi

I did it on an other way. Instead of using System.out.println, I show an inputfield (which is obviously greyed out) with the value of wf_actualAmount (this works). And the result I get is 0 (no matter which value the wf_actualAmount has).

Does anyone of you see why the value isn't send with the worklfow?

Kind regards

Sofie

sofie24
Champ in-the-making
Champ in-the-making
Hi David

thanks for your help.

Now it works!! It seems that my mind is working very slowly today  Smiley Very Happy

Many thanks

Sofie

sofie24
Champ in-the-making
Champ in-the-making
I think I was just a little overwhelming  Smiley Surprisedops:

It just worked for one time, but after that it didn't work anymore.
I think that it all went wrong when the value of wf_actualAmount must be passed. It still doesn't pass this value. Does anyone see were this went wrong? I can't see it.

Sofie

p.s.: the code is in the first post of this topic