OKMTask
Basics
Section titled “Basics”Task fields description:
| Field | Type | Description | Mandatory |
|---|---|---|---|
| Id | Long | Internal task id. It is automatically set by the application. |
Not applicable. |
| Owner | String | It contains the OpenKM userId. It is automatically set by the application. |
Not applicable. |
| Subject | String | The topic of the task. | Yes. |
| Description | String | The description of the task. | No. |
| Start | Calendar | When the task might start. | Yes. |
| End | Calendar | When the task might end. | No. |
| Status | TaskStatus | The task status. You administer the list of status values. |
Yes. |
| Project | TaskProject | The project related to the task. You administer the list of project values. |
Yes. |
| Type | TaskType | The task type. You administer the list of task type values. |
Yes. |
| Progress | Integer | The numeric progress status. The range of allowed values is from 0 to 100, where 100% indicates a completed task. |
Yes. |
| RepeatGroup | Long | When a task is repeated over time, it is a member of a group. The group is identified by a unique repeat group id. | No. |
| ReminderStartValue | Integer | How many days before the task starts, the system might send an email notification to the user. | No. |
| ReminderEndValue | Integer | How many days before the task ends, the system might send an email notification to the user. | No. |
| ReminderStartUnit | String | Reminder start units. Allowed values: - “m” for minutes. - “h” for hours. - “d” for days. |
Mandatory when ReminderStartValue is greater than 0. |
| ReminderEndUnit | String | Reminder end units. Allowed values: - “m” for minutes. - “h” for hours. - “d” for days. |
Mandatory when ReminderEndValue is greater than 0. |
| Users | Set |
Collection of users assigned to the task. | No. But at least one user or role should be assigned. |
| Roles | Set |
Collection of assigned roles to the task. | No. But at least one user or role should be assigned. |
| Documents | Set |
List of UUIDs of the related documents. | No. |
| Folders | Set |
List of UUIDs of the related folders. | No. |
| Mails | Set |
List of UUIDs of the related emails. | No. |
| Records | Set |
List of UUIDs of the related records. | No. |
In all methods, there is a parameter named “token”. When accessing the application via REST, the login process returns a token. The token is used to identify the user for all exposed methods. From the default application execution context you must use the “null” value, which indicates the application must use the “user session”.
Methods
Section titled “Methods”create
Section titled “create”Description:
| Method | Return values | Description |
|---|---|---|
| create(String token, Task task) | Task | Create a new task. |
Example:
package com.openkm;
import java.util.Calendar;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.bean.TaskProject;import com.openkm.bean.TaskStatus;import com.openkm.bean.TaskType;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); Task task = new Task(); task.setSubject("task subject"); task.setDescription("description"); Calendar start = Calendar.getInstance(); start.add(Calendar.DATE, 15); task.setStart(start); long taskStatusId = 1; // A valid task status id long projectId = 1; // A valid project id long typeId = 1; // A valid type id TaskStatus status = okmTask.findStatus(null, taskStatusId); TaskProject project = okmTask.findProject(null, projectId); TaskType type = okmTask.findType(null, typeId); task.setStatus(status); task.setProject(project); task.setType(type); task.setProgress(0); okmTask.create(null, task); } catch (Exception e) { e.printStackTrace(); } }}update
Section titled “update”Description:
| Method | Return values | Description |
|---|---|---|
| update(String token, Task task) | Task | Update a task. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long taskId = 1; // A valid task id Task task = okmTask.find(null, taskId); task.setSubject("subject modified"); okmTask.update(null, task); } catch (Exception e) { e.printStackTrace(); } }}Description:
| Method | Return values | Description |
|---|---|---|
| find(String token, long taskId) | Task | Find a task. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long taskId = 1; // A valid task id Task task = okmTask.find(null, taskId); System.out.println(task); } catch (Exception e) { e.printStackTrace(); } }}delete
Section titled “delete”Description:
| Method | Return values | Description |
|---|---|---|
| delete(String token, long taskId) | void | Delete a task. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long taskId = 1; // A valid task id okmTask.delete(null, taskId); } catch (Exception e) { e.printStackTrace(); } }}getByProject
Section titled “getByProject”Description:
| Method | Return values | Description |
|---|---|---|
| getByProject(String token, long projectId) | List |
Retrieve a list of tasks related to a project. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id for (Task task : okmTask.getByProject(null, projectId)) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}getByType
Section titled “getByType”Description:
| Method | Return values | Description |
|---|---|---|
| getByType(String token, long typeId) | List |
Retrieve a list of tasks related to a task type. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long typeId = 1; // A valid type id for (Task task : okmTask.getByType(null, typeId)) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}getAssigned
Section titled “getAssigned”Description:
| Method | Return values | Description |
|---|---|---|
| getAssigned(String token, long projectId, long typeId, long statusId, String orderColumn) | List |
Retrieve a list of tasks assigned to a user and filtered. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id String orderColumn = "subject"; // A valid TaskManagerTask class parameter name used in HQL query for (Task task : okmTask.getAssigned(null, projectId, typeId, statusId, orderColumn)) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}getAssigned
Section titled “getAssigned”Description:
| Method | Return values | Description |
|---|---|---|
| getAssigned(String token, long projectId, long typeId, long statusId, String orderColumn, boolean orderAsc, int offset, int limit) | List |
Retrieve a list of tasks assigned to a user, filtered and paginated. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id String orderColumn = "start"; // A valid TaskManagerTask class parameter name used in HQL query for (Task task : okmTask.getAssigned(null, projectId, typeId, statusId, orderColumn, true, 0, 10)) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}countAssigned
Section titled “countAssigned”Description:
| Method | Return values | Description |
|---|---|---|
| countAssigned(String token, long projectId, long typeId, long statusId) | Long | Return the number of tasks assigned to a user. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id long total = okmTask.countAssigned(null, projectId, typeId, statusId); System.out.println(total); } catch (Exception e) { e.printStackTrace(); } }}getActive
Section titled “getActive”Description:
| Method | Return values | Description |
|---|---|---|
| getActive(String token, long projectId, long typeId, long statusId, String orderColumn) | List |
Retrieve a list of active tasks assigned to a user and filtered. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id String orderColumn = "start"; // A valid TaskManagerTask class parameter name used in HQL query for (Task task : okmTask.getActive(null, projectId, typeId, statusId, orderColumn)) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}getActive
Section titled “getActive”Description:
| Method | Return values | Description |
|---|---|---|
| getActive(String token, long projectId, long typeId, long statusId, String orderColumn, boolean orderAsc, int offset, int limit) | List |
Retrieve a list of active tasks assigned to a user, filtered and paginated. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id String orderColumn = "start"; // A valid TaskManagerTask class parameter name used in HQL query for (Task task : okmTask.getActive(null, projectId, typeId, statusId, orderColumn, true, 0, 10)) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}countActive
Section titled “countActive”Description:
| Method | Return values | Description |
|---|---|---|
| countActive(String token, long projectId, long typeId, long statusId) | Long | Return the number of active tasks of a user. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id long total = okmTask.countActive(null, projectId, typeId, statusId); System.out.println(total); } catch (Exception e) { e.printStackTrace(); } }}getFinished
Section titled “getFinished”Description:
| Method | Return values | Description |
|---|---|---|
| getFinished(String token, long projectId, long typeId, long statusId, String orderColumn) | List |
Retrieve a list of finished tasks assigned to a user and filtered. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id String orderColumn = "start"; // A valid TaskManagerTask class parameter name used in HQL query for (Task task : okmTask.getFinished(null, projectId, typeId, statusId, orderColumn)) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}getFinished
Section titled “getFinished”Description:
| Method | Return values | Description |
|---|---|---|
| getFinished(String token, long projectId, long typeId, long statusId, String orderColumn, boolean orderAsc, int offset, int limit) | List |
Retrieve a list of finished tasks assigned to a user, filtered and paginated. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id String orderColumn = "start"; // A valid TaskManagerTask class parameter name used in HQL query for (Task task : okmTask.getFinished(null, projectId, typeId, statusId, orderColumn, true, 0, 10)) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}countFinished
Section titled “countFinished”Description:
| Method | Return values | Description |
|---|---|---|
| countFinished(String token, long projectId, long typeId, long statusId) | Long | Return the number of finished tasks of a user. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id long total = okmTask.countFinished(null, projectId, typeId, statusId); System.out.println(total); } catch (Exception e) { e.printStackTrace(); } }}findStatus
Section titled “findStatus”Description:
| Method | Return values | Description |
|---|---|---|
| findStatus(String token, long statusId) | TaskStatus | Return a task status object by id. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskStatus;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long statusId = 1; // A valid status id TaskStatus ts = okmTask.findStatus(null, statusId); System.out.println(ts); } catch (Exception e) { e.printStackTrace(); } }}findProject
Section titled “findProject”Description:
| Method | Return values | Description |
|---|---|---|
| findProject(String token, long projectId) | TaskProject | Return a task project object by id. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskProject;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id TaskProject tp = okmTask.findProject(null, projectId); System.out.println(tp); } catch (Exception e) { e.printStackTrace(); } }}findType
Section titled “findType”Description:
| Method | Return values | Description |
|---|---|---|
| findType(String token, long typeId) | TaskType | Return a task type object by id. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskType;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long typeId = 1; // A valid type id TaskType tt = okmTask.findType(null, typeId); System.out.println(tt); } catch (Exception e) { e.printStackTrace(); } }}findNote
Section titled “findNote”Description:
| Method | Return values | Description |
|---|---|---|
| findNote(String token, long noteId) | TaskNote | Return a task note object by id. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskNote;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long noteId = 2; // A valid note id TaskNote tn = okmTask.findNote(null, noteId); System.out.println(tn); } catch (Exception e) { e.printStackTrace(); } }}getStatuses
Section titled “getStatuses”Description:
| Method | Return values | Description |
|---|---|---|
| getStatuses(String token) | List |
Retrieve a list of all the task status. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskStatus;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); for (TaskStatus ts : okmTask.getStatuses(null)) { System.out.println(ts); } } catch (Exception e) { e.printStackTrace(); } }}getProjects
Section titled “getProjects”Description:
| Method | Return values | Description |
|---|---|---|
| getProjects(String token, boolean filterByActive) | List |
Retrieve a list of all the task projects. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskProject;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); for (TaskProject tp : okmTask.getProjects(null, true)) { System.out.println(tp); } } catch (Exception e) { e.printStackTrace(); } }}getTypes
Section titled “getTypes”Description:
| Method | Return values | Description |
|---|---|---|
| getTypes(String token, boolean filterByActive) | List |
Retrieve a list of all the task types. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskType;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); for (TaskType tt : okmTask.getTypes(null, true)) { System.out.println(tt); } } catch (Exception e) { e.printStackTrace(); } }}getNotes
Section titled “getNotes”Description:
| Method | Return values | Description |
|---|---|---|
| getNotes(String token, long taskId) | List |
Retrieve a list of all the notes of a task. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskNote;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long taskId = 1; // A valid task id for (TaskNote tn : okmTask.getNotes(null, taskId)) { System.out.println(tn); } } catch (Exception e) { e.printStackTrace(); } }}createStatus
Section titled “createStatus”Description:
| Method | Return values | Description |
|---|---|---|
| createStatus(String token, String name, boolean finish) | TaskStatus | Create a new task status. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskStatus;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); TaskStatus ts = okmTask.createStatus(null, "cancelled", true); System.out.println(ts); } catch (Exception e) { e.printStackTrace(); } }}createProject
Section titled “createProject”Description:
| Method | Return values | Description |
|---|---|---|
| createProject(String token, String name, String description, boolean active) | TaskProject | Create a new task project. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskProject;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); TaskProject tp = okmTask.createProject(null, "Project one", "Description", true); System.out.println(tp); } catch (Exception e) { e.printStackTrace(); } }}createType
Section titled “createType”Description:
| Method | Return values | Description |
|---|---|---|
| createType(String token, String name, String description, boolean active) | TaskType | Create a new task type. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskType;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); TaskType tt = okmTask.createType(null, "Type one", "Description", true); System.out.println(tt); } catch (Exception e) { e.printStackTrace(); } }}createNote
Section titled “createNote”Description:
| Method | Return values | Description |
|---|---|---|
| createNote(String token, long taskId, String text) | TaskNote | Create a new note to a task. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskNote;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long taskId = 1; // A valid task id TaskNote tn = okmTask.createNote(null, taskId, "New note"); System.out.println(tn); } catch (Exception e) { e.printStackTrace(); } }}updateStatus
Section titled “updateStatus”Description:
| Method | Return values | Description |
|---|---|---|
| updateStatus(String token, long id, String name, boolean finish) | TaskStatus | Update a task status. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskStatus;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long statusId = 1; // A valid task id TaskStatus ts = okmTask.findStatus(null, statusId); System.out.println(ts); ts = okmTask.updateStatus(null, statusId, "cancelled", true); System.out.println(ts); } catch (Exception e) { e.printStackTrace(); } }}updateProject
Section titled “updateProject”Description:
| Method | Return values | Description |
|---|---|---|
| updateProject(String token, long id, String name, String description, boolean active) | TaskProject | Update a task project. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskProject;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 4; // A valid project id TaskProject tp = okmTask.findProject(null, projectId); System.out.println(tp); tp = okmTask.updateProject(null, projectId, "cancelled", "Description", false); System.out.println(tp); } catch (Exception e) { e.printStackTrace(); } }}updateType
Section titled “updateType”Description:
| Method | Return values | Description |
|---|---|---|
| updateType(String token, long id, String name, String description, boolean active) | TaskType | Update a task type. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskType;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long typeId = 4; // A valid type id TaskType tp = okmTask.findType(null, typeId); System.out.println(tp); tp = okmTask.updateType(null, typeId, "Type one", "Description", false); System.out.println(tp); } catch (Exception e) { e.printStackTrace(); } }}updateNote
Section titled “updateNote”Description:
| Method | Return values | Description |
|---|---|---|
| updateNote(String token, long id, String text) | TaskNote | Update the note of a task. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskNote;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long noteId = 1; // A valid note id TaskNote tn = okmTask.updateNote(null, noteId, "Note updated"); System.out.println(tn); } catch (Exception e) { e.printStackTrace(); } }}deleteStatus
Section titled “deleteStatus”Description:
| Method | Return values | Description |
|---|---|---|
| deleteStatus(String token, long statusId) | void | Delete a task status. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long statusId = 4; // A valid status id okmTask.deleteStatus(null, statusId); } catch (Exception e) { e.printStackTrace(); } }}deleteProject
Section titled “deleteProject”Description:
| Method | Return values | Description |
|---|---|---|
| deleteProject(String token, long projectId) | void | Delete a task project. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 5; // A valid project id okmTask.deleteProject(null, projectId); } catch (Exception e) { e.printStackTrace(); } }}deleteType
Section titled “deleteType”Description:
| Method | Return values | Description |
|---|---|---|
| deleteType(String token, long typeId) | void | Delete a task type. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long typeId = 4; // A valid type id okmTask.deleteType(null, typeId); } catch (Exception e) { e.printStackTrace(); } }}deleteNote
Section titled “deleteNote”Description:
| Method | Return values | Description |
|---|---|---|
| deleteNote(String token, long noteId) | void | Delete a note of a task. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long noteId = 1; // A valid note id okmTask.deleteNote(null, noteId); } catch (Exception e) { e.printStackTrace(); } }}getByNode
Section titled “getByNode”Description:
| Method | Return values | Description |
|---|---|---|
| getByNode(String token, String nodeUuid) | List |
Return the list of tasks assigned to a specific node. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); String uuid = "d168924d-e801-426d-a222-00124a1461bd"; // A valid uuid for (Task task : okmTask.getByNode(null, uuid)) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}getHistory
Section titled “getHistory”Description:
| Method | Return values | Description |
|---|---|---|
| getHistory(String token, long taskId) | List |
Return the history of a specific task. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.TaskHistory;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long taskId = 1; // A valid task id for (TaskHistory taskHistory : okmTask.getHistory(null, taskId)) { System.out.println(taskHistory); } } catch (Exception e) { e.printStackTrace(); } }}getAssigned
Section titled “getAssigned”Description:
| Method | Return values | Description |
|---|---|---|
| getAssigned(String token, String subject, int progress, long projectId, long typeId, long statusId, Calendar lastModified, Calendar start, Calendar end, String orderColumn, boolean orderAsc, int offset, int limit) |
TaskList | Retrieve a list of tasks assigned to a user, filtered and paginated. |
Example:
package com.openkm;
import java.util.Calendar;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;import com.openkm.ws.rest.util.TaskList;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); String subject = "test subject"; long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id String orderColumn = "subject"; // A valid TaskManagerTask class parameter name used in HQL query boolean orderAsc = true; int offset = 0; int limit = 10; Calendar lastModified = Calendar.getInstance(); Calendar start = Calendar.getInstance(); start.add(Calendar.DATE, -30); Calendar end = Calendar.getInstance();
TaskList taskList = okmTask.getAssigned(null, subject, 10, projectId, typeId, statusId, lastModified, start, end, orderColumn, orderAsc, offset, limit); for (Task task : taskList.getTasks()) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}countAssigned
Section titled “countAssigned”Description:
| Method | Return values | Description |
|---|---|---|
| countAssigned(String token, String subject, int progress, long projectId, long typeId, long statusId, Calendar lastModified, Calendar start, Calendar end) |
long | Return the number of tasks assigned to a user. |
Example:
package com.openkm;
import java.util.Calendar;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); String subject = "test subject"; int progress = 10; long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id Calendar lastModified = Calendar.getInstance();
Calendar start = Calendar.getInstance(); start.add(Calendar.DATE, -30);
Calendar end = Calendar.getInstance();
long total = okmTask.countAssigned(null, subject, progress, projectId, typeId, statusId, lastModified, start, end); System.out.println(total); } catch (Exception e) { e.printStackTrace(); } }}getActive
Section titled “getActive”Description:
| Method | Return values | Description |
|---|---|---|
| getActive(String token, String subject, int progress, long projectId, long typeId, long statusId, Calendar lastModified, Calendar start, Calendar end, String orderColumn, boolean orderAsc, int offset, int limit) |
TaskList | Retrieve a list of active tasks assigned to a user, filtered and paginated. |
Example:
package com.openkm;
import java.util.Calendar;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;import com.openkm.ws.rest.util.TaskList;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); String subject = "test subject"; long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id String orderColumn = "progress"; // A valid TaskManagerTask class parameter name used in HQL query boolean orderAsc = true; int offset = 0; int limit = 10; Calendar lastModified = Calendar.getInstance(); Calendar start = Calendar.getInstance(); start.add(Calendar.DATE, -30); Calendar end = Calendar.getInstance();
TaskList taskList = okmTask.getActive(null, subject, 10, projectId, typeId, statusId, lastModified, start, end, orderColumn, orderAsc, offset, limit); for (Task task : taskList.getTasks()) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}countActive
Section titled “countActive”Description:
| Method | Return values | Description |
|---|---|---|
| countActive(String token, String subject, int progress, long projectId, long typeId, long statusId, Calendar lastModified, Calendar start, Calendar end) |
long | Return the number of active tasks for a user. |
Example:
package com.openkm;
import java.util.Calendar;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); String subject = "test subject"; int progress = 10; long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id Calendar lastModified = Calendar.getInstance();
Calendar start = Calendar.getInstance(); start.add(Calendar.DATE, -30);
Calendar end = Calendar.getInstance();
long total = okmTask.countActive(null, subject, progress, projectId, typeId, statusId, lastModified, start, end); System.out.println(total); } catch (Exception e) { e.printStackTrace(); } }}getFinished
Section titled “getFinished”Description:
| Method | Return values | Description |
|---|---|---|
| getFinished(String token, String subject, int progress, long projectId, long typeId, long statusId, Calendar lastModified, Calendar start, Calendar end, String orderColumn, boolean orderAsc, int offset, int limit) |
TaskList | Retrieve a list of finished tasks assigned to a user, filtered and paginated. |
Example:
package com.openkm;
import java.util.Calendar;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;import com.openkm.ws.rest.util.TaskList;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); String subject = "test subject"; long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id String orderColumn = "end"; // A valid TaskManagerTask class parameter name used in HQL query boolean orderAsc = true; int offset = 0; int limit = 10; Calendar lastModified = Calendar.getInstance(); Calendar start = Calendar.getInstance(); start.add(Calendar.DATE, -30); Calendar end = Calendar.getInstance();
TaskList taskList = okmTask.getFinished(null, subject, 10, projectId, typeId, statusId, lastModified, start, end, orderColumn, orderAsc, offset, limit); for (Task task : taskList.getTasks()) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}countFinished
Section titled “countFinished”Description:
| Method | Return values | Description |
|---|---|---|
| countFinished(String token, String subject, int progress, long projectId, long typeId, long statusId, Calendar lastModified, Calendar start, Calendar end) |
long | Return the number of finished tasks of a user. |
Example:
package com.openkm;
import java.util.Calendar;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); String subject = "test subject"; int progress = 10; long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id Calendar lastModified = Calendar.getInstance();
Calendar start = Calendar.getInstance(); start.add(Calendar.DATE, -30);
Calendar end = Calendar.getInstance();
long total = okmTask.countFinished(null, subject, progress, projectId, typeId, statusId, lastModified, start, end); System.out.println(total); } catch (Exception e) { e.printStackTrace(); } }}getAssignedCount
Section titled “getAssignedCount”Description:
| Method | Return values | Description |
|---|---|---|
| getAssignedCount(String token, long projectId, long typeId, long statusId) | long | Return the number of tasks assigned to a user. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id
long total = okmTask.getAssignedCount(null, projectId, typeId, statusId); System.out.println(total); } catch (Exception e) { e.printStackTrace(); } }}getActiveCount
Section titled “getActiveCount”Description:
| Method | Return values | Description |
|---|---|---|
| getActiveCount(String token, long projectId, long typeId, long statusId) | Long | Return the number of active tasks of a user. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id
long total = okmTask.getActiveCount(null, projectId, typeId, statusId); System.out.println(total); } catch (Exception e) { e.printStackTrace(); } }}getNotified
Section titled “getNotified”Description:
| Method | Return values | Description |
|---|---|---|
| getNotified(String token, long projectId, long typeId, long statusId, String orderColumn, boolean orderAsc, int offset, int limit) | List |
Retrieve a list of notified tasks assigned to a user, paginated. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id String orderColumn = "start"; // A valid TaskManagerTask class parameter name used in HQL query for (Task task : okmTask.getNotified(null, projectId, typeId, statusId, orderColumn, true, 0, 10)) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}getFinishedCount
Section titled “getFinishedCount”Description:
| Method | Return values | Description |
|---|---|---|
| getFinishedCount(String token, long projectId, long typeId, long statusId) | Long | Return the number of finished tasks for a user. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id
long total = okmTask.getFinishedCount(null, projectId, typeId, statusId); System.out.println(total); } catch (Exception e) { e.printStackTrace(); } }}getNotified
Section titled “getNotified”Description:
| Method | Return values | Description |
|---|---|---|
| getNotified(String token, long projectId, long typeId, long statusId, String orderColumn) | List |
Retrieve a list of tasks the user is notified about, filtered (no pagination). |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id for (Task task : okmTask.getNotified(null, projectId, typeId, statusId, "subject")) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}getNotified
Section titled “getNotified”Description:
| Method | Return values | Description |
|---|---|---|
| getNotified(String token, String subject, int progress, long projectId, long typeId, long statusId, Calendar lastModified, Calendar start, Calendar end, String orderColumn, boolean orderAsc, int offset, int limit) | TaskList | Retrieve a list of tasks the user is notified about, with full filtering and pagination. |
Example:
package com.openkm;
import java.util.Calendar;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;import com.openkm.ws.rest.util.TaskList;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); String subject = "test subject"; long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id Calendar lastModified = Calendar.getInstance(); Calendar start = Calendar.getInstance(); start.add(Calendar.DATE, -30); Calendar end = Calendar.getInstance();
TaskList taskList = okmTask.getNotified(null, subject, 10, projectId, typeId, statusId, lastModified, start, end, "subject", true, 0, 10); for (Task task : taskList.getTasks()) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}getNotified
Section titled “getNotified”Description:
| Method | Return values | Description |
|---|---|---|
| getNotified(String token, String subject, int progress, long projectId, long typeId, long statusId, Calendar lastModified, Calendar start, Calendar end, Calendar from, Calendar to, String orderColumn, boolean orderAsc, int offset, int limit) | TaskList | Retrieve a list of tasks the user is notified about, with full filtering including creation date range (from/to) and pagination. |
Example:
package com.openkm;
import java.util.Calendar;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;import com.openkm.ws.rest.util.TaskList;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); String subject = "test subject"; long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id Calendar lastModified = Calendar.getInstance(); Calendar start = Calendar.getInstance(); start.add(Calendar.DATE, -30); Calendar end = Calendar.getInstance(); Calendar from = Calendar.getInstance(); from.add(Calendar.MONTH, -1); Calendar to = Calendar.getInstance();
TaskList taskList = okmTask.getNotified(null, subject, 10, projectId, typeId, statusId, lastModified, start, end, from, to, "subject", true, 0, 10); for (Task task : taskList.getTasks()) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}countNotified
Section titled “countNotified”Description:
| Method | Return values | Description |
|---|---|---|
| countNotified(String token, long projectId, long typeId, long statusId) | long | Return the number of tasks the user is notified about, filtered by project, type and status. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id long total = okmTask.countNotified(null, projectId, typeId, statusId); System.out.println(total); } catch (Exception e) { e.printStackTrace(); } }}countNotified
Section titled “countNotified”Description:
| Method | Return values | Description |
|---|---|---|
| countNotified(String token, String subject, int progress, long projectId, long typeId, long statusId, Calendar lastModified, Calendar start, Calendar end) | long | Return the number of tasks the user is notified about, with full filtering. |
Example:
package com.openkm;
import java.util.Calendar;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); String subject = "test subject"; int progress = 10; long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id Calendar lastModified = Calendar.getInstance(); Calendar start = Calendar.getInstance(); start.add(Calendar.DATE, -30); Calendar end = Calendar.getInstance();
long total = okmTask.countNotified(null, subject, progress, projectId, typeId, statusId, lastModified, start, end); System.out.println(total); } catch (Exception e) { e.printStackTrace(); } }}getNotifiedCount
Section titled “getNotifiedCount”Description:
| Method | Return values | Description |
|---|---|---|
| getNotifiedCount(String token, long projectId, long typeId, long statusId) | long | Return the total count of notified tasks for the current user, filtered by project, type and status. |
Example:
package com.openkm;
import com.openkm.api.OKMTask;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id long total = okmTask.getNotifiedCount(null, projectId, typeId, statusId); System.out.println(total); } catch (Exception e) { e.printStackTrace(); } }}getAssigned
Section titled “getAssigned”Description:
| Method | Return values | Description |
|---|---|---|
| getAssigned(String token, String subject, int progress, long projectId, long typeId, long statusId, Calendar lastModified, Calendar start, Calendar end, Calendar from, Calendar to, String orderColumn, boolean orderAsc, int offset, int limit) | TaskList | Retrieve a list of tasks assigned to a user, with full filtering including creation date range (from/to) and pagination. |
Example:
package com.openkm;
import java.util.Calendar;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;import com.openkm.ws.rest.util.TaskList;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); String subject = "test subject"; long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id Calendar lastModified = Calendar.getInstance(); Calendar start = Calendar.getInstance(); start.add(Calendar.DATE, -30); Calendar end = Calendar.getInstance(); Calendar from = Calendar.getInstance(); from.add(Calendar.MONTH, -1); Calendar to = Calendar.getInstance();
TaskList taskList = okmTask.getAssigned(null, subject, 10, projectId, typeId, statusId, lastModified, start, end, from, to, "subject", true, 0, 10); for (Task task : taskList.getTasks()) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}getActive
Section titled “getActive”Description:
| Method | Return values | Description |
|---|---|---|
| getActive(String token, String subject, int progress, long projectId, long typeId, long statusId, Calendar lastModified, Calendar start, Calendar end, Calendar from, Calendar to, String orderColumn, boolean orderAsc, int offset, int limit) | TaskList | Retrieve a list of active tasks assigned to a user, with full filtering including creation date range (from/to) and pagination. |
Example:
package com.openkm;
import java.util.Calendar;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;import com.openkm.ws.rest.util.TaskList;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); String subject = "test subject"; long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id Calendar lastModified = Calendar.getInstance(); Calendar start = Calendar.getInstance(); start.add(Calendar.DATE, -30); Calendar end = Calendar.getInstance(); Calendar from = Calendar.getInstance(); from.add(Calendar.MONTH, -1); Calendar to = Calendar.getInstance();
TaskList taskList = okmTask.getActive(null, subject, 10, projectId, typeId, statusId, lastModified, start, end, from, to, "progress", true, 0, 10); for (Task task : taskList.getTasks()) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}getFinished
Section titled “getFinished”Description:
| Method | Return values | Description |
|---|---|---|
| getFinished(String token, String subject, int progress, long projectId, long typeId, long statusId, Calendar lastModified, Calendar start, Calendar end, Calendar from, Calendar to, String orderColumn, boolean orderAsc, int offset, int limit) | TaskList | Retrieve a list of finished tasks assigned to a user, with full filtering including creation date range (from/to) and pagination. |
Example:
package com.openkm;
import java.util.Calendar;
import com.openkm.api.OKMTask;import com.openkm.bean.Task;import com.openkm.util.ContextWrapper;import com.openkm.ws.rest.util.TaskList;
public class Test {
public static void main(String[] args) { try { OKMTask okmTask = ContextWrapper.getContext().getBean(OKMTask.class); String subject = "test subject"; long projectId = 1; // A valid project id long typeId = 1; // A valid type id long statusId = 1; // A valid status id Calendar lastModified = Calendar.getInstance(); Calendar start = Calendar.getInstance(); start.add(Calendar.DATE, -30); Calendar end = Calendar.getInstance(); Calendar from = Calendar.getInstance(); from.add(Calendar.MONTH, -1); Calendar to = Calendar.getInstance();
TaskList taskList = okmTask.getFinished(null, subject, 10, projectId, typeId, statusId, lastModified, start, end, from, to, "end", true, 0, 10); for (Task task : taskList.getTasks()) { System.out.println(task); } } catch (Exception e) { e.printStackTrace(); } }}