5 Replies Latest reply on May 28, 2010 12:42 PM by jbpm4user

    [jBPM 4.3] Transition - Custom Attributes

      Hi,

       

      I would like to know if jBPM 4.3 provides an option to fetch custom attributes defined on transition element in jpdl.

      I would like to define attribute to store attributes like URN/URL, so that end UI application can display corresponding jsp page.

      I'm able to define custom attributes om task nodes and fetch them at runtime, but it wouldn't suffice my needs as multiple transitions may reach same node and depending upon the path they come, a different/same jsp could be shown. Hence the need to define attributes on transition instead of task nodes.

       

      I looked at TransitionImpl, but couldn't make out a way to override it in configuration files. Any pointers on how this could be acheived?

       

      Thanks,

      Rams

       

       

       

       

          <task name="Task1" g="96,16,127,52">

              <transition name="Task2" to="Task4" urn="/abc/abc.jsp" />
              <transition name="Task3" to="Task5" urn="/abc/def.jsp"/>
          </task>
        • 1. Re: [jBPM 4.3] Transition - Custom Attributes
          rebody

          Hi Rams,

           

          Now, Transition cannot store/parse custom attributes.  Since the transitionImpl was a part of internal pvm, it cannot be override either.  It seems like that we should let transition pluggable.

           

          Create a TransitionBuilder for this scenario may be a good idea,  But how could we handle the additional customized attributes in transition?  JpdlParser won't parse these additional attribute now.

           

          So I think this will be a huge task, and we should dig deeper.

          • 2. Re: [jBPM 4.3] Transition - Custom Attributes

            Thanks HuiSheng,

             

            I was thinking if attributes could be added as key value pairs to TransitionImpl, Looked at the code in JpdlParser where the transitions are getting parsed currently.

             

             

              public void parseTransitions(Element element, ActivityImpl activity, Parse parse) {
                List<Element> transitionElements = XmlUtil.elements(element, "transition");
                UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
                for (Element transitionElement: transitionElements) {
                  String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
                  Element timerElement = XmlUtil.element(transitionElement, "timer");
                  if (timerElement!=null) {
                    TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement, parse, activity);
                    timerDefinitionImpl.setSignalName(transitionName);
                  }
                  TransitionImpl transition = activity.createOutgoingTransition();
                  transition.setName(transitionName);
                  unresolvedTransitions.add(transition, transitionElement);
                
                  parseOnEvent(transitionElement, parse, transition, Event.TAKE);
                }
              }

             

             

            Do you think will it be possible to be fixed for next jBPM release say 4.5 (are you part of jboss jbpm team) ?

            • 3. Re: [jBPM 4.3] Transition - Custom Attributes
              rebody

              Hi Rams,

               

              I can commit some patches into svn repo.  But Alejandro is in charge.  So if we want to achieve some big feature like this, we should let him know.

               

              Maybe you could open a JIRA issue for this.  And we could discuss this later.  Recently we are focusing on bug fixes for releasing jBPM-4.4.  Thank you very much.

              • 4. Re: [jBPM 4.3] Transition - Custom Attributes
                swiderski.maciej

                HI,

                 

                I am afraid that this is not the right way to go (at least as far as I understood it). If we let custom (unknown and unlimited) attributes to be placed on transition (or any other element) we will not be able to validate the xml against xsd. Another thing is how shall it be accessible from an execution?

                 

                In my opinion you could use variables for this purpose. Especially that 4.4 will have support for variable declaration within jpdl so everything stays on the process definition level. Your JSP pages can access process variable and get interesting value for a given outcome.

                • 5. Re: [jBPM 4.3] Transition - Custom Attributes

                  I am afraid that this is not the right way to go (at least as far as I understood it). If we let custom (unknown and unlimited) attributes to be placed on transition (or any other element) we will not be able to validate the xml against xsd.

                   

                  -- agree to it completely.

                   

                   

                  Another thing is how shall it be accessible from an execution?

                   

                  -- i was thinking from activity as it has api for incoming and outgoing transitions, each of these transitions could have the attributes..but may not be right way to do it.