2 Replies Latest reply on Sep 5, 2007 4:34 AM by Gregor Grambow

    signalling custom task

    Gregor Grambow Newbie

      hallo again,

      i have a problem with a custom task i want to use.
      i have created a subclass of taskinstance and so on (i'm using a custom taskinstancefactory, assignmenthandler, hbm.xml). i have mapped this custom taskinstance as a subclass of taskinstance with an additional property. this all works fine but when i end this task, which is signalling and non-blocking it does not signal the processinstance/token as it should.

      i mean what i'm trying to implement are two methods: one gets the list of tasks for the user by using a query similar to the one jbpm uses to get the usuall taskinstances:

      select cti
       from blablub.CustomTaskInstance as cti
       where cti.actorId = :actorId
       and cti.isOpen = true
      

      after that the user may choose which task to execute.
      then a second method gets the id (db id) of the taskinstance and then executes it
      cti = (CustomTaskInstance)
       jbpmContext.getSession().createQuery("from CustomTaskInstance where id = :id")
       .setParameter("id", new Long(id))
       .uniqueResult();
      
      
       cti.start();
      
       System.out.println("\nExecuting Task - Signalling related Token\n");
      
       cti.end();
      

      this all works but the task does not signal the token...

      i have traced the problem to the taskNode class of jbpm.
      in the method isLastToComplete(TaskInstance taskInstance) the actual taskinstance is compared to other ones to find out if it is the last one for this task node (because it is as default signal=last). there is only one task in the node. but the method compares not the id which comes from the db but the id of the instance (programmatic) of the taskinstance class and uses the instance i got from the hibernate session with another one it got.
      they are both not the same instance of the taskinstance of course...

      am i just stupid and have missed some nice api method that helps me doing this in two independant methods? or is it a bug? or something else?
      (jbpm 3.1.1, mssql 2003, jboss ide 1.6)

      could someone please point me in the right direction?
      or ask for some further info if i have not pointed out this clearly (i always write some kind of confusing, i know...)?

      regards gregor