© 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
TaskManager
TaskList
Task
| Interface | Method |
|---|---|
| TaskManager | TaskListArray getTaskLists() |
| TaskList | Task createTask(Map options) void addTask(Task task) void updateTask(Task task) void deleteTask(Task task) PendingOperation clearTasks(SucessCallback successCallback, ErrorCallback errorCallback) PendingOperation findTasks(SucessCallback successCallback, ErrorCallback errorCallback, Map filter) |
| Task | Object getProperty(DOMString propertyName) StringArray getSupportedPropertyKeys() void setProperty(DOMString propertyName, Object propertyValue) |
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 list of URIs used to declare this API's features, for use in bondi.requestFeature. For each URL, the list of functions provided is provided.
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;
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();
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 Map 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 SucessCallback successCallback,
in ErrorCallback errorCallback)
raises(SecurityError, DeviceAPIError);
PendingOperation findTasks(in SucessCallback successCallback,
in ErrorCallback errorCallback,
[Optional] in Map filter)
raises(SecurityError, DeviceAPIError);
};
createTask
Creates a task object.
Task createTask(Map options);
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(Task task);
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(Task task);
var taskLists = bondi.pim.task.getTaskLists();
taskLists[0].findTasks(successCallback,errorCallback,null);
function successCallback(response) {
response[0].note = "updated note";
taskLists[0].updateTask(response[0]);
}
function errorCallback(response) {
alert( "The following error: " + response.code + ", ocurred finding a task");
}
deleteTask
Deletes a task from the task list.
void deleteTask(Task task);
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(SucessCallback successCallback, ErrorCallback errorCallback);
var taskLists = bondi.pim.task.getTaskLists();
taskLists[0].clearTasks(null, successCallback, errorCallback);
function successCallback(response) {
alert("Deleted!");
}
function errorCallback(response) {
alert( "The following error: " + response.message + ", occurred in " + response.name);
}
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(SucessCallback successCallback, ErrorCallback errorCallback, Map 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 conductes is case sensitive. If the string is found anywhere inside the key object value, the entire object will be returned.
var taskLists = bondi.pim.task.getTaskLists();
taskLists[0].findTasks(successCallback, errorCallback, {summary:"Add BONDI comments"});
function successCallback(response) {
alert(response.length + " results found.");
}
function errorCallback(response) {
alert( "The following error: " + response.message + ", occurred in " + response.name);
}
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()
raises(DeviceAPIError);
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(DOMString propertyName);
...
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(DOMString propertyName, Object propertyValue);
var maxSize = task.getPropertyMaxSize("Summary");
var summary = "Reformat BONDI comments within Doxygen documentation";
task.setProperty("summary", summary.substring(0, maxSize-1));