JBoss Community

Re: How to use task and state in jbpm 4.4

created by Samrat Roy in jBPM - View the full discussion

and this is how you get the task id's of the tasks allocated to a user  before you display them on a jsp ..

 

Keep the task id in a hidden field if you so desire.

 

public List<ApproveLeaveModel> getPersonalList(String username) {

        List<ApproveLeaveModel> approvalList = new ArrayList<ApproveLeaveModel>();

        List<Task> personalTaskList = taskService.findPersonalTasks(username);  // finds personal tasks alloted to a user.

       

        for(Task t : personalTaskList){

            String tId = t.getId();

            Set<String> variableNames = taskService.getVariableNames(tId);

            Map<String,Object> variables = taskService.getVariables(tId, variableNames);

            Integer reqId= (Integer)variables.get("requestId");

            String requestId = reqId.toString();

            if(requestId!=null){

                ApproveLeaveModel alm  = leaveModuleDao.getLeaveRequestbyId(requestId);

                alm.setTaskId(tId);

                approvalList.add(alm);

            }

        }

        return approvalList;

    }

Reply to this message by going to Community

Start a new discussion in jBPM at Community