9 Replies Latest reply on Aug 7, 2006 12:30 PM by Michael Holtzman

    Task priority problem

    Guillem Gelabert Newbie

      I'm trying to set some priorities for my tasks in diferent task-nodes with the following jpdl file:

      <process-definition name="traspaso_propiedad">
       <start-state name="start">
       <transition to="nota_registro" />
       <task-node name="nota_registro">
       <task name="recopilardatos.inmueble.registro" priority="1">
       <assignment class="com.okkum.arada.workflow.assignment.GenericAssign" />
       <task name="solicitar.nota.registro" priority="1">
       <assignment class="com.okkum.arada.workflow.assignment.GenericAssign" />
       <task name="recoger.nota.registro" priority="1">
       <assignment class="com.okkum.arada.workflow.assignment.GenericAssign" />
       <transition to="firma_notario" />
       <task-node name="firma_notario">
       <task name="entregar.escritura.notario" priority="1">
       <assignment class="com.okkum.arada.workflow.assignment.GenericAssign" />
       <task name="recoger.escritura.notario" priority="2">
       <assignment class="com.okkum.arada.workflow.assignment.GenericAssign" />
       <transition to="end" />
       <end-state name="end">

      But no matter the priority I set in the jpdl file, all Task instances get it's priority set to 3, the code I use to retrieve each task instance priority is this one:
       ProcessInstance processInstance = getProcessInstanceFromSession(session);
       Iterator itasks = processInstance.getTaskMgmtInstance().getTaskInstances().iterator();
       while (itasks.hasNext()){
       TaskInstance tempTask = (TaskInstance)itasks.next();
       if (logger.isDebugEnabled()){
       logger.debug("listTasks() - Tarea: " + tempTask.getName() + " Prioridad: " + tempTask.getPriority());

      And all I get is each task instance name (that's correct) but each one with priority set to 3. Any ideas?

        • 1. Re: Task priority problem
          Tom Baeyens Master


          thanks for reporting. i'll have a look later. you can monitor progress in the issue.

          regards, tom.

          • 2. Re: Task priority problem
            Michael Holtzman Newbie

            The JIRA issue for this is marked as closed, but it is STILL a problem.
            The priority assigned to the task in the process definition is not propagated to the task instance.

            If we look at the hibernate cfg for task ...

            <?xml version="1.0"?>
            <!DOCTYPE hibernate-mapping PUBLIC
             "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
            <hibernate-mapping default-access="field">
             <class name="org.jbpm.taskmgmt.def.Task"
             <cache usage="nonstrict-read-write"/>
             <id name="id" column="ID_"><generator class="native" /></id>
             <!-- GRAPHELEMENT -->
             <property name="name" column="NAME_" />
             <many-to-one name="processDefinition"
             <map name="events" cascade="all">
             <cache usage="nonstrict-read-write"/>
             <key column="TASK_" foreign-key="FK_EVENT_TASK" />
             <index column="EVENTTYPE_" type="string"/>
             <one-to-many class="org.jbpm.graph.def.Event" />
             <list name="exceptionHandlers" cascade="all">
             <cache usage="nonstrict-read-write"/>
             <key column="TASK_" foreign-key="none" />
             <list-index column="GRAPHELEMENTINDEX_" />
             <one-to-many class="org.jbpm.graph.def.ExceptionHandler" />
             <!-- ============ -->
             <property name="description" type="string_max" column="DESCRIPTION_" length="4000"/>
             <property name="isBlocking" column="ISBLOCKING_" />
             <property name="isSignalling" column="ISSIGNALLING_" />
             <property name="dueDate" column="DUEDATE_" />
             <property name="actorIdExpression" column="ACTORIDEXPRESSION_" />
             <property name="pooledActorsExpression" column="POOLEDACTORSEXPRESSION_" />
             <many-to-one name="taskMgmtDefinition"
             <many-to-one name="taskNode"
             <many-to-one name="startState"
             <many-to-one name="assignmentDelegation"
             cascade="all" />
             <many-to-one name="swimlane"
             <many-to-one name="taskController"
             cascade="all" />

            ... there is no property for PRIORITY. When a task instance is spawned from the task, it always gets the default priority of "3".

            • 3. Re: Task priority problem
              Ronald van Kuijk Master

              hmm.. the testcase itself does probably not use persistency, so it works as long as persistency is not involved. I reopend this issue. Lets see what Tom thinks about it. What version of jBPM are you using btw?

              • 4. Re: Task priority problem
                Michael Holtzman Newbie

                Currently using 3.1, but I hope to migrate to 3.1.2 in the next few weeks.

                • 5. Re: Task priority problem
                  Ronald van Kuijk Master

                  hmm..... I looked into this a little and came to the conclusion (should have seen that directly) that your hbm file is for the the task in the process definition, org.jbpm.taskmgmt.def.Task. Task instances are in org.jbpm.taskmgmt.exe.TaskInstance. The accompanying hbm file contains the priority, at least it does in the 3.1.2 branche. It does not mean it is no bug, but it could be I reopened the issus to quick.

                  There are some testcases for this, could you create a unit test WITH db?

                  • 6. Re: Task priority problem
                    Ronald van Kuijk Master

                    and I read again, and see that you indeed mention the PD, not PI, so sorry.

                    So it seams right. You can set it designtime in the PD but it is not stored in the db. Setting it runtime does work?

                    • 7. Re: Task priority problem
                      Michael Holtzman Newbie

                      Yes, setting it at run time does work.

                      I am working around the problem by setting the priority that I need in the task assignment handler.

                      However, having the priority correctly assigned when the task instance is created would be "nicer".

                      • 8. Re: Task priority problem
                        Ronald van Kuijk Master

                        setting it runtime also persists it, right?