Hi all

I am creating a workflow(integrated into a Java web application) for a leave application approval. The workflow is as follows:

Leave request is raised for an employee.

Case 1: If employee's role is not team lead.
The request is sent to employee's team lead.
If team lead rejects, workflow ends.
If team lead approves, request is forwarded to manager.

Case 2: If employee's role is team lead.
The request is directly sent to Manager.

Workflow ends when manager approves/rejects the application. At the time of approval/rejection the user needs to enter a comment.

I need to generate web-form for user input. The options can be dynamic and should be defined in workflow itself. How can I achieve this? What is the right way to manage different directions of a workflow based on different roles?

Any thoughts/suggestions are welcome. It will be helpful if someone can direct me to example/sample code to achieve this.