3 Replies Latest reply on May 14, 2008 4:52 PM by Ronald van Kuijk

    Optional actor-id

    Tom Goring Apprentice


      I'd like to be able to optionally assign a task to a person in a group.
      I.e. #{someexpression} may be an actorid but it maybe null
      If #{someexpression} == null jBPM stack traces
      If #{someexpression}== "" the assignment does not work (it belongs to the "" actor.

      Any idea how to do this?

      <task-node name="reviewContractor">
       <task name="Review" description="Xyz">
       <assignment pooled-actors="#{group}" actor-id="#{someexpression}"/>
       <transition to="done"></transition>

        • 1. Re: Optional actor-id
          Ronald van Kuijk Master

          write your own assignmenthandler

          • 2. Re: Optional actor-id
            Tom Goring Apprentice

            Thanks for that...

            I've looked though the examples... can you give me a pointer to as to how best to pass arguments to the handler? Or do I need to use the process variables?

            I was hoping I could do the below but as soon as I change:

            <assignment class="jnet.faces.PersonAssignmentHandler"></assignment>

            <assignment class="jnet.faces.PersonAssignmentHandler" pooled-actors="#{accountantCompany.entityId}" actor-id="#{personRelations.getPersonManagerActorId(accountantCompany)}"></assignment>

            My handler is nolonger called:

            public class PersonAssignmentHandler implements AssignmentHandler {
             public void assign(Assignable assignable, ExecutionContext executionContext)
             throws Exception {
             String groupId = Interpolator.instance().interpolate(executionContext.getTask().getPooledActorsExpression());
             String actorId = Interpolator.instance().interpolate(executionContext.getTask().getActorIdExpression());
             if ( !StringUtil.isNullOrBlank(actorId) ) {
             if ( !StringUtil.isNullOrBlank(groupId) ) {
             assignable.setPooledActors(new String[] {groupId});

            • 3. Re: Optional actor-id
              Ronald van Kuijk Master

              correct, you have to pass parameters like you do with normal actionhandlers, so something like

              <assignment class="jnet.faces.PersonAssignmentHandler">

              Then have the properties/setters/getters called pooled-actors and actor-id as strings, and then in the assign method, parse these strings as EL (see jbpm source for some examples) and you're there.

              Nice btw that you experimented yourself. Often people just reply 'how do I do that', which makes me less interested in replying. This however does the opposite. Neat...