As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
public List<Node> getAllTasks() { // get the current username // FacesContext context = FacesContext.getCurrentInstance(); // User user = Application.getCurrentUser(context); // String userName = user.getUserName(); // // UserTransaction tx = null; // try { // tx = Repository.getUserTransaction(context, true); // tx.begin(); this.allTasks = new ArrayList<Node>(); List<WorkflowInstance> workflows = new ArrayList<WorkflowInstance>(); workflows = workflowService.getWorkflowsForContent( documentDetailsBean.getDocument().getNodeRef(), false); workflows.addAll(workflowService.getWorkflowsForContent( documentDetailsBean.getDocument().getNodeRef(), true)); if (workflows != null && workflows.size() > 0) { for (WorkflowInstance wi : workflows) { WorkflowTaskQuery query = new WorkflowTaskQuery(); //query.setTaskState(WorkflowTaskState.COMPLETED); query.setProcessId(wi.id); List<WorkflowTask> tasks = this.workflowService.queryTasks(query); // create a list of transient nodes to represents for (WorkflowTask task : tasks) { Node node = createTask(task); this.allTasks.add(node); if (logger.isDebugEnabled()) logger.debug("Added task: " + node); } } } // commit the changes // tx.commit(); // } catch (Throwable e) { // // rollback the transaction // try { // if (tx != null) { // tx.rollback(); // } // } catch (Exception ex) { // } // Utils.addErrorMessage("Failed to get all tasks: " // + e.toString(), e); // } return this.allTasks; }
query.setTaskState(null);
WorkflowTaskQuery query = new WorkflowTaskQuery(); query.setTaskState(null); query.setProcessId(wi.id); List<WorkflowTask> tasks = this.workflowService.queryTasks(query);
query.setActive(wi.active);
Thank you, Marc!
Regards.