cancel
Showing results for 
Search instead for 
Did you mean: 

get reviewers of workflow with java

pchoe
Champ in-the-making
Champ in-the-making
Is there a way to get a list of reviewers for a workflow using Alfresco Java API?
2 REPLIES 2

randy_taylor
Champ in-the-making
Champ in-the-making
We need to preload the list of reviewers based on product and document type. (and still allow the user to modify the list of reviewers) 
Is there any sample how to document for that or code fragments that you someone can point us to?
Could that be accomplished with a task listener or is there a better way to do that?

kofwhgh
Champ in-the-making
Champ in-the-making
Hi pchoe

workflow have tasks and task have reviewer info

1. you got workflow
2. find tasks in workflow
3. you got reviewer in task

I used javabacked webscript

      WorkflowTask task = registry.getWorkflowService().getTaskById(taskId);
      WorkflowTaskQuery query = new WorkflowTaskQuery();
      query.setProcessId(task.getPath().getInstance().getId());
      query.setTaskState(WorkflowTaskState.COMPLETED);
      query.setActive(false);
      query.setOrderBy(new WorkflowTaskQuery.OrderBy[] {
               WorkflowTaskQuery.OrderBy.TaskCreated_Desc,
               WorkflowTaskQuery.OrderBy.TaskActor_Asc });
      List<WorkflowTask> completedTasks1 = registry.getWorkflowService().queryTasks(query, true);
     
      query.setActive(true);
      List<WorkflowTask> completedTasks2 = registry.getWorkflowService().queryTasks(query, true);
     
      query.setTaskState(WorkflowTaskState.IN_PROGRESS);
      query.setActive(true);
      List<WorkflowTask> inProgressTasks1 = registry.getWorkflowService().queryTasks(query, true);
     
      query.setActive(false);
      List<WorkflowTask> inProgressTasks2 = registry.getWorkflowService().queryTasks(query, true);

      List<WorkflowTask> tasks = new ArrayList<WorkflowTask>();
      tasks.addAll(completedTasks1);
      tasks.addAll(completedTasks2);
      tasks.addAll(inProgressTasks1);
      tasks.addAll(inProgressTasks2);
     
      // workflow history
      List<Map<String, Object>> historyDatas = new ArrayList<Map<String, Object>>();
      for (WorkflowTask htask : tasks) {
         Map<String, Object> data = WebScriptUtil.transDataMap(htask.getProperties());
         historyDatas.add(data);
      }

I wish you solve the problem.

good day