1 Reply Latest reply on Sep 10, 2008 5:10 PM by Vladimir Tsvetkov

    jBPM - passing additional information to process or a task

    Vladimir Tsvetkov Newbie

      I'm trying to implement the following requirements for a hotel booking system:

      • administrators should be able to mark hotels for deletion

      • if there are associated bookings with the deleted hotel, the admin should notify the booking user about his booking cancellation, so in order to track this notifications I wanna introduce a TODO-list with tasks that need to be done

      • on task completion if all bookings are already canceled (the interested user is notified), the hotel is deleted permanently

      I want to use jBPM to represent the process with TODO-tasks, so basically I'm trying to step on the seam-todo example, but in order to achieve my goals I need to do the following:

      • when I mark the booking for cancellation I'm raising an event 'bookingCancelScheduled';

      for (Booking booking : deleted.getHotelBookings()) {
         events.raiseEvent("bookingCancelScheduled", booking);

      • the observer of this event should configure and start (this is hard part for me) a task part of a process;

      • when done an event is raised to notify if the hotel is ready for permanent deletion;

      What's the proper way to configure and start a task?

      Let's take for an illustration the TodoList-bean from the seam-todo source with some modifications:

      public class TodoList
         private String description;
         public void scheduleBookingCancel(Booking booking) 
            // When I get this event I need to set the description of a task,
            // and attach the booking to the task, so when the task is done 
            // to retrieve the booking back and to process it.
            // Start the process - just calling the createTodo() ain't gonna work
         public void createTodo() 
            // What's needed to be done here???   
         @StartTask @EndTask
         public void done() 
            // How to obtain the done-task in order to get the passed variables?
         public String getDescription()
            return description;
         public void setDescription(String description) 
            this.description = description;

      There isn't much information in the Seam Community Documentation about more advanced usage of jBPM. Looking at the jBPM documentation can't help me much, because I want to use the most of what Seam can offer (well at least I found out I can really attach data to a task with the help of the variables-map property of TaskInstance).

      If someone has any clues please let me know!

      Best regards,
      Vladimir Tsvetkov

        • 1. Re: jBPM - passing additional information to process or a task
          Vladimir Tsvetkov Newbie

          Well, I can see that the task succeeds in getting its Description property from the TodoList bean, so I suppose if I'm able to figure out how it takes it from the bean, I'll be also able to make it take additional variables.

          The first thing that occurred to me was to try is to put a break-point in getDescription() and then wait to see what hits it and then expect the stack trace, to get any information who is getting this value.

          The break-point was hit but I couldn't get any further from the BusinessProcessInterceptor - I mean the BusinessProcessInterceptor wasn't on top of the stack, but going higher above it I couldn't get any source code to delve in and thus to understand what's going on. So I suppose the thing that calls getDescription() is not from the jBPM API, but it's rather something generic to EJB or Seam - I don't know...

          I hope someone replies me with a hint on that.