2 Replies Latest reply on Apr 24, 2006 10:16 AM by Sebastian Oliver

    Newbie needs advice

    Sebastian Oliver Newbie

      I'm a totally new user to workflows and jbpm... have been reading and lookin deeply at the code though.

      I have to do an application that I'll explain bellow and how I was trying to begin it, I would appreciate any advice ppl.

      A related flow is about entering new products to the system, but it should be totally dynamic. I mean, I start a new process instance by clicking some link like "New product" on the navigator. The token is signal and the propagation reaches the next node, a Task Node.
      This task node will present the user the form based on the task instances variables... but I need also to load dynamically a lot of other variables that are stored on a DB and then create the FORM shown to the user not only using the variables defined in the task controller, otherwise these i got from the DB. To do this I thought about adding an Action when the event NODE_ENTER is triggered, and this make this action to retrieve the dynamic variables and store them in the session scope to use them later when creating the web page.
      Something like this:

       public void execute(ExecutionContext executionContext) throws Exception
       //get the field set from DB and store it in the session
       Object id = executionContext.getTaskInstance().getVariable("newProductId");
       Query query = session.getNamedQuery("GraphSession.findAllDynamicVariableForAProduct");
       query.setLong("newProductId", id);
       executionContext.getTaskInstance().setVariable("dynamicVariables", query.list());

      There can be a lot of task nodes like this... but each will retrieve differente dynamic variables and be assigned to different users.

        • 1. Re: Newbie needs advice
          Koen Aers Master

          Please be more specific. I don't thing anyone can understand your question.


          • 2. Re: Newbie needs advice
            Sebastian Oliver Newbie

            Suppose the web sale order example that comes included in jbpm starters kit.

            When the user creates a new web sale order, the task.jsp is shown and its form presents the textfields representing each variables of the associated task instance. The user then fill up those textfields and so assign the values to the task variables.

            What I have to do it's just an add to that.
            My task.jsp will not only show the form with the textfields representing each variable of a task instance, otherwise it will also present a dynamic empty table that will need to be filled up with data.
            What is this data and where does it come from ?
            It's define in a DataBase and are variables that contains the same fields that taskinstance variables


            After filling up the static variables (defined for the taskinstance) I wish to add a dynamic variable so for ex. press some ADD button and a window containing all those dynamic variables will pop up and I'd choose one. Then the table would have 1 row.

            How did I think to do this ?
            By executing actions before entering those TaskNodes, and make those actions retrieve the dynamic variables from a DB in order to save them somewhere and access them via jsp mabe in task.jsp.