0 Replies Latest reply on Jan 17, 2012 6:01 AM by mvermand

    Custom (queryable) property in JPDL process-node

    mvermand Newbie



      I have the following requirement (using JBPM4.4 on Hibernate):


      In order to work on future "versions" of a Process definition, our customers need to be able to make  a branch of the current workflow definition and make modifications.

      Then, when the time is right (for example, a certain law gets active) the new branch needs to be made current (gets deployed).

      The different braches are maintained in our own repository.


      Now, we need to be able to retrieve the "branch-number" from which the deployed definition originates.


      I was hoping that it would be possible to add a custom attribute to the process node in the jpdl and retrieve it afterwards, but it seems that custom attributes are not saved (I looked in JBPM4_DEPLOYPROP).

      I found some information about disabling the jpdl validation but that seems not such a good idea.


      I tried it aswell through adding a property through code:


          DeploymentImpl depl = (DeploymentImpl)processEngine.getRepositoryService().createDeploymentQuery().deploymentId(aDeploymentId).uniqueResult();
          depl.setObjectProperty(depl.getName(), "TEST", "TEST");


      Though that results in


      org.jbpm.api.JbpmException: no environment to get org.hibernate.Session

          at org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:203)

          at org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:196)

          at org.jbpm.pvm.internal.repository.DeploymentProperty.<init>(DeploymentProperty.java:51)

          at org.jbpm.pvm.internal.repository.DeploymentImpl.setObjectProperty(DeploymentImpl.java:240)





      So my question(s):

      1) is it possible to add a custom attribute to a process definition?

      2) or is there a different way to save and retrieve custom meta data of a process definition?


      Thank you very much!