1 2 Previous Next 15 Replies Latest reply: Mar 18, 2010 5:36 AM by Maciej Swiderski RSS

How to pass values from jsp to *.jpdl.xml file

Anand Kumar Novice

Hi,

 

   I am developing a web application in that i have a situation where a person selects a particular role from the available list in the jsp page and that value has to be passed and assigned to the assignee field in the task component of the *.jpdl.xml file?

 

i am using jbpm 4.3 with tomcat 6.0 as server and Oracle 10g as database

 

  How can i pass the values from the jsp to *.jpdl.xml file... ???

 

  I have gone through google but could not find any solution about it.

 

  Can any one help me to come out of this situation or any pointers how i can perform it ??

 

Thanks in advance for your help

 

 

  • 1. Re: How to pass values from jsp to *.jpdl.xml file
    Maciej Swiderski Master

    Hi,

     

    I don't know your whole process but perhaps a possible solution to this can be to put the process flow into wait state just before your task. Then on your jsp page as soon as someone will select the role for assignment you could signal your process flow to continue with selected value as a variable. That variable should be then used in assignee attribute of your task.

     

    Does it sound suitable for your case? If not please provide a bit more details about your process.

     

    Cheers,

    Maciej

  • 2. Re: How to pass values from jsp to *.jpdl.xml file
    Anand Kumar Novice

    Thank you for your reply.

     

    The solution which you have stated seems to be sound suitable in general but it seems to be not possible in my process.

     

    As my process is like this : a  process is started by normal user ( can also be admin ) and after starting that process should be available to both normal user as well as admin also.

     

    Based upon the user authentication, it will display  the following information:

     

    For Normal user, it provide with two options as ----1) can modify the process information and re submit. 2) He can cancel the process but before it is assigned to any one by admin only.

     

    For admin user, it provide with two option as-- 1) to Assign to a particular role. 2) Cancel the process that was started by some user (or admin)

     

    Here also i am facing another problem like how to show the same process with different options based upon user authentication.

     

    Hoping you have understood the process and you will provide me more information on how to proceed further..

  • 3. Re: How to pass values from jsp to *.jpdl.xml file
    derek lee Newbie

    first , i am not sure that suit you situation. but better than nothing ,haha!

     

    for the first question:

         for example ,the process is  start node--->task node, we can assign the task to candidate-groups,so that both the user and admin can take this task. if the admin take this task, he can reassign to others .

     

    for the second question:

        this matters of permission. you may show different functional buttons based on different permission.

  • 4. Re: How to pass values from jsp to *.jpdl.xml file
    Anand Kumar Novice

    Thanks for your reply 

     

      When you are not sure then how can you suggest the answers further then..  haha !!!

  • 5. Re: How to pass values from jsp to *.jpdl.xml file
    Maciej Swiderski Master

    I am trying to fully understand your goals here - please correct me if I am wrong.

     

    Your process is started by a user (either regular one or admin) - user type does not matter at this step - correct?

    Next it goes to a human task where the main function is dedicated to a user (regular)  that should enter some data and move the process flow further or cancel the process instance. Here is a first question - to whom the task is assigned at this point?

    Administrator can reassign that task or cancel it as well. Reassign is a normal administration functionality that should not be modeled as part of a process (in my opinion).

     

    So this is how I would see it:

    - create a task that is assigned to a candidate group (as Derek suggested), group members will be normal user and admin.

    - task will have following funtionalities: 1. provide information and move further or 2. cancel

    - this means that task will have two outgoing transitions - one for moving forward and one for cancellation

    - if cancellation was chosen and cancellation was made by regular user than it will go to another task (assigned to admin) for confirmation - this check probably will require decision point

     

    So your task form will be unified for both users since you could treat reassigning as administration activity and not task functionality.

     

    Tell me what you think about it.

     

    Cheers,

    Maciej

  • 6. Re: How to pass values from jsp to *.jpdl.xml file
    Anand Kumar Novice

      Thank you once again for your reply.

     

       As you have said, there is little more clarifications in that...

     

    Your process is started by a user (either regular one or admin) - user type does not matter at this step - correct?

         No. User type matter here as he is logging into the application.

    Next it goes to a human task where the main function is dedicated to a user (regular)  that should enter some data and move the process flow further or cancel the process instance. Here is a first question - to whom the task is assigned at this point?

       Here after entering some data ( filling a application) only, the process is stated. After the process is started, that should be available to only admin and the user who has filled after login.Based upon user authentication only the next information is displayed as stated in my previous post like the options available to him

    So your task form will be unified for both users since you could treat reassigning as administration activity and not task functionality.

    Yes, task form is unified for both users.

     

    Hoping you have the understood it and you will provide me some pointers on it.

  • 7. Re: How to pass values from jsp to *.jpdl.xml file
    Maciej Swiderski Master

    Sounds like we have some trouble to understand each other but soon I think we will be on the same page and everything will go smoothly.

     

    So, you're saying that the first step (filling in an application) is not yet a process activity. After submitting this application form process is started. Am I right?

    If so, perhaps you could then submit information about user that submits this form to be placed as assignee to the task that is next step in a process flow. This can be done by starting process with map of variables as argument. Later in the task you could use either process variable expression within your process definition (jpdl.xml) or use AssignmentHandler to perform required logic for assignment.

     

    Am I any closer to understanding your needs?!

     

    /Maciej

  • 8. Re: How to pass values from jsp to *.jpdl.xml file
    Anand Kumar Novice

    Thank you, for your response

     

    You are very closer to the understanding what i  have said.

    So, you're saying that the first step (filling in an application) is not yet a process activity. After submitting this application form process is started. Am I right?

    If so, perhaps you could then submit information about user that submits this form to be placed as assignee to the task that is next step in a process flow. This can be done by starting process with map of variables as argument. Later in the task you could use either process variable expression within your process definition (jpdl.xml) or use AssignmentHandler to perform required logic for assignment.

     

    Am I any closer to understanding your needs?

    You are right that after submitting the data only the process is started. But how to show the same process to both admin and himself before assignee?

  • 9. Re: How to pass values from jsp to *.jpdl.xml file
    Maciej Swiderski Master

    But why you want to do that before assignment?

     

    Since you already know who (regular user) submit the request you could assign it to a group where both admin and the user are members. Only thing you need to do is to add that user to the correct group. Admin will be there by default. To do that you could use

    IdentityService.createMembership(userId, groupId)
    

     

    Cheers,

    Maciej

  • 10. Re: How to pass values from jsp to *.jpdl.xml file
    Maciej Swiderski Master
    Or even simpler - use candidate-users attribute on the task where you can assign more than one user id
  • 11. Re: How to pass values from jsp to *.jpdl.xml file
    Anand Kumar Novice

    The process which was started by him and at what state it is (i.e  whether assignee or not )??

     

    but i want to show the process only to login  user and admin and not to all the members in the group.

  • 12. Re: How to pass values from jsp to *.jpdl.xml file
    Maciej Swiderski Master
    The process which was started by him and at what state it is (i.e  whether assignee or not )??

    Process is just started. As soon as user clicks submit button on the application form, you collect all application form inputs and user id that made the request and start new instance of the process with all this information as variables.

     

    Next it goes to your task node where you use AssignmentHandler to assign correct user(s), for example you could use following AssignmentHandler class to achieve this:

    public class AssignTask implements AssignmentHandler {
      
      private static final long serialVersionUID = 1L;
    
      public void assign(Assignable assignable, OpenExecution execution) {
        // always add administrator
        assignable.addCandidateUser("admin");
        // get user id from process variable that was set on startup
        assignable.addCandidateUser((String)execution.getVariable("requestingUser"));
      }
    }
    
    but i want to show the process only to login  user and admin and not to all the members in the group.

    I was thinking to have a dynamically managed group where admin is always in the group and you add users on runtime but I agree that this is not a good solution since you could have several process instances add the same time started by different users which would result in all of them having access to all tasks.

     

    What do you think?! Will it work for your case?

     

    Cheers

    Maciej

  • 13. Re: How to pass values from jsp to *.jpdl.xml file
    Anand Kumar Novice

    Thank you once again for your reply

     

    Here is the process flow file which i have created based upon requirements. But i am unable to get through it.  &

     

    <?xml version="1.0" encoding="UTF-8"?>
    
    <process key="1" name="Work_Order" xmlns="http://jbpm.org/4.3/jpdl">
       <start g="265,16,48,48" name="start" >
          <transition g="-89,-7" name="to generate WON" to="Work Order Number Generate"/>
       </start>
       <state g="207,96,166,52" name="Work Order Number Generate">
          <transition g="-111,-9" name="to Workshop Incharge" to="Workshop Incharge"/>
       </state>
       <decision g="264,190,48,48" name="Workshop Incharge">
              <handler class="workorder.ContentEvaluation" />
          <transition g="6,2" name="to Assign" to="Assign and Send Mail"/>
          <transition g="-49,-18" name="to Modify" to="Modify and Re-submit"/>
          <transition g="462,212:-80,-16" name="to Withdraw WO" to="Cancellation"/>
       </decision>
       <task assignee="${content}" g="224,285,135,52" name="Assign and Send Mail">
          <transition g="116,366:-50,27" name="sending..." to="Send Mail"/>
       </task>
       <mail g="63,412,108,53" name="Send Mail">
          <transition g="24,-15" name="to Stop" to="end1"/>
          <transition g="293,437:-71,14" name="to Supervisor" to="To Update the Entries"/>
       </mail>
       <sub-process g="235,604,119,52" name="Complete and Mail">
          <transition g="114,629:8,-22" name="sending..." to="Send Mail"/>
       </sub-process>
       <end g="443,402,48,48" name="end1"/>
       <task assignee="${content}" g="58,288,135,52" name="Modify and Re-submit" >
          <transition g="125,214:-68,-18" name="to re-submit" to="Workshop Incharge"/>
       </task>
       <task assignee="${content}" g="419,281,92,52" name="Cancellation">
          <transition g="-40,-22" name="to stop" to="end1"/>
       </task>
       <task g="230,510,127,52" name="To Update the Entries">
          <transition g="-52,-7" name="to update" to="Complete and Mail"/>
       </task>
    </process>
    

     

    Can you help me where i went wrong in the above file.??

     

    Here i am using single jpdl file for both (user & admin), can i do that or i have to create separate file for each user based upon the tasks like the options as said in the previous post ?

     

    Message was edited by: Anand Kumar

  • 14. Re: How to pass values from jsp to *.jpdl.xml file
    Maciej Swiderski Master

    What is the problem that prevents from going through this process?

     

    I think it should be one process definition (single jpdl file), since it is only one process but two different actors involved.

     

    Would be good if you could post a bit more stuff, perhaps unit tests and the java class you are using.

     

    Cheers,

    Maciej

1 2 Previous Next