9 Replies Latest reply on Oct 31, 2006 9:03 AM by qwerty50989

    ActorId from within process definition

    mennen

      Hi,

      I've been trying to get the actorId (from inside my process definition) with the following methods, but no results (in database)

      String actorId= executionContext.getTaskInstance().getActorId();
      
      String actorId=executionContext.getTask().getActorIdExpression();
      
      String actorId = executionContext.getTaskMgmtInstance().getSwimlaneInstance("demandeur").getActorId();
      
      String actorId =executionContext.getJbpmContext().getActorId();




      THis is the node in my process definition that is trying to get the ActorId :

      <start-state name="start automatic_date">
       <task swimlane="demandeur">
       <controller>
       <variable name="Date_demande" access="read"/>
       <variable name="actor id" access="read"/>
       </controller>
       <event type="task-create">
       <script>
       <expression>
       Date today = new Date();
       executionContext.getContextInstance().setVariable("Date_demande",today);
       //String actorId= executionContext.getTaskInstance().getActorId();
       //String actorId=executionContext.getTask().getActorIdExpression();
       //String actorId = executionContext.getTaskMgmtInstance().getSwimlaneInstance("demandeur").getActorId();
       String actorId =executionContext.getJbpmContext().getActorId();
       executionContext.getContextInstance().setVariable("actor id",actorId);
       </expression>
       </script>
       </event> </task>
       <transition name="" to="task1"> </transition>
       </start-state>



      Any ideas as to how to get the actorId??

      Thanks in advance,



        • 1. Re: ActorId from within process definition
          mennen

          Also tried this, but still didn't work:

          String actorId = executionContext.getJbpmContext().getCurrentJbpmContext().getActorId();




          • 2. Re: ActorId from within process definition
            mennen

            I did it!!

            Here is how:

            String actorId = executionContext.getJbpmContext().getActorId();
             executionContext.getContextInstance().setVariable("loggedPerson", actorId);


            i don't know why it didn't work before though..

            Here is my process definition.xml anyways:


            <?xml version="1.0" encoding="UTF-8"?>
            
            <process-definition name="actorIdTests">
            
             <swimlane name="tester">
             <assignment expression="user(mennen)"></assignment>
             </swimlane>
            
            
             <start-state name="start actorId tests">
             <task swimlane="tester">
             <event type="task-create">
             <!--action name ="start_action" class="org.jbpm.mennen.ActorIdAction"/-->
             <script>
             <expression>
             String actorId = executionContext.getJbpmContext().getActorId();
             executionContext.getContextInstance().setVariable("loggedPerson", actorId);
             </expression>
             </script>
             </event>
             <controller>
             <variable name="loggedPerson" access="read"/>
             </controller>
             </task>
             <transition name="" to="task1"></transition>
             </start-state>
            
             <task-node name="task1">
             <task swimlane="tester">
            
             <controller>
             <variable name="loggedPerson" access="read"/>
             </controller>
             </task>
             <transition name="" to="end1"></transition>
             </task-node>
            
             <end-state name="end1"></end-state>
            
            </process-definition>


            and my

            • 3. Re: ActorId from within process definition
              mennen

              just posted it for those who would be looking to do the same thing,

              Hope this helps!

              • 4. Re: ActorId from within process definition
                david.trattnig

                Your start-state contains a task and this works??

                <start-state name="start actorId tests">
                 <task swimlane="tester">
                ....
                


                Thought that wouldn't be a valid process-definition..

                • 5. Re: ActorId from within process definition
                  mennen

                  why not?

                  • 6. Re: ActorId from within process definition
                    mennen

                    Here is what i found in the Websale example of jbpm 3.1

                    <start-state name="create new web sale order">
                     <task swimlane="buyer">
                     <controller>
                     <variable name="item"/>
                     <variable name="quantity"/>
                     <variable name="address"/>
                     </controller>
                     </task>
                     <transition to="evaluate web order" />
                     </start-state>


                    • 7. Re: ActorId from within process definition
                      mennen

                      I tried to have a start state without a task .. but my process appears on the Webconsole with an empty"start process link"!
                      Anyone knows why?

                      • 8. Re: ActorId from within process definition
                        david.trattnig

                        Sorry it's my fault - think it wasn't allowed in older jBpm version...

                        • 9. Re: ActorId from within process definition

                          Does anybody know how to get actorId in bpel process definition?