3 Replies Latest reply on May 18, 2006 7:06 PM by Ronald van Kuijk

    Changing HomeBean.getLatestProcessDefinitions()

    Chris Knowles Newbie

      I'm trying to change the getLatestProcessDefinitions() method of the HomeBean to only show processes which the current user is allowed to start (the start task is assigned to that user). The idea is that only a particular user can kick a process off.

      The problem I'm having is that is I get the actor expressions, or use a swimlane and get them via that, but they are all null. Obviously this is all from definitions and not from instances since a process that hasn't started does not have instances.

      I have modified the following inside the HomeBean:

      public List getLatestProcessDefinitions() {
       List allProcesses = graphSession.findLatestProcessDefinitions();
      
       for (int i=0; i<allProcesses.size(); i++) {
       ProcessDefinition processDefinition = (ProcessDefinition) allProcesses.get(i);
      
       TaskMgmtDefinition taskMgmtDefinition = processDefinition.getTaskMgmtDefinition();
       log.info("Name = " + taskMgmtDefinition.getStartTask().getName());
       log.info("Actor id expression = " + taskMgmtDefinition.getStartTask().getActorIdExpression());
       log.info("Pooled actors expression = " + taskMgmtDefinition.getStartTask().getPooledActorsExpression());
      
       if (taskMgmtDefinition.getStartTask().getSwimlane() != null) {
       log.info(taskMgmtDefinition.getStartTask().getSwimlane().getName());
       log.info(taskMgmtDefinition.getStartTask().getSwimlane().getActorIdExpression());
       log.info(taskMgmtDefinition.getStartTask().getSwimlane().getPooledActorsExpression());
       } else {
       log.info("swimlane is null");
       }
       }
       return allProcesses;
      }
      


      This prints out the name of the start task and the swimlane fine, but all the actor expressions are null.

      Is this a bug, or is there another way to get the assigned user for the start task? (while not making or using an instance). Come to think of it any suggestions would be appreciated.

        • 1. Re: Changing HomeBean.getLatestProcessDefinitions()
          Ronald van Kuijk Master

          could you post the start-node and corresponding parts of the swimlane?

          If you use an expresssion attribute on th e swimlane, the getActorIdExpression and getPooledActorsExpression are indeed null. If you use the actor-id attribute or the pooled-actors attribute either of them will not be null.

          I've been looking at how to get access to the expression attribute via the API but found nothing (yet). Passed this on to the developers.

          btw, if there is no instance, there is no assigned user. There only is a 'user to be assigned'

          • 2. Re: Changing HomeBean.getLatestProcessDefinitions()
            Chris Knowles Newbie

            I was under the impression that if I set the expression to user(buyer) for example, then the actorIdExpression would be "buyer" as this makes sense. I have to say, the docs on all this stuff are very lacking. There's so many posts asking for something fairly simple which jBPM can do but its just hard to find. The designer doesn't show a lot of the useful attributes and features that are possible directly in the source.

            Both the swimlane and start node are very simple:

            <swimlane name="buyer">
             <assignment expression="user(buyer)"></assignment>
            </swimlane>
            


             <start-state name="bought">
             <task name="bought task" swimlane="buyer">
             <controller>
             <variable name="manufacturer" access="read,write,required"></variable>
             <variable name="name" access="read,write,required"></variable>
             </controller>
             </task>
             <transition name="copy into db table" to="arrives">
             <action name="db copy" class="action.BoughtActionHandler" config-type="bean"></action>
             </transition>
             </start-state>
            


            • 3. Re: Changing HomeBean.getLatestProcessDefinitions()
              Ronald van Kuijk Master

              the assignment can also have an actor-id attribute or a pooled-actorid (see the docs) these two are accessible via the api. The expression seems not to be accessible.

              Maybe you should file a jira issue for this.