Task samples
Basics
Task fields description:
Field | Type | Description | Mandatory |
---|---|---|---|
Id |
Long |
Internal task id.
It is automatically set by application.
|
Not applicable. |
Owner |
String |
It contains the OpenKM userId. It is automatically set by 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 endding. |
No. |
Status |
TaskStatus |
The task status. You administering the list of status values. |
Yes. |
Project |
TaskProject |
The project related with the task. You administering the list of project values. |
Yes. |
Type |
TaskType |
The task type. You administering 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 along time is a member of a group. The group is identified by an unique repeat group id. |
No. |
ReminderStartValue |
Integer |
How many days before the task starting, the system might send a mail notification to the user. |
No. |
ReminderEndValue |
Integer |
How many days before the task ending, the system might send a mail notification to the user. |
No. |
ReminderStartUnit |
String |
Reminder start units. Allowed values:
|
Mandatory when ReminderStartValue greater than 0. |
ReminderEndUnit |
String |
Reminder end units. Allowed values:
|
Mandatory when ReminderEndValue greater than 0. |
Users |
Set<String> |
Collection of assigned users to the task. |
No. But At least should be a user or role assigned. |
Roles |
Set<String> |
Collection of assigned roles to the task. |
No. But At least should be a user or role assigned. |
Documents |
Set<String> |
List of UUID's of the related documents. |
No. |
Folders |
Set<String> |
List of UUID's of the related folders. |
No. |
Mails |
Set<String> |
List of UUID's of the related mails. |
No. |
Records |
Set<String> |
List of UUID's of the related records. |
No. |
On all methods, you'll see parameter named "token". When accessing application across SOAP the login process returns a token, what is used to identify the user on all the exposed methods. From default application execution context you must use the "null" value what indicates the application must use the "user session".
In special cases, you might be "promoted as Administrator" using the "administrator token".
String systemToken = DbSessionManager.getInstance().getSystemToken();
Methods
getAssignedTasks
Description:
Method | Return values | Description |
---|---|---|
getAssignedTasks(long projectId, long typeId, long statusId, String orderColumn, boolean orderAsc, int offset, int limit, String subject) |
List<Task> |
Retrieve a list of tasks assigned to a user, filtered and paginated. |
Filter parameters description:
The parameter "limit" and "offset" allows you to retrieve just a portion of the results of a query.
For example if your query has 1000 results, but you only want to return the first 10, you should use these values:
Now suppose you want to show the results from 11-20, you should use these values:
|
Example:
package com.openkm;
import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Task;
import com.openkm.sdk4j.bean.TaskList;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
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
String subject = "test";
TaskList taskList = ws.getAssignedTasks(projectId, typeId, statusId, orderColumn, true, 0, 10, subject);
for (Task task : taskList.getTasks()) {
System.out.println(task);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
getActiveTasks
Description:
Method | Return values | Description |
---|---|---|
getActiveTasks(long projectId, long typeId, long statusId, String orderColumn, boolean orderAsc, int offset, int limit, String subject) |
List<Task> |
Retrieve a list of active tasks assigned to a user, filtered and paginated. |
Filter parameters description:
The parameter "limit" and "offset" allows you to retrieve just a portion of the results of a query.
For example if your query has 1000 results, but you only want to return the first 10, you should use these values:
Now suppose you want to show the results from 11-20, you should use these values:
|
Example:
package com.openkm;
import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Task;
import com.openkm.sdk4j.bean.TaskList;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
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
String subject = "test";
TaskList taskList = ws.getActiveTasks(projectId, typeId, statusId, orderColumn, true, 0, 10, subject);
for (Task task : taskList.getTasks()) {
System.out.println(task);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
getFinishedTasks
Description:
Method | Return values | Description |
---|---|---|
getFinishedTasks(long projectId, long typeId, long statusId, String orderColumn, boolean orderAsc, int offset, int limit, String subject) |
List<Task> |
Retrieve a list of finished tasks assigned to a user, filtered and paginated. |
Filter parameters description:
The parameter "limit" and "offset" allows you to retrieve just a portion of the results of a query.
For example if your query has 1000 results, but you only want to return the first 10, you should use these values:
Now suppose you want to show the results from 11-20, you should use these values:
|
Example:
package com.openkm;
import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Task;
import com.openkm.sdk4j.bean.TaskList;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
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
String subject = "test";
TaskList taskList = ws.getFinishedTasks(projectId, typeId, statusId, orderColumn, true, 0, 10, subject);
for (Task task : taskList.getTasks()) {
System.out.println(task);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
getTaskStatus
Description:
Method | Return values | Description |
---|---|---|
getTaskStatus() |
List<TaskStatus> |
Retrieve a list of all the task status. |
Example:
package com.openkm;
import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.TaskStatus;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
for (TaskStatus ts : ws.getTaskStatus()) {
System.out.println(ts);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
getTaskProjects
Description:
Method | Return values | Description |
---|---|---|
getTaskProjects(boolean filterActive) |
List<TaskProject> |
Retrieve a list of all the task projects. |
Example:
package com.openkm;
import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.TaskProject;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
for (TaskProject tp : ws.getTaskProjects(true)) {
System.out.println(tp);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
getTaskTypes
Description:
Method | Return values | Description |
---|---|---|
getTaskTypes(boolean filterActive) |
List<TaskType> |
Retrieve a list of all the task types. |
Example:
package com.openkm;
import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.TaskType;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
for (TaskType tt : ws.getTaskTypes(true)) {
System.out.println(tt);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
getAssignedTasksCount
Description:
Method | Return values | Description |
---|---|---|
getAssignedTasksCount(long statusId, long projectId, long typeId) |
long |
Return the number of tasks assigned to a user. |
Filter parameters description:
|
Example:
package com.openkm;
import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
long projectId = 1; // A valid project id
long typeId = 1; // A valid type id
long statusId = 1; // A valid status id
long total = ws.getAssignedTasksCount(statusId, typeId, projectId);
System.out.println(total);
} catch (Exception e) {
e.printStackTrace();
}
}
}
getActiveTasksCount
Description:
Method | Return values | Description |
---|---|---|
getActiveTasksCount(long statusId, long projectId, long typeId) |
Long |
Return the number of active tasks to a user. |
Filter parameters description:
|
Example:
package com.openkm;
import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
long projectId = 1; // A valid project id
long typeId = 1; // A valid type id
long statusId = 1; // A valid status id
long total = ws.getActiveTasksCount(statusId, typeId, projectId);
System.out.println(total);
} catch (Exception e) {
e.printStackTrace();
}
}
}
getFinishedTasksCount
Description:
Method | Return values | Description |
---|---|---|
getFinishedTasksCount(long statusId, long projectId, long typeId) |
Long |
Return the number of finished tasks to a user. |
Filter parameters description:
|
Example:
package com.openkm;
import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
long projectId = 1; // A valid project id
long typeId = 1; // A valid type id
long statusId = 1; // A valid status id
long total = ws.getFinishedTasksCount(statusId, typeId, projectId);
System.out.println(total);
} catch (Exception e) {
e.printStackTrace();
}
}
}
createTask
Description:
Method | Return values | Description |
---|---|---|
createTask(String subject, String start, String end, String description, String statusId, String projectId, |
Task |
Create a new task. |
The repeatExpression parameters description: The commands are executed by cron when the minute, hour, and month fields match the current time, and when at least one of the two day fields (day of month, or day of week) match the current time. The scheduler examines crontab entries once every minute. The time and date fields are: * * * * * command to execute
|
Example:
package com.openkm;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Task;
import com.openkm.sdk4j.util.ISO8601;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
String subject = "task subject";
Calendar calendar = Calendar.getInstance();
String start = ISO8601.formatBasic(calendar);
calendar.add(Calendar.DATE, 15);
String end = ISO8601.formatBasic(calendar);
String description = "description test";
String statusId = "1"; // A valid task status id
String projectId = "1"; // A valid project id
String typeId = "1"; // A valid type id
List<String> users = new ArrayList<>();
users.add("okmAdmin");
users.add("sochoa");
List<String> roles = new ArrayList<>();
roles.add("ROLE_ADMIN");
roles.add("ROLE_USER");
List<String> externalUsers = new ArrayList<>();
externalUsers.add("test@openkm.com");
List<String> relatedDocuments = new ArrayList<>();
relatedDocuments.add("82555dd1-bcc2-4e64-81cb-5f7c2b0d7801");
List<String> relatedFolders = new ArrayList<>();
relatedFolders.add("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7");
List<String> relatedMails = new ArrayList<>();
List<String> relatedRecords = new ArrayList<>();
Task task = ws.createTask(subject, start, end, description, statusId, projectId, typeId, users, roles, externalUsers,
relatedDocuments, relatedFolders, relatedRecords, relatedMails, "0 0 1 * *", "", "", 0, "", 0, "", 0);
System.out.println(task);
} catch (Exception e) {
e.printStackTrace();
}
}
}
updateTask
Description:
Method | Return values | Description |
---|---|---|
updateTask(String taskId, String subject, String start, String end, String description, String statusId, |
Task |
Update a task. |
The repeatExpression parameters description: The commands are executed by cron when the minute, hour, and month fields match the current time, and when at least one of the two day fields (day of month, or day of week) match the current time. The scheduler examines crontab entries once every minute. The time and date fields are: * * * * * command to execute
|
Example:
package com.openkm;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Task;
import com.openkm.sdk4j.util.ISO8601;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
String taskId = "2";
String subject = "task update";
Calendar calendar = Calendar.getInstance();
String start = ISO8601.formatBasic(calendar);
calendar.add(Calendar.DATE, 15);
String end = ISO8601.formatBasic(calendar);
String description = "test update";
String statusId = "1"; // A valid task status id
String projectId = "1"; // A valid project id
String typeId = "1"; // A valid type id
List<String> users = new ArrayList<>();
users.add("test");
List<String> roles = new ArrayList<>();
roles.add("ROLE_ADMIN");
roles.add("ROLE_USER");
List<String> externalUsers = new ArrayList<>();
externalUsers.add("test@openkm.com");
List<String> relatedDocuments = new ArrayList<>();
relatedDocuments.add("82555dd1-bcc2-4e64-81cb-5f7c2b0d7801");
List<String> relatedFolders = new ArrayList<>();
relatedFolders.add("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7");
List<String> relatedMails = new ArrayList<>();
List<String> relatedRecords = new ArrayList<>();
String owner = "okmAdmin";
int progress = 20; // Progress task
Task task = ws.updateTask(taskId, subject, start, end, description, statusId, projectId, typeId, users, roles, externalUsers,
relatedDocuments, relatedFolders, relatedRecords, relatedMails, owner, "0 0 1 * *", "", "", progress, 0, "", 0, "", 0);
System.out.println(task);
} catch (Exception e) {
e.printStackTrace();
}
}
}
getTask
Description:
Method | Return values | Description |
---|---|---|
getTask(long taskId) |
Task |
Retrieve a task. |
Example:
package com.openkm;
import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Task;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
long taskId = 2;
Task task = ws.getTask(taskId);
System.out.println(task);
} catch (Exception e) {
e.printStackTrace();
}
}
}
delete
Description:
Method | Return values | Description |
---|---|---|
delete(String token, Task task) |
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
Description:
Method | Return values | Description |
---|---|---|
getByProject(String token, long projectId) |
List<Task> |
Retrieve a list of task related with 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
Description:
Method | Return values | Description |
---|---|---|
getByType(String token, long typeId) |
List<Task> |
Retrieve a list of task related with 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();
}
}
}
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
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
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
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
Description:
Method | Return values | Description |
---|---|---|
getStatuses(String token) |
List<TaskStatus> |
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
Description:
Method | Return values | Description |
---|---|---|
getProjects(String token, boolean filterByActive) |
List<TaskProject> |
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
Description:
Method | Return values | Description |
---|---|---|
getTypes(String token, boolean filterByActive) |
List<TaskType> |
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
Description:
Method | Return values | Description |
---|---|---|
getNotes(String token, long taskId) |
List<TaskNote> |
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
Description:
Method | Return values | Description |
---|---|---|
createStatus(String token, String name, boolean finish) |
TaskStatus |
Create a new task status. |
Depending your logic, several status can be ending status. For example status named "closed" or "cancelled". The boolean parameter "finish" indicates if your status in an "ending 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
Description:
Method | Return values | Description |
---|---|---|
createProject(String token, String name, String description, boolean active) |
TaskProject |
Create a new task project. |
The boolean parameter "active", indicates if your project is active or not. |
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
Description:
Method | Return values | Description |
---|---|---|
createType(String token, String name, String description, boolean active) |
TaskType |
Create a new task type. |
The boolean parameter "active", indicates if your type is active or not. |
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
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
Description:
Method | Return values | Description |
---|---|---|
updateStatus(String token, long id, String name, boolean finish) |
TaskStatus |
Update a task status. |
Depending your logic, several status can be ending status. For example status named "closed" or "cancelled". The boolean parameter "finish" indicates if your status in an "ending 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
Description:
Method | Return values | Description |
---|---|---|
updateProject(String token, long id, String name, String description, boolean active) |
TaskProject |
Update a task project. |
The boolean parameter "active", indicates if your project is active or not. |
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
Description:
Method | Return values | Description |
---|---|---|
updateType(String token, long id, String name, String description, boolean active) |
TaskType |
Update a task type. |
The boolean parameter "active", indicates if your type is active or not. |
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
Description:
Method | Return values | Description |
---|---|---|
updateNote(String token, long id, String text) |
TaskNote |
Update 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
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
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
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
Description:
Method | Return values | Description |
---|---|---|
deleteNote(String token, long noteId) |
void |
Delete 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
Description:
Method | Return values | Description |
---|---|---|
getByNode(String token, String nodeUuid) |
List<Task> |
Return the list of tasks assigned to an 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();
}
}
}
ddd