@SuppressWarnings("unchecked")
 private List<ActivityInstance> getWorklist(EvaluationPolicy... policies) {
   WorkflowService ws = sf.getWorkflowService();
   WorklistQuery query = WorklistQuery.findCompleteWorklist();
   if (policies != null) {
     for (EvaluationPolicy policy : policies) {
       query.setPolicy(policy);
     }
   }
   Worklist worklist = ws.getWorklist(query);
   return worklist.getCumulatedItems();
 }
 @SuppressWarnings("unchecked")
 private List<ActivityInstance> getWorklist(ProcessInstance pi, EvaluationPolicy... policies) {
   WorkflowService ws = sf.getWorkflowService();
   WorklistQuery query = WorklistQuery.findCompleteWorklist();
   if (policies != null) {
     for (EvaluationPolicy policy : policies) {
       query.setPolicy(policy);
     }
   }
   query.getFilter().add(new ProcessInstanceFilter(pi.getOID(), false));
   Worklist worklist = ws.getWorklist(query);
   return worklist.getCumulatedItems();
 }