6 Replies Latest reply on Jan 8, 2008 8:42 AM by Tom Baeyens

    How to add custom node?

    anas sarei Newbie


      I'm trying to add a custom node to my application,
      by putting the jbpm.cfg.xml and node-types.xml on the class path,
      and adding this line to the node-types.xml
      <node-type element="custom-node" class="test.MyNode" />
      MyNode.java class extends Node class

      package test;

      import org.jbpm.graph.node.State;

      public class MyNode extends State {
      public MyNode() {
      System.err.println("hellooo it is my node");

      in the processdefinition.xml I changed the node to <custom-node>....</custom-node>
      but the problem is the graph damaged and when i'm trying to instanciate this process definition i got an exception?
      can any body help me plz??
      and if you have a reffrence that discuss by examples how to add custom (nodes, actions,.....) plz send it to me because i searched alot on that by i didn't found anything.


        • 1. Re: How to add custom node?
          Koen Aers Master

          The graphical editor cannot handle custom nodes that are produced in this way. If you want the nodes to show up in the editor, you should use the plain vanilla node type and configure them with an action. There are a number of forum threads that talk about this way of doing it.


          • 2. Re: How to add custom node?
            anas sarei Newbie

            so is there any other way to add a custom node??
            or another way to configure it??
            and can you plz send me any link that talks about plain vanilla node type??
            and how can i use it??
            big thanks,

            • 3. Re: How to add custom node?
              Ronald van Kuijk Master

              9.3.7 in the docs and look in the source for specific testcases and look in the wiki also

              • 4. Re: How to add custom node?
                Tom Baeyens Master

                with plain vanilla node type, koen referred to the 'node', which is also a node-type in jPDL. it's used to provide an action that implements the node behaviour.

                • 5. Re: How to add custom node?
                  anas sarei Newbie

                  I appreciate your effort for answering me,,,
                  I checked the the node type in 9.3.7,,, but my case is that i want to add a custom attributes to the class node itself,, in other words,, node class contains id as long,, and i want to add a type of node that contain myId as int,, and get its value from the processdefinition.xml,, i.e:
                  <process-definition name="simple">
                  <custom-node myId="5">
                  ...... </custom-node>
                  is there any solution,, or i have to rebuild the jpdl in order to do that??

                  • 6. Re: How to add custom node?
                    Tom Baeyens Master

                    in jbpm.3 there is a read method in the node so that the node implementation also can parse custom attributes.

                    i don't know whether all things are configurable enough to get it going without recompilation. that probably is the case, but i'm not sure. see the jPDL node type implementations for examples on how to implement that extra node parsing.

                    we currently working towards jpdl 4 where this node pluggability is fully worked out from designer to xml over node implementation to persistence.