AquaLogic User Interaction Development Guide

     Previous Next  Open TOC in new window   View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Querying Collaboration Tasks and Task Lists Using IDK Remote APIs

To query Collaboration task lists, tasks and subtasks from a remote application, use the ITaskListManager interface in the IDK.

The PRC Collaboration API allows you to query existing collaboration tasks and task lists. Results can be filtered in a variety of ways.
  • To query for task lists in a given project, use ITaskListManager.queryTaskLists using the project instance.
  • To query for tasks in a given project, use ITaskListManager.queryTasks using the project instance.
  • To query for tasks in a given task list, use ITaskListManager.queryTasks using the task list instance.
For any of these queries, the ITaskListFilter/ITaskFilter interfaces allow you to set the following search options:
Maximum Results Sets the maximum number of results returned. The default is to return all results.
Order-By Fields and Sort Order Sets the fields to be displayed with an order-by functionality, and sets the sort order (ascending or descending). The following fields support the order-by option: name, start date, end date, status, assigned to (tasks and subtasks only) and order (location of the task or subtask in the hierarchy - tasks and subtasks only).
Security Enables or disables the security filter that applies security to the result set with respect to the user that submitted the query. If the filter is enabled, the query result will only include objects for which the querying user has appropriate permission. The default is false (disabled); all objects matching the query criteria will be returned.
Result Filter: Status Limits queries by status (completed, pending or overdue).
Result Filter: User Tasks and subtasks only. Limits queries to those tasks assigned to a specific user.
Result Filter: Assignment Tasks and subtasks only. Limits queries to unassigned tasks.

To query for task lists, tasks and subtasks, follow the steps below.

  1. Create a PRC session. For details, see Initiating a PRC Session to Use IDK Remote APIs.
  2. Get the project or task list ID and retrieve the associated object.
  3. Create a new method to query for task lists or tasks.
  4. Get the Task List Manager.
  5. Create a query filter as shown in the code samples below.
  6. Execute the query.
The following examples query for task lists in a project. To create a query filter for tasks, replace ITaskListFilter with ITaskFilter.

Java

...

ITaskListFilter taskListFilter = tasklistManager.createTaskListFilter();

//set the query to search for all task lists
//options can be set to search for task lists that contain only pending tasks,
//completed tasks, or overdue tasks
taskListFilter.setCompletionType(TaskListCompletionFilterType.ALL);

//limit the return results to be 10
taskListFilter.setMaximumResults(10);

//disable security checking against the user who performs the query,
//so that all objects will be returned
taskListFilter.setRestoreSecurity(false);

//use TaskListQueryOrder to sort the query result by NAME in ascending order
TaskListQueryOrder taskListQueryOrder = new TaskListQueryOrder(TaskListAttribute.NAME, true);
taskListFilter.setQueryOrders(new TaskListQueryOrder(taskListQueryOrder));

//an array of ITaskList objects are returned from queryTaskLists(); 
// if no result is retrieved, a zero-length array will be returned
ITaskList[] retrievedTaskLists = tasklistManager.queryTaskLists(project, taskListFilter);

...

.NET (C#)

...

ITaskListFilter taskListFilter = tasklistManager.CreateTaskListFilter();

//set the query to search for all task list
//options can be set to search for task lists that contain only pending tasks,
//completed tasks, or overdue tasks. 
taskListFilter.CompletionType = TaskListCompletionFilterTypes.All;

//limit the return results to be 10
taskListFilter.MaximumResults = 10;

//disable security checking against the user who performs the query,
//so that all objects will be returned
taskListFilter.RestoreSecurity = false;

//use TaskListQueryOrder to sort the query result by NAME in ascending order
TaskListQueryOrder taskListQueryOrder = new TaskListQueryOrder(TaskListAttributes.Name, true);
taskListFilter.QueryOrders = new TaskListQueryOrder(taskListQueryOrder);

//an array of ITaskList objects are returned from queryTaskLists(); 
//if no result is retrieved, a zero-length array will be returned
ITaskList[] retrievedTaskLists = tasklistManager.QueryTaskLists(project, taskListFilter);

...

.NET (VB)

...

dim taskListFilter As ITaskListFilter = tasklistManager.CreateTaskListFilter();

'set the query to search for all task list
'options can be set to search for task lists that contain only pending tasks,
'completed tasks, or overdue tasks. 
taskListFilter.CompletionType = TaskListCompletionFilterTypes.All

'limit the return results to be 10
taskListFilter.MaximumResults = 10

'disable security checking against the user who performs the query,
'so that all objects will be returned
taskListFilter.RestoreSecurity = false

'use TaskListQueryOrder to sort the query result by NAME in ascending order
dim taskListQueryOrder As TaskListQueryOrder = new TaskListQueryOrder(TaskListAttributes.Name, true)
taskListFilter.QueryOrders(0) = taskListQueryOrder

'an array of ITaskList objects are returned from queryTaskLists()
'if no result is retrieved, a zero-length array will be returned
dim retrievedTaskLists() As ITaskList = tasklistManager.QueryTaskLists(project, taskListFilter)

...

  Back to Top      Previous Next