4 Replies Latest reply on Jan 14, 2009 6:41 AM by kukeltje

    TaskNode override

    kooper

      Hi,
      I need to override TaskNode with my custome Node to add type attribute to it.
      I read on the forum that for this I need update jbpm.cfg.xml with

      <string name="resource.node.types" value="com/jbpm/node/node.types.xml" />
      

      I've moved node.types.xml to the location above and updated task node value
      <node-type element="task-node" class="com.jbpm.node.MyNode" />
      

      I've created MyNode.java and override execute() method, created MyNode.hbm.xml
      <?xml version="1.0" encoding="UTF-8"?>
      
      <!DOCTYPE hibernate-mapping PUBLIC
       "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
       "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
      
      <hibernate-mapping default-access="field">
       <subclass name="com.jbpm.node.MyNode"
       discriminator-value="M" extends="org.jbpm.graph.node.TaskNode">
       <property name="type" column="TYPE_" />
       </subclass>
      </hibernate-mapping>

      and updated hibernate.cfg.xml with MyNode.hbm.xml
      Adn deployed the application. But when running I'm still having TaskNode returned to me and not MyNode.
      Will the described above solution work or I need to change jbpm source to add type attribute?
      Thank you.


        • 1. Re: TaskNode override
          kooper

          Hi, Can anyone give me any link where I can find solution to the chalenge above? As all that I found is how to override TaskInstanse and not Task Node and I need Task Node override due to system archetecture.
          Thank you.

          • 2. Re: TaskNode override
            kukeltje

            Are there not by accident duplicate files on the classpath with different content?

            • 3. Re: TaskNode override
              kooper

              I think not, I've solved the problem by creating the package with the same name as is in jbpm jar org.jbpm.graph.node and putting node.type.xml there, initially it was in another package . And it works now, but then another issue came, I need to add attribute "type" to node and as I understand I need somehow to override default parser. It would be great if anyone could descibe the solution if exsists.
              Thank you very much.

              • 4. Re: TaskNode override
                kukeltje

                what I personally do is just add the info to the processdedfinition and not customize anything. Runtime I read the proceessdefinition from the database and parse it into a org.w3c.Document and read the additional info. that is what you could also do