10 Replies Latest reply on Jan 8, 2010 10:04 AM by kukeltje

    Why unique activity names?

    sravyts

      What is the reasoning behind having unique names for the activities? (and not having some id which is unique, and a name which is not unique)

      This causes the following problem in jbpm4 for us:

      When building our process models in our BPMN modelling tool, we offer the user a set of predefined tasks which they can plugin in into there process model.

      Suppose the user inserts two times the same task in a processmodel:
      node 1: name = "Print mail", id = "task_1"
      node 2: name = "Print mail", id = "task_2"

      How do we convert this to a jbpm 4 jdpl so we see in our task list "Print mail" and not "task_1" of "task_2"?

      In jbpm 3 this is not an issue because tasks are wrapped in a task-node element and we assign the id of our node as the task-node element's name ("task_1" and "task_2"), and the name of our task to the task element's name ("Print mail").
      This way the name of the task shows up nicely in the task list, and we still have a unique name in the jdpl for each node.


      We have succeeded in (mis-)using the description element of an activity to contain the task's name and show the description in our task list instead of the name, but this removes the option to add a description to a task, so we would like to find an other solution for this problem...

      We also looked into extending the persisted task with an extra property (label) by creating our own CustomTaskActivity and CustomTaskActivityBinding and adding a element to the element in the jdpl, but we needed to copy all the code in TaskActivity execute method to our CustomTaskActivity execute method just to add this one property on the task which is something we want to avoid (duplicating code ...). Also we got a parser error before it even comes into the parse method of CustomActivityBinding:

      Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'ebtask'. One of '{"http://jbpm.org/4.0/jpdl":description, "http://jbpm.org/4.0/jpdl":swimlane, "http://jbpm.org/4.0/jpdl":on, "http://jbpm.org/4.0/jpdl":timer, "http://jbpm.org/4.0/jpdl":start, "http://jbpm.org/4.0/jpdl":end, "http://jbpm.org/4.0/jpdl":end-cancel, "http://jbpm.org/4.0/jpdl":end-error, "http://jbpm.org/4.0/jpdl":state, "http://jbpm.org/4.0/jpdl":decision, "http://jbpm.org/4.0/jpdl":fork, "http://jbpm.org/4.0/jpdl":join, "http://jbpm.org/4.0/jpdl":script, "http://jbpm.org/4.0/jpdl":hql, "http://jbpm.org/4.0/jpdl":sql, "http://jbpm.org/4.0/jpdl":mail, "http://jbpm.org/4.0/jpdl":java, "http://jbpm.org/4.0/jpdl":custom, "http://jbpm.org/4.0/jpdl":task, "http://jbpm.org/4.0/jpdl":sub-process, "http://jbpm.org/4.0/jpdl":group}' is expected.
       at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
       at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
       at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
       at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
       at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
       at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
       at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
       at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
       at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
       at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
       at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
       at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
       at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
       at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
       at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
       at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
       at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
       at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
       at org.jbpm.pvm.internal.xml.Parser.buildDom(Parser.java:453)
       at org.jbpm.pvm.internal.xml.Parser.execute(Parser.java:389)
       at org.jbpm.pvm.internal.xml.Parse.execute(Parse.java:157)
       at org.jbpm.pvm.internal.repository.ProcessDeployer.deploy(ProcessDeployer.java:63)
       at org.jbpm.pvm.internal.repository.DeployerManager.deploy(DeployerManager.java:46)
       ... 30 more
      
      --
      


        • 1. Re: Why unique activity names?
          kukeltje

          Name has to be unique by design. The core devs (unfortunately) did not choose to differentiate between an 'id' (unique) and a name.

          Regarding the error while parsing, the xsd does not support adding custom elements (see jira), but you can work around this by removing the xsd declaration from the processdefinition.

          • 2. Re: Why unique activity names?
            sravyts

            We succeeded in using the description as the task name (so in the tasklists, we use the description instead of the name), but in another view we need to show the active activities in a proces, we callexecution.findActiveActivityNames() and get (of course) the names which are again the id's so not reallly meaningfull for the end user. If we could call getActiveActivities() (instead of the names), maybe it would solve our issue, but I'm sure there are other places where we'll have other problems with this workaround...

            Extending with an extra field seems to have such a big impact for just creating a unique id... Shame they didn't add it to the design.

            Wkr,
            Sofie

            • 3. Re: Why unique activity names?
              sravyts

              It seems since the last update (jbpm 4.2) we now don't have "description" anymore as well in a task node? So we now have stupid meaningless id's (generated to be unique by our bpmn modelling tool) as the names of our tasks in the tasklist unless we create a custom node which does exactely the same as the task node provided by jbpm (which is quite a lot: adding to the tasklists etc...) except that there is an extra tag "label" or something like that. I would hate it if we had to copy all this code only for having one extra property on a task object??

              Or is it much simpler to add extra data to a task?


               

              Btw, what is your solution for having two tasks with the same name in one process and how will you differentiate between these two (fi for viewing the executed path in a process drawing)? It seems to me this is just not possible.

               

               

              Wkr,

              Sofie

              • 4. Re: Why unique activity names?
                kukeltje
                Is that a regression between 4.1 and 4.2? If so file a bug with a high priority, if it is a 'regression' between 3.x and 4.x, then file a bug with a lower priority.
                • 5. Re: Why unique activity names?
                  sravyts

                  I have to correct myself: description is still available, sorry. We were still including the 4.0 xsd.

                   

                   

                  But the other question remains: how are they supporting two nodes with the same name (it is just not supported in jbpm, but it can occur in BPMN if I'm not mistaken?)

                   

                  Wkr,
                  Sofie

                  • 6. Re: Why unique activity names?
                    kukeltje
                    in jBPM, the name is an id in the sense that it must be unique, in BPMN the id is an id (if it is there) and the name is a separate attribute. I had hoped they/we would make the same choice when transitioning from jpdl 3 to 4 but unfortunately not
                    • 7. Re: Why unique activity names?
                      koen.aers

                      LOL

                       

                      Here we go again ;-)

                       

                      But the good thing is. Soon you'll just be able to execute the BPMN natively...

                       

                      Cheers,

                      Koen

                      • 8. Re: Why unique activity names?
                        kukeltje
                        HAHAHAHA... you probaly mean Here I (me) go again (on my own ;-))
                        • 9. Re: Why unique activity names?
                          koen.aers

                          I was not too much against using an id and a name. It would certainly solve some graphical problems...

                           

                          So you don't have to walk alone like a hobo (or is it a drifter?) ;-)

                          • 10. Re: Why unique activity names?
                            kukeltje
                            Take your pick.... Anyway,I've made up my mind, I ain't wasting no more time. I'm going home... WEEKEND!!!!