5 Replies Latest reply on May 12, 2006 9:56 AM by Sebastian Oliver

    Associate custom objects with Nodes

    Sebastian Oliver Newbie


      First of all, I will explain shortly and detailed the app ->

      The client can design the flow using the designer, and obviously deploy it.

      Client's personal logs in the web app, the home page is displayed and the link which starts the processInstance is shown.
      The guy now clicks on the link starting a new processInstace and sending the signal message to the StartNode.

      The following thing that should occurred is ( supposing next node is TaskNode ) get the tasks instances of that TaskNode and show the web form to the user for e.g. the first task instance.

      As said that should be the following thing, BUT I do not only have to show the web form with the variables of the task instances otherwise I have to add another variables dynamically that I got from some DB for then finall show up the web form with both variable types.

      And this is my problem... in some way I have to recognize what type of TaskNode the token is set to.

      Why ?

      Because if it's a mail type I have to present the web form showing taskcontrollers variables ( name, subject, mail text ) the also the dynamic variables I got from some BD.

      On the other hand if it's approval I have to present the web form showing taskcontrollers variables ( publisher, comments, etc ) the also the dynamic variables I got from some BD quering other tables.

      So is there some way to do this ? Like maybe associating some custom object to each Node ( GraphElement ) in order that it's a "Mail" Task Node or a "Approval" Task Node or so on...

      Regards,
      Sebastian.

        • 1. Re: Associate custom objects with Nodes
          Ronald van Kuijk Master

          Sebastian,

          Maybe it's that I'm tired (it's 22:48 after a long day, but I do not fully grasp what you mean. From what I understand you want a page with input elements that come from both the process and another system? And you want that customized per task?

          That is not possible with 3.1 without implementing your own framework. In 3.2 things will be possible to some extend.

          Ronald

          • 2. Re: Associate custom objects with Nodes
            Ronald van Kuijk Master

            But...

            What you could do is ad an action to the task, read the db in there and create transient task variables. Those will be displayed (I hope) but I do not know how to update them.

            Ronald

            • 3. Re: Associate custom objects with Nodes
              Sebastian Oliver Newbie

              Thank for replaying kukeltje.

              e.g. when you do a Swing JTree you should create instances of class the DefaultMuteableTreeNode.
              You associate a custom objetc to each DefaultMuteableTreeNode and if an event occurs on the tree ( supposing it's a node selection event ) by having the selected DefaultMuteableTreeNode you call the node.getUserObject() and that way get your custom Object.

              Well... my jbpm app have several task nodes in its flow but each task node can be "different" for MY app. I will do know it's a task node when the execution point reaches a task node, but that's not enough for my app since I have to know what task node "subtype" is. That's why I wanted to know if there's some way to associate a custom object to a task node like the DefaultTreeNode does.

              Thanks

              Regards,
              Sebastian.

              • 4. Re: Associate custom objects with Nodes
                Alejandro Guizar Master

                How about using a simple Map<TaskNode, YourCustomClass>? If you need your custom objects to be persistent, you can create a subclass of module instance, put the map there and create the necessary Hibernate mappings.

                • 5. Re: Associate custom objects with Nodes
                  Sebastian Oliver Newbie

                  Thanks for the reply alex.

                  That should work but I got a question.

                  Since I didn't find any documentation about ModuleInstance in users guide I tried to deduce it b myself by taking a look directly to the code.

                  Are ModuleInstance subclasses some kind of "services helper classes" ? I mean some point for providing your extension app... since from simple helper class to some facade with a lot of classes bellow it ?

                  Regards,
                  Sebastian