<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can I get all tasks assigned to an user: waiting tasks but not tasks completed in the workflow in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-get-all-tasks-assigned-to-an-user-waiting-tasks-but/m-p/324999#M12000</link>
    <description>&lt;P&gt;You can try something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;protected CoreSession session = null;

protected List&amp;lt;Task&amp;gt; getAllTasks(NuxeoPrincipal principal) {

	ArrayList&amp;lt;Task&amp;gt; userTasks = new ArrayList&amp;lt;Task&amp;gt;();

	if (session != null) {
        try {
            List&amp;lt;String&amp;gt; actors = TaskActorsHelper.getTaskActors(principal);
        	TaskService taskService = Framework.getService(TaskService.class);
            List&amp;lt;Task&amp;gt; tasks = taskService.getCurrentTaskInstances(actors, session);
            if (tasks != null) {
                for (Task task : tasks) {
                    try {
                        if (task.hasEnded() || task.isCancelled()) {
                            continue;
                        }
                        DocumentModel doc = taskService.getTargetDocumentModel(task, session);
                        if (doc != null) {
                            if (LifeCycleConstants.DELETED_STATE.equals(doc.getCurrentLifeCycleState())) {
                                continue;
                            } else {
                                userTasks.add(task);
                            }
                        } 
                    } catch (Exception e) {
                        //exception handler
                    }
                }
            }
        } catch (Exception e) {
                //exception handler
        }
    }
    return userTasks;
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 12 May 2013 21:27:59 GMT</pubDate>
    <dc:creator>adam_bo_</dc:creator>
    <dc:date>2013-05-12T21:27:59Z</dc:date>
    <item>
      <title>How can I get all tasks assigned to an user: waiting tasks but not tasks completed in the workflow</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-get-all-tasks-assigned-to-an-user-waiting-tasks-but/m-p/324997#M11998</link>
      <description>&lt;P&gt;Hi, I want to know how can I do this: I have a workflow running for each a of my nuxeo documents, this workflow have a WorkflowVariables: transcriber. How can I get all transcribers from workflows of my documents?&lt;/P&gt;
&lt;P&gt;Or more easy: How can I get all tasks assigned to an user? open tasks by this user,  waiting tasks by this user to be run but not tasks completed&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2013 18:29:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-get-all-tasks-assigned-to-an-user-waiting-tasks-but/m-p/324997#M11998</guid>
      <dc:creator>geekonspace</dc:creator>
      <dc:date>2013-05-08T18:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get all tasks assigned to an user: waiting tasks but not tasks completed in the workflow</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-get-all-tasks-assigned-to-an-user-waiting-tasks-but/m-p/324998#M11999</link>
      <description>&lt;P&gt;Please read this article: &lt;A href="http://doc.nuxeo.com/display/Studio/How+to+set+up+a+tasks+dashboard" target="test_blank"&gt;http://doc.nuxeo.com/display/Studio/How+to+set+up+a+tasks+dashboard&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2013 20:04:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-get-all-tasks-assigned-to-an-user-waiting-tasks-but/m-p/324998#M11999</guid>
      <dc:creator>jmdavid_8121</dc:creator>
      <dc:date>2013-05-08T20:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get all tasks assigned to an user: waiting tasks but not tasks completed in the workflow</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-get-all-tasks-assigned-to-an-user-waiting-tasks-but/m-p/324999#M12000</link>
      <description>&lt;P&gt;You can try something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;protected CoreSession session = null;

protected List&amp;lt;Task&amp;gt; getAllTasks(NuxeoPrincipal principal) {

	ArrayList&amp;lt;Task&amp;gt; userTasks = new ArrayList&amp;lt;Task&amp;gt;();

	if (session != null) {
        try {
            List&amp;lt;String&amp;gt; actors = TaskActorsHelper.getTaskActors(principal);
        	TaskService taskService = Framework.getService(TaskService.class);
            List&amp;lt;Task&amp;gt; tasks = taskService.getCurrentTaskInstances(actors, session);
            if (tasks != null) {
                for (Task task : tasks) {
                    try {
                        if (task.hasEnded() || task.isCancelled()) {
                            continue;
                        }
                        DocumentModel doc = taskService.getTargetDocumentModel(task, session);
                        if (doc != null) {
                            if (LifeCycleConstants.DELETED_STATE.equals(doc.getCurrentLifeCycleState())) {
                                continue;
                            } else {
                                userTasks.add(task);
                            }
                        } 
                    } catch (Exception e) {
                        //exception handler
                    }
                }
            }
        } catch (Exception e) {
                //exception handler
        }
    }
    return userTasks;
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 12 May 2013 21:27:59 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-get-all-tasks-assigned-to-an-user-waiting-tasks-but/m-p/324999#M12000</guid>
      <dc:creator>adam_bo_</dc:creator>
      <dc:date>2013-05-12T21:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get all tasks assigned to an user: waiting tasks but not tasks completed in the workflow</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-get-all-tasks-assigned-to-an-user-waiting-tasks-but/m-p/325000#M12001</link>
      <description>&lt;P&gt;Hi, thanks for your answer, but the "taskService.getCurrent TaskInstances(actors, session);" method only gets active tasks and not waiting tasks or ended tasks.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2013 15:04:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-get-all-tasks-assigned-to-an-user-waiting-tasks-but/m-p/325000#M12001</guid>
      <dc:creator>geekonspace</dc:creator>
      <dc:date>2013-05-14T15:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get all tasks assigned to an user: waiting tasks but not tasks completed in the workflow</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-get-all-tasks-assigned-to-an-user-waiting-tasks-but/m-p/325001#M12002</link>
      <description>&lt;P&gt;I am not able to access TaskService from my custom java code. What maven dependency I need to include in my core project ?
org.nuxeo.ecm.platform.task package is not found.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 07:19:49 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-get-all-tasks-assigned-to-an-user-waiting-tasks-but/m-p/325001#M12002</guid>
      <dc:creator>Vinit_Shah</dc:creator>
      <dc:date>2022-11-01T07:19:49Z</dc:date>
    </item>
  </channel>
</rss>

