1 2 Previous Next 20 Replies Latest reply on Sep 15, 2006 5:28 AM by auré manga

    How logging me in as a user in JBPM (swimlane)

    auré manga Novice

      Hello,

      I have created a process with some swimlane. When I execute my process, the tasks are executed by anybody.

      I would like know how can I logging me in Jbpm in order to execute my tasks just by the poeple who are in the swimlane task.


      If you have some questions or you want to know anything say me please.

      thank you for your help in advance


      antitrust1982

        • 1. Re: How logging me in as a user in JBPM (swimlane)
          Jitendra Singh Newbie

          heyi,
          As Far As I Know (AFAIK) jBPM does not do any kind of checks while signaling a token on whether the person who has been assined is signalling.

          The way this is controlled in the sample web-app is by showing only my tasks to me on login so that i can signal or act on only my tasks.

          In other words this should be controlled by access to particular task by UI or other means rather than by the signal command.

          Hope it helps..

          cheers!

          • 2. Re: How logging me in as a user in JBPM (swimlane)
            auré manga Novice

            ok, I have thought to create myself the controle of identy but I thought that the controle of assigment would be assured by JBPM.

            Ok so I will try to create in my web app the task by myself.

            thank you very much for your help

            cheers

            antitrust1982

            • 3. Re: How logging me in as a user in JBPM (swimlane)
              auré manga Novice

              for print my tasks which are assign to my user I must know the tasks that will be execute just after the task where I am.

              How can I do this?

              I have tried to find with the token using GetActiveToken(), but they aren't yet active because I have execute it.

              Must I use the swimlaneinstance?, processinstance? taskinstance? to know the next tasks will be executed in my process.

              Thank you for your help.

              antitrust1982

              • 4. Re: How logging me in as a user in JBPM (swimlane)
                Jitendra Singh Newbie

                I don't think it makes much sense to know the future tasks, because what tasks will get executed depends on the process definition and the actual flow taken by the process instance.

                So even if we can find a list of next tasks, only some of them may be executed.

                cheers!

                • 5. Re: How logging me in as a user in JBPM (swimlane)
                  auré manga Novice

                  I will explain you. when I put "end-tasks='true'" in my process definition when I do a "getTaskMgmtInstance().getUnfinishedTasks(token);" I haven't any task that I can execute. And when I do a token.getName() it Null.

                  But when I delete the end-tasks='true' I have all the tasks taht I have already passed. So how can I put my task to end when I execute my java files and not in my porcess?

                  • 6. Re: How logging me in as a user in JBPM (swimlane)
                    Jitendra Singh Newbie

                    I think we are confused here somewhere.

                    When we are creating a business process, we will have multiple instances of a particular process running in different stages. In which a lot of different tasks will be pending on different users

                    When you want to see tasks assigned to a particular swimlane/user, we must use

                    swimlane.getTasks()


                    And, if we want to see the total number of tasks created/pending in a particular process instance then we use
                    getTaskMgmtInstance().getUnfinishedTasks(token)


                    hope it helps..

                    cheers!

                    • 7. Re: How logging me in as a user in JBPM (swimlane)
                      auré manga Novice

                      hello,

                      when I wrote this :

                       System.out.println("test pour voir tasks");
                       Collection tasks= (Collection) swimlane.getTasks();
                       Iterator ittasks= tasks.iterator();
                       while(ittasks.hasNext()){
                       TaskInstance task=(TaskInstance)ittasks.next();
                       System.out.println("tache de ernie: "+task.getName());
                       }


                      I have a nullpointeur error (particularly on swimlane.getTasks())

                      have you some ideas why?
                      have i forgotten anything ??

                      thanks

                      • 8. Re: How logging me in as a user in JBPM (swimlane)
                        Jitendra Singh Newbie

                        We must go back and have a look at how the sample web app that comes with jbpm is handling it.

                        Have a look at it, I will also refresh it.

                        cheers!

                        • 9. Re: How logging me in as a user in JBPM (swimlane)
                          Jitendra Singh Newbie

                          Use this:

                          jbpmContext.getTaskMgmtSession().taskMgmtSession.findTaskInstances("ernie");
                          


                          Let me know if this works.

                          swimlane.getTasks should be used to find tasks defined for the swimlane in the process definition. It will not give the pending tasks in various process instances..which is what we are trying to find here. Sorry for the confusion.

                          cheers!



                          • 10. Re: How logging me in as a user in JBPM (swimlane)
                            auré manga Novice

                            I have wrote that :

                            Collection tasks=(Collection)jbpmContext.getTaskMgmtSession().findTaskInstances("ernie");
                             Iterator it= tasks.iterator();
                             while(it.hasNext()){
                             TaskInstance task = (TaskInstance) it.next();
                             System.out.println("task of ernie hihihihi:"+task.getName());
                             }


                            ANd I have theses line in the console:


                            task of ernie hihihihi:null
                            task of ernie hihihihi:null
                            task of ernie hihihihi:null
                            task of ernie hihihihi:null
                            task of ernie hihihihi:null


                            So I have 5 instance for Ernie but of task null :s.SO I can't know what are they.

                            I continue to search.

                            • 11. Re: How logging me in as a user in JBPM (swimlane)
                              Jitendra Singh Newbie

                              Well to know what task is from which process instance, you either need to print the date or soemthing, or else just put some variables in the context instance and copy them to task controller.

                              Go thru the api of TaskInstance for some ideas.

                              Also try and spend some time reading the code, a major advantage of open source for us beginners is to read the code and get ideas from it for improving our implementation.

                              cheers!

                              • 12. Re: How logging me in as a user in JBPM (swimlane)
                                auré manga Novice

                                What is the real utility of jbpmContext.setActorId("user"); if you must precise yourselve using a function in order to find the task taht the user can execute.

                                • 13. Re: How logging me in as a user in JBPM (swimlane)
                                  Jitendra Singh Newbie

                                  In an authenticated environment, the actorId is set into the authentication service by jbpmcontxt using this method.

                                  Then when we call jbpmContext.getTaskList(), it returns the task list of the authenticated user. In case you want to get the task list for any other user you have to use taskmgtSession.findTaskInstances(actorId).

                                  Read the code, its all there :-)

                                  cheers!

                                  • 14. Re: How logging me in as a user in JBPM (swimlane)
                                    auré manga Novice

                                    now I work on one instance of jbpm process in order to work one instance correctly. (but I notice that when I execute two portlets of jbpm, the processID of each is the same).

                                    Now, I catch the taskinstance and do a list for each swimlane person. after, I would like to choice one among these and execute this. So I must to indicate which one it is. I have the taskinstanceID but how can I call this taskinstance thanks to this Id?

                                    this is my code:

                                    System.out.println("les taches non finies sont:");
                                     Collection taskinstances = (Collection) pi.getTaskMgmtInstance().getUnfinishedTasks(token);
                                     Iterator itr1 = taskinstances.iterator();
                                     while(itr1.hasNext()) {
                                     taskinstance=(TaskInstance)itr1.next();
                                    
                                     if("ernie"==taskinstance.getActorId()){
                                     System.out.println("Pour ERNIE :................"+taskinstance.getName());
                                     System.out.println(taskinstance.getId());
                                     System.out.println("tache finie:.........."+taskinstance.hasEnded());
                                     }
                                    
                                     else if("bert"==taskinstance.getActorId()){
                                     System.out.println("Pour BERT :...................."+taskinstance.getName());
                                     }
                                    
                                     else{
                                     System.out.println("Les autres taches sont :"+taskinstance.getName()+" et sont allouées à"+taskinstance.getActorId());
                                     taskinstance.getSwimlaneInstance().setActorId("bert");
                                     System.out.println("Changement effectué.. the task is :"+taskinstance.getName()+" to the user "+taskinstance.getActorId());
                                    
                                     }
                                     }
                                    
                                    


                                    I want to work on one of the task instances after this "while loop".

                                    thank you for your help

                                    antitrust1982

                                    1 2 Previous Next