© 2009 OMTP Ltd. All rights reserved. OMTP and OMTP BONDI are registered trademarks of OMTP Ltd.
To give API access to phone resident task management functions
TaskListArray
TaskArray
TaskArraySuccessCallback
TaskManager
TaskList
Task
TaskOptions
TaskFilter
TaskManagerObject
| Interface | Method |
|---|---|
| TaskArraySuccessCallback | void onSuccess(TaskArray tasks) |
| TaskManager | TaskListArray getTaskLists() |
| TaskList | Task createTask(TaskOptions options) void addTask(Task task) void updateTask(Task task) void deleteTask(Task task) PendingOperation clearTasks(SuccessCallback successCallback, ErrorCallback errorCallback) PendingOperation findTasks(TaskArraySuccessCallback successCallback, ErrorCallback errorCallback, TaskFilter filter) |
| Task | Object getProperty(DOMString propertyName) StringArray getSupportedPropertyKeys() void setProperty(DOMString propertyName, Object propertyValue) |
| TaskOptions | |
| TaskFilter | |
| TaskManagerObject |
The BONDI Task API provides access to the tasks stored in the device. With this API it is possible to read, create, delete and update tasks.
It is also possible to assign priority to tasks with the following supported values:
- HIGH_PRIORITY
- MEDIUM_PRIORITY
- LOW_PRIORITY
The status of the task can be defined depending on the platform. The supported values are:
- STATUS_DONE
- STATUS_PENDING
- STATUS_ONGOING
Finding tasks using a filter is also supported with the method findTask. The supported properties are returned by the task class method getSupportedPropertyKeys. These supported keys are valid for this and/or the createTask method.
var taskList = bondi.pim.task.getTaskLists();
var tasks = taskList[0].findTasks(successCallback,errorCallback,null);
function successCallback(response) {
if (response[0].priority == bondi.pim.task.HIGH_PRIORITY) alert("Very important");
}
function errorCallback(response){alert("Error retrieving task, because: " + response.code)};
This is the URI used to declare this API's feature set, for use in bondi.requestFeature. For the URL, the list of features included by the feature set is provided.
All the Task features
Includes API features:
http://bondi.omtp.org/api/pim.task.read
http://bondi.omtp.org/api/pim.task.write
This is the list of URIs used to declare this API's features, for use in bondi.requestFeature. For each URL, the list of functions covered is provided.
When any of the features
http://bondi.omtp.org/api/pim.task.read
http://bondi.omtp.org/api/pim.task.write
is successfully requested, the interface
TaskManager
is instantiated, and the resulting object appears in the global
namespace as
.taskManager.
Call to getTaskLists method of TaskManager class.
Device capabilities:
pim.task.read
Call to addTask, updateTask, deleteTask, clearTasks methods of TaskList class.
Device capabilities:
pim.task.write
pim.task.read
Read tasks
pim.task.read
Write, modify or delete tasks
TaskListArray
Array of Tasks.
typedef sequence<TaskList> TaskListArray;
TaskArray
Array of Task.
typedef sequence<Task> TaskArray;
TaskArraySuccessCallback
Success callback for retrieving a list of Task.
[Callback=FunctionOnly, NoInterfaceObject] interface TaskArraySuccessCallback {
void onSuccess(in TaskArray tasks);
};
Success callback that takes an array of Task as input argument. It is used in the asynchronous operation to get a list of Task.
onSuccess
Method invoked when the list of tasks is retrieved succesfully
void onSuccess(in TaskArray tasks);
TaskManager
Manager class exposed as the task module API. The Task Manager interface offers methods to retrieve the task lists, stored in the phone.
interface TaskManager {
const unsigned short HIGH_PRIORITY = 0;
const unsigned short MEDIUM_PRIORITY = 1;
const unsigned short LOW_PRIORITY = 2;
const unsigned short STATUS_DONE = 0;
const unsigned short STATUS_PENDING = 1;
const unsigned short STATUS_ONGOING = 2;
TaskListArray getTaskLists()
raises(SecurityError);
};
unsigned short HIGH_PRIORITY
High priority
unsigned short MEDIUM_PRIORITY
Medium priority.
unsigned short LOW_PRIORITY
Low priority.
unsigned short STATUS_DONE
The task has been finished.
unsigned short STATUS_PENDING
The task has not been started yet.
unsigned short STATUS_ONGOING
The task has been started but it is no finished yet.
getTaskLists
Gets the available task lists in the device.
TaskListArray getTaskLists();
PERMISSION_DENIED_ERROR when access is denied by the security policy.
var tasklists = bondi.pim.task.getTaskLists();
var nativeTaskList = tasklists[0];
TaskList
Abstraction of a list of tasks A list representing all tasks available in the device The TaskList interface offers methods to Find tasks using filters with the findTask method. Adds a task on the device using the addTask method. Update an existing task using the updateTask method. Delete a specific task using the deleteTask method. Clear the entire task list using the clearTasks method.
interface TaskList {
Task createTask([Optional] in TaskOptions options)
raises(SecurityError, DeviceAPIError);
void addTask(in Task task)
raises(SecurityError, DeviceAPIError);
void updateTask(in Task task)
raises(SecurityError, DeviceAPIError);
void deleteTask(in Task task)
raises(SecurityError, DeviceAPIError);
PendingOperation clearTasks(in SuccessCallback successCallback,
in ErrorCallback errorCallback)
raises(SecurityError, DeviceAPIError);
PendingOperation findTasks(in TaskArraySuccessCallback successCallback,
in ErrorCallback errorCallback,
[Optional] in TaskFilter filter)
raises(SecurityError, DeviceAPIError);
};
createTask
Creates a task object.
Task createTask(in TaskOptions options);
PERMISSION_DENIED_ERROR when access is denied by the security policy.
INVALID_ARGUMENT_ERROR if the options are wrong.
var tasklists = bondi.pim.task.getTaskLists();
var task = tasklists[0].createTask({priority:0, summary:'blah blah blah', note: 'ask pedro', due:'2009-02-20T09:00:00.000+01:00', status:0});
addTask
Adds a task to the task list.
void addTask(in Task task);
PERMISSION_DENIED_ERROR when access is denied by the security policy.
INVALID_ARGUMENT_ERROR if the input parameter contains a wrong object.
var tasklists = bondi.pim.task.getTaskLists();
var task = tasklists[0].createTask({priority:0, summary:'a quick reminder', note: 'ask pedro', due:'2009-02-20T09:00:00.000+01:00', status:0});
tasklists[0].addTask(task);
updateTask
Updates an existing task in the task list
void updateTask(in Task task);
PERMISSION_DENIED_ERROR when access is denied by the security policy.
INVALID_ARGUMENT_ERROR if task are wrong object.
var taskLists = bondi.pim.task.getTaskLists();
// Define the success callback.
function successCallback(response) {
// Update the first task.
response[0].note = "updated note";
taskLists[0].updateTask(response[0]);
}
// Define the error callback.
function errorCallback(response) {
alert( "The following error: " + response.code + ", ocurred finding a task");
}
// Find the tasks.
taskLists[0].findTasks(successCallback,errorCallback,null);
deleteTask
Deletes a task from the task list.
void deleteTask(in Task task);
PERMISSION_DENIED_ERROR when access is denied by the security policy.
INVALID_ARGUMENT_ERROR if task are wrong object.
var taskLists = bondi.pim.task.getTaskLists();
//...
taskLists[0].deleteTask(task);
clearTasks
Deletes all tasks in the task list. It is an asynchronous method.
PendingOperation clearTasks(in SuccessCallback successCallback, in ErrorCallback errorCallback);
PERMISSION_DENIED_ERROR when access is denied by the security policy.
INVALID_ARGUMENT_ERROR if task are wrong object.
var taskLists = bondi.pim.task.getTaskLists();
// Define the success callback.
function successCallback(response) {
alert("Deleted!");
}
// Define the error callback.
function errorCallback(response) {
alert( "The following error: " + response.message + ", occurred in " + response.name);
}
// Clear all tasks.
taskLists[0].clearTasks(successCallback, errorCallback);
findTasks
Gets an array of Task objects for tasks stored within the calendar and matching the selected filter. This is an asynchronous method.
PendingOperation findTasks(in TaskArraySuccessCallback successCallback, in ErrorCallback errorCallback, in TaskFilter filter);
In a search using this method, if more than one value is used, then the AND operator will be used betwwen all values to perform the search.
In a search using strings, the search conducted is case sensitive. If the string is found anywhere inside the key object value, the entire object will be returned.
The search is performed only taken into account the values that have been specified in the filter object
PERMISSION_DENIED_ERROR when access is denied by the security policy.
INVALID_ARGUMENT_ERROR if filter or options are wrong.
var taskLists = bondi.pim.task.getTaskLists();
// Define the success callback.
function successCallback(response) {
alert(response.length + " results found.");
}
// Define the error callback.
function errorCallback(response) {
alert( "The following error: " + response.message + ", occurred in " + response.name);
}
// Find the tasks with the specified summary.
taskLists[0].findTasks(successCallback, errorCallback, {summary:"Add BONDI comments"});
Task
Abstaction of the task . This interface offers properties to manage each task property. It also includes methods to get a specific property and to get the available properties to use in the findTasks filter, addTask and updateTask methods.
interface Task {
attribute DOMString id;
attribute unsigned short priority;
attribute DOMString note;
attribute DOMString summary;
attribute Date due;
attribute unsigned short status;
Object getProperty(in DOMString propertyName)
raises(DeviceAPIError);
StringArray getSupportedPropertyKeys();
void setProperty(in DOMString propertyName,in Object propertyValue)
raises(DeviceAPIError);
};
DOMString id
Unique identifier assigned to the task in the platform. Read only.
var task = tasklist.CreateTask(null);
var id = task.id;
unsigned short priority
Priority of the task.
var task = taskList.CreateTask(null);
task.priority = bondi.pim.task.HIGH_PRIORITY;
DOMString note
Note of the task.
var task = taskList.CreateTask(null);
task.note = "BONDI note";
DOMString summary
Summary of the task.
var task = taskList.CreateTask(null);
task.summary = "BONDI Codefest summary";
Date due
Due date of the task.
var task = taskList.CreateTask(null);
task.due = '2009-02-20T09:00:00.000+01:00';
unsigned short status
Completed status of the task.
var task = taskList.CreateTask(null);
task.status = bondi.pim.task.STATUS_PENDING;
getProperty
Gets the value of any of the Task object properties.
Object getProperty(in DOMString propertyName);
INVALID_ARGUMENT_ERROR if invalid propertyName is given
var due = task.getProperty("due");
getSupportedPropertyKeys
Gets the available attributes for tasks in this task list.
StringArray getSupportedPropertyKeys();
var tasklists = bondi.pim.task.getTaskLists();
var attributes = tasklists[0].getSupportedPropertyKeys();
alert("Number of attributes: " + attributes.count);
setProperty
Sets the value of a Task object property.
void setProperty(in DOMString propertyName, in Object propertyValue);
INVALID_ARGUMENT_ERROR if invalid propertyName is given
var maxSize = task.getPropertyMaxSize("Summary");
var summary = "Reformat BONDI comments within Doxygen documentation";
task.setProperty("summary", summary.substring(0, maxSize-1));
TaskOptions
Used for task filtering and task creation
[NoInterfaceObject, Callback] interface TaskOptions {
attribute short priority;
attribute DOMString summary;
attribute DOMString note;
attribute Date due;
attribute short status;
};
Contains task related information to be used for filtering purposes (in findTask method) or initialization (createTask method)
var tasklists = bondi.pim.task.getTaskLists();
var task = tasklists[0].createTask({priority:0, summary:'a quick reminder', note: 'ask pedro', due:'2009-02-20T09:00:00.000+01:00', status:0});
tasklists[0].addTask(task);
short priority
Task priority
DOMString summary
Task summary
DOMString note
Task description
Date due
Task due date
short status
Task status
TaskFilter
Used for task filtering
[NoInterfaceObject, Callback] interface TaskFilter {
attribute short priority;
attribute DOMString summary;
attribute DOMString note;
attribute Date initialDueDate;
attribute Date finalDueDate;
attribute short status;
};
Contains task related information to be used for filtering purposes (in findTask method)
var taskLists = bondi.pim.task.getTaskLists();
// Define the success callback.
function successCallback(response) {
alert(response.length + " results found.");
}
// Define the error callback.
function errorCallback(response) {
alert( "The following error: " + response.message + ", occurred in " + response.name);
}
// Find the tasks with the specified summary.
taskLists[0].findTasks(successCallback, errorCallback, {summary:"Add BONDI comments"});
short priority
Task priority
DOMString summary
Task summary
DOMString note
Task description
Date initialDueDate
Initial task due date, used to look for tasks with due date later than the specified one
Date finalDueDate
Final task due date, used to look for tasks with due date previous to the specified one
short status
Task status
TaskManagerObject
Specifies what is instantiated at feature request
interface TaskManagerObject {
readonly attribute TaskManager taskManager;
};