6 Replies Latest reply on Apr 3, 2006 8:05 AM by d b

    process definition question

    dolph lundgren Newbie

      I am a bit confused regarding the definition of a process.

      Below is a small process I try to create:
      I have two tasks:
      a) writing a book
      b) reading a book

      I create one swimlane for people that can read, and one swimlane for people that can write.

      At the deployment processdefinition I do not know which users that belong to the swimlanes,
      so I want to assign the actors after I have instantiated the process
      (by fetching swimlanes and do something like

      However, I get errors when deploying/instantiating the process (see below), but I cannot see that my process definition is much different than any examples I can find.

      Can you guys help me out with what is wrong?

      I also noticed that the start-state is not listed as an element in the schema (but is referred to in that document, so I assume that is just an error in the schema? )

      Thankful for any help.

      <?xml version="1.0" encoding="UTF-8"?>
       xsi:schemaLocation="http://jbpm.org/3/jpdl http://jbpm.org/xsd/jpdl-3.0.xsd"
       <swimlane name="writer"/>
       <swimlane name="reader"/>
       <start-state name="start">
       <transition name="tr1" to="first"></transition>
       <state name="first">
       <transition name="tr1" to="writeBook"></transition>
       <task-node name="writeBook">
       <task swimlane="writer">
       <variable name="booktitle" />
       <transition name="tr1" to="BookIsWritten"></transition>
       <state name="BookIsWritten">
       <transition name="tr1" to="readBook"></transition>
       <task-node name="readBook">
       <task swimlane="reader">
       <variable name="review" />
       <transition name="tr1" to="BookHasBeenRead"></transition>
       <state name="BookHasBeenRead">
       <transition name="tr1" to="end"></transition>
       <end-state name="end"></end-state>

      errors I get when I try deploy & instantiate the process:

      20:27:40,953 WARN ErrorCounter : *** WARNING: Keyword 'end' is being intepreted as an identifier due to: expecting IDENT, found 'end'
      Hibernate: select taskinstan0_.ID_ as ID1_, taskinstan0_.NAME_ as NAME2_26_, taskinstan0_.DESCRIPTION_ as DESCRIPT3_26_, taskinstan0_.ACTORID_ as ACTORID4_26_, taskinstan0_.CREATE_ as CREATE5_26_, taskinstan0_.START_ as START6_26_, taskinstan0_.END_ as END7_26_, taskinstan0_.DUEDATE_ as DUEDATE8_26_, taskinstan0_.PRIORITY_ as PRIORITY9_26_, taskinstan0_.ISCANCELLED_ as ISCANCE10_26_, taskinstan0_.ISSIGNALLING_ as ISSIGNA11_26_, taskinstan0_.ISBLOCKING_ as ISBLOCKING12_26_, taskinstan0_.TASK_ as TASK13_26_, taskinstan0_.TOKEN_ as TOKEN14_26_,
      taskinstan0_.SWIMLANINSTANCE_ as SWIMLAN15_26_, taskinstan0_.TASKMGMTINSTANCE_ as TASKMGM16_26_ from JBPM_TASKINSTANCE taskinstan0_ where taskinstan0_.ACTORID_=? and (taskinstan0_.END_ is null) and taskinstan0_.ISCANCELLED_=false
      20:27:41,593 DEBUG JpdlXmlReader :
      process definition line 13: cvc-complex-type.2.4.a: Invalid content was found starting with element 'start-state'. One of
      "http://jbpm.org/3/jpdl":state, "http://jbpm.org/3/jpdl":task-node, "http://jbpm.org/3/jpdl":super-state,
      "http://jbpm.org/3/jpdl":process-state, "http://jbpm.org/3/jpdl":node,
      "http://jbpm.org/3/jpdl":fork, "http://jbpm.org/3/jpdl":join,
      "http://jbpm.org/3/jpdl":decision, "http://jbpm.org/3/jpdl":end-state, "http://jbpm.org/3/jpdl":action,
      "http://jbpm.org/3/jpdl":script, "http://jbpm.org/3/jpdl":create-timer, "http://jbpm.org/3/jpdl":cancel-timer,
      "http://jbpm.org/3/jpdl":task, "http://jbpm.org/3/jpdl":event, "http://jbpm.org/3/jpdl":exception-handler}' is expected.
      20:27:41,656 DEBUG JpdlXmlReader : process definition line 13: cvc-complex-type.2.4.a: Invalid content was found starting with element
       'start-state'. One of '{"http://jbpm.org/3/jpdl":swimlane,
      "http://jbpm.org/3/jpdl":state, "http://jbpm.org/3/jpdl":task-node, "http://jbpm.org/3/jpdl":super-state,
      "http://jbpm.org/3/jpdl":process-state, "http://jbpm.org/3/jpdl":node, "http://jbpm.org/3/jpdl":fork,
      "http://jbpm.org/3/jpdl":join, "http://jbpm.org/3/jpdl":decision, "http://jbpm.org/3/jpdl":end-state, "http://jbpm.org/3/jpdl":action,
      "http://jbpm.org/3/jpdl":script, "http://jbpm.org/3/jpdl":create-timer, "http://jbpm.org/3/jpdl":cancel-timer,
      "http://jbpm.org/3/jpdl":task, "http://jbpm.org/3/jpdl":event, "http://jbpm.org/3/jpdl":exception-handler}' is expected.

        • 1. Re: process definition question
          dolph lundgren Newbie

          ignore this thread;

          it seems like it was all related to that 3.0.1 was not the latest version; it does not complain about that anymore
          (it complains about other stuff instead, but will dig into that)

          • 2. Re: process definition question
            dolph lundgren Newbie

            Hmm....I think I have misunderstood how swimlanes works, I would be grateful if someone could point out where I go wrong;

            When I deploy my processdefinition, my swimlanes are in JBPM_SWIMLANE;

            When I create an instantiate of my processdefinition, I thought that the swimlanes would be instantiated and appear in JBPM_SWIMLANEINSTANCE;
            but that is not the case....why not?

            The code below I thought would be the way to dynamically add an actor to a swimlane after I instantiated the process, however, the swimlane ("reader") is null.....

            ProcessDefinition processDefinition =
            ProcessInstance processInstance =
             new ProcessInstance(processDefinition);
            //fetch the TaskMgmtInstance
            TaskMgmtInstance myTaskMgmtInstance = processInstance.getTaskMgmtInstance();
            //get the "reader" swimlane
            SwimlaneInstance swimLaneInstance = myTaskMgmtInstance.getSwimlaneInstance("reader");
             fail("reader swimlane is null");
            //assign user "donald" (he can read a book, but is crap at writing books)

            • 3. Re: process definition question
              Hannes Stillerich Newbie

              I think that the Swimlanes dont get immediately instantiated. (=SwinlaneInstance).
              You may get all swimlanes with:

              Map swimlanes = processDefinition.getTaskMgmtDefinition().getSwimlanes();

              Then you can explicit ensure that the swimlanes are available -
              I got this snippet from somewhere else in the forum (from brittm):
              SwimlaneInstance swi = pi.getTaskMgmtInstance()
               new ExecutionContext(pi.getRootToken()), swimlane);

              better you take a look in here: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=74156

              • 4. Re: process definition question
                d b Newbie

                many thanks for the pointer to that thread, very useful!
                (no idea what I search for yesterday since i couldnt find it)

                I now managed to start it off, and assign a user to the swimlane

                //get a swimlane
                SwimlaneInstance swimLaneInstance = myTaskMgmtInstance.getSwimlaneInstance("reader");
                //assign user "donald" as reader

                after that I call signal() until the process holds at the first task assigned to that swimlane.

                Now I try to call the task list for the user "donald", but I get an exception thrown at me e=java.lang.reflect.UndeclaredThrowableException
                This is my code for fetching the task list
                 public List getUserTasks(String uid) {
                 List myTasks =null;
                 JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
                 TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession();
                 myTasks = taskMgmtSession.findTaskInstances( uid );
                 } finally {
                 return myTasks;

                If I try to call the tasks assigned to any other uid I get return 0 (which I would expect since no one else got tasks to do)

                Do I need to add a userid somewhere else in jBPM or can I take any string and pass it on to setActorId(), and jBPM will regard him as a proper user?

                • 5. Re: process definition question
                  d b Newbie

                  I might add that the task exist in jbpm_taskinstance, is open and assigned to "donald".

                  So imo the named query should have matched....

                  • 6. Re: process definition question
                    d b Newbie

                    it does not seem to be a jBPM problem,
                    the problem seems to be when I try to return the List over the EJB remote interface
                    (not possible to serialize?)

                    hm. any ideas how to get around that?