3 Replies Latest reply on Jun 8, 2007 11:41 AM by Francis LIMOUSY

    Always assign to a given actor

    Francis LIMOUSY Newbie


      I designed a validation process using the GPD and I want to use it in my seam app.
      I lack example of assignment to any other actor than the logged in user so I'm asking here.

      When I log my user in, I set the built-in Actor component to the user id.
      The user creates a document an sed it ot his superior for validation.
      So I created a task node, with assignment to #{actor.id}, and I made something like this:

       public void demandeValidationNPlusUn(){
       //Look for superior in database
       Valideur valideur1 = (Valideur)em.createQuery("select valideur from Valideur valideur where typeValidation=:typeValidation")
       .setParameter("typeValidation", "Valideur1")
       Certification certifTest =certificationHome.find();
       certificationHome.getInstance().setStatut("Attente de Validation");
       this.statut = certificationHome.getInstance().getStatut();

      Let me explain (there's a bit of french, could be confusing btw).
      I fetch the superior from the database and put his id in the Actor component, then modify the object, status, save, etc ...

      The transition is ok, assigned to the superior but the actor component is changed is this method !
      So when I display back my #{taskInstanceList} datatable, the list displayed is the superior one.
      I have to log out / log in to reset the actor to my logged user and have a correct taskInstanceList.

      I'm sure I'm not using the actor or @StartTask/@EndTask the way it should be but I can't find an example of assignment to another actor.

      Can anybody please help me ? (or tell me where I can find an example)

      Thank you

        • 1. Re: Always assign to a given actor
          Pete Muir Master

          You want to assign the task correctly in the first place e.g.

          <assignment actor-id="#{currentUser.boss.id}" />

          • 2. Re: Always assign to a given actor
            Francis LIMOUSY Newbie

            You're right, it's much easier that way.
            Just to be sure I understand it well, I can assign to anyone in the xml definition file, and for "my assigned instances" it just have to match actor.id right ?

            My next question is: where do the transition look for the EL defined in the process definition ? In all contexts as usual ?
            I mean, if I want to assign, not to current user boss but to a variable user managed elsewhere in the application (delegation management for example), I can just outject in the conversation/event context my user to be assigned ?

            @Out (Scope=ScopetType.EVENT)
            User supervisor;
            and in the assignement:

            Will this work ? I just load the wanted supervisor and outject it for BP to have it.

            • 3. Re: Always assign to a given actor
              Francis LIMOUSY Newbie

              Well just to close the post, I wanted to say that my stuff (almost) worked !
              I just have to outject a String, and not an int. But everything worked after this.

              I don't know maybe this can help someone ...
              You know, maybe someone even more n00bish than me ...

              (Hey ! Why is everybody laughing ? Stop this !)

              Well thanks for the help