Skip to content

OKMWorkflow

In all methods you’ll see a parameter named “token”. Because the Cron tasks are executed in the background without authentication, the methods used in this scenario might use the token parameter. In the default application execution context you must use the “null” value, which indicates that the application must use the “user session”.

Description:

Method Return values Description
registerProcessDefinition(String token, InputStream is) void Registers a new workflow.

Example:

package com.openkm;
import java.io.FileInputStream;
import java.io.InputStream;
import com.openkm.util.ContextWrapper;
import org.apache.commons.io.IOUtils;
import com.openkm.api.OKMWorkflow;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
InputStream is = new FileInputStream("/opt/files/Purchase.par");
okmWorkflow.registerProcessDefinition(null, is);
IOUtils.closeQuietly(is);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
deleteProcessDefinition(String token, long processDefinitionId) void Deletes a workflow.
  • The parameter processDefinitionId value is a valid workflow process definition ID**.**

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long pdId = 5; // Valid workflow process definition
okmWorkflow.deleteProcessDefinition(null, pdId);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getProcessDefinitionImage(String token, long processDefinitionId, String node) byte[] Returns an image of a workflow process definition.
  • The parameter processDefinitionId value is a valid workflow process definition ID.
  • The parameter node is a node that has a workflow in execution.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.util.ContextWrapper;
import org.apache.commons.io.IOUtils;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long pdId = 5; // Valid workflow process definition
byte[] img = okmWorkflow.getProcessDefinitionImage(null, pdId, "/okm:root/sample.pdf");
ByteArrayInputStream in = new ByteArrayInputStream(img);
FileOutputStream out = new FileOutputStream(new File("/home/test/img.jpg"));
IOUtils.copy(in, out);
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(out);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getProcessDefinitionForms(String token, long processDefinitionId) Map<String, List> Returns a map of all workflow form definitions.
  • The parameter processDefinitionId value is a valid workflow process definition ID.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.form.FormElement;
import com.openkm.util.ContextWrapper;
import java.util.List;
import java.util.Map;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long pdId = 5; // Valid workflow process definition
Map<String, List<FormElement>> map = okmWorkflow.getProcessDefinitionForms(null, pdId);
for (String key : map.keySet()) {
System.out.println("group:" + key);
for (FormElement fe : map.get(key)) {
System.out.println(fe);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getProcessDefinition(String token, long processDefinitionId) ProcessDefinition Returns a workflow process definition.
  • The parameter processDefinitionId value is a valid workflow process definition ID.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.workflow.ProcessDefinition;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long pdId = 5; // Valid workflow process definition
ProcessDefinition pd = okmWorkflow.getProcessDefinition(null, pdId);
System.out.println(pd);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
runProcessDefinition(String token, long processDefinitionId, String uuid, List variables) ProcessInstance Executes a workflow on a node.
  • The parameter processDefinitionId value is a valid workflow process definition.
  • The parameter uuid can be any document, mail, folder or record UUID.
  • The parameter values are form element values needed to start the workflow (not all workflows need form values to start).

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.form.FormElement;
import com.openkm.bean.form.Input;
import com.openkm.bean.form.TextArea;
import com.openkm.util.ContextWrapper;
import java.util.ArrayList;
import java.util.List;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long pdId = 8041; // Some valid workflow process definition id
List<FormElement> feList = new ArrayList<>(); // Case as part of starting workflow are required form parameter
Input price = new Input();
price.setName("price");
price.setValue("1000");
feList.add(price);
TextArea textArea = new TextArea();
textArea.setName("description");
textArea.setValue("some description here");
feList.add(textArea);
okmWorkflow.runProcessDefinition(null, pdId, "f86cc22d-9b50-434f-a940-b04cea9c0048", feList);
} catch (Exception e) {
e.printStackTrace();
}
}
}

runProcessDefinition (without node association)

Section titled “runProcessDefinition (without node association)”

Description:

Method Return values Description
runProcessDefinition(String token, long processDefinitionId, List variables) ProcessInstance Executes a workflow without associating it to a specific node.
  • The parameter processDefinitionId value is a valid workflow process definition.
  • The parameter values are form element values needed to start the workflow (not all workflows need form values to start).

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.form.FormElement;
import com.openkm.bean.form.Input;
import com.openkm.bean.form.TextArea;
import com.openkm.bean.workflow.ProcessInstance;
import com.openkm.util.ContextWrapper;
import java.util.ArrayList;
import java.util.List;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long pdId = 8041; // Some valid workflow process definition id
List<FormElement> feList = new ArrayList<>(); // Case where form parameters are required to start workflow
Input priority = new Input();
priority.setName("priority");
priority.setValue("high");
feList.add(priority);
TextArea comments = new TextArea();
comments.setName("comments");
comments.setValue("This is a standalone workflow process");
feList.add(comments);
ProcessInstance pi = okmWorkflow.runProcessDefinition(null, pdId, feList);
System.out.println("Process instance created: " + pi);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
sendProcessInstanceSignal(String token, long processInstanceId, String transitionName) ProcessInstance Sends a signal to a process instance.
  • The parameter processInstanceId value is a valid workflow process instance ID.
  • The parameter transitionName is the chosen transition.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long pId = 1046; // Some valid process instance id
okmWorkflow.sendProcessInstanceSignal(null, pId, "jump2");
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
endProcessInstance(String token, long processInstanceId) void Ends a process instance.
  • The parameter processInstanceId value is a valid workflow process instance.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long pId = 1046; // Some valid process instance id
okmWorkflow.endProcessInstance(null, pId);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
deleteProcessInstance(String token, long processInstanceId) void Deletes a process instance.
  • The parameter processInstanceId value is a valid workflow process instance.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long pId = 1046; // Some valid process instance id
okmWorkflow.deleteProcessInstance(null, pId);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
findProcessInstances(String token, long processDefinitionId) List Retrieves a list of all process instances for some registered workflow definitions.
  • The parameter processDefinitionId value is a valid workflow process definition.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.workflow.ProcessDefinition;
import com.openkm.bean.workflow.ProcessInstance;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
// Get all workflow definitions
for (ProcessDefinition pd : okmWorkflow.findAllProcessDefinitions(null)) {
System.out.println("WF definition: " + pd);
// Get all process of some workflow definition
for (ProcessInstance pi : okmWorkflow.findProcessInstances(null, pd.getId())) {
System.out.println("PI: " + pi);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
searchAssignedTasks(String token, LocalDate start, LocalDate end, String status, Long procDefId, String taskName, Integer offset, Integer limit) ProcessInstanceResultSet Searches for workflow task instances assigned to the current user.
  • The parameter start is the lower bound of the date range filter (may be null).
  • The parameter end is the upper bound of the date range filter (may be null).
  • The parameter status filters by task status (may be null).
  • The parameter procDefId filters by process definition ID (may be null).
  • The parameter taskName filters by task name (may be null).
  • The parameter offset is used to skip that many results before returning results.
  • The parameter limit limits the number of results returned.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.workflow.ProcessInstanceResultSet;
import com.openkm.util.ContextWrapper;
import java.time.LocalDate;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
ProcessInstanceResultSet result = okmWorkflow.searchAssignedTasks(null, null, null, null, null, null, 0, 10);
System.out.println("Total: " + result.getTotal());
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
searchPooledTasks(String token, LocalDate start, LocalDate end, String status, Long procDefId, String taskName, Integer offset, Integer limit) ProcessInstanceResultSet Searches for pooled workflow task instances available for the current user.
  • The parameter start is the lower bound of the date range filter (may be null).
  • The parameter end is the upper bound of the date range filter (may be null).
  • The parameter status filters by task status (may be null).
  • The parameter procDefId filters by process definition ID (may be null).
  • The parameter taskName filters by task name (may be null).
  • The parameter offset is used to skip that many results before returning results.
  • The parameter limit limits the number of results returned.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.workflow.ProcessInstanceResultSet;
import com.openkm.util.ContextWrapper;
import java.time.LocalDate;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
ProcessInstanceResultSet result = okmWorkflow.searchPooledTasks(null, null, null, null, null, null, 0, 10);
System.out.println("Total: " + result.getTotal());
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
searchStartedByMe(String token, LocalDate start, LocalDate end, String status, Long procDefId, String taskName, Integer offset, Integer limit) ProcessInstanceResultSet Searches for workflow process instances started by the current user.
  • The parameter start is the lower bound of the date range filter (may be null).
  • The parameter end is the upper bound of the date range filter (may be null).
  • The parameter status filters by task status (may be null).
  • The parameter procDefId filters by process definition ID (may be null).
  • The parameter taskName filters by task name (may be null).
  • The parameter offset is used to skip that many results before returning results.
  • The parameter limit limits the number of results returned.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.workflow.ProcessInstanceResultSet;
import com.openkm.util.ContextWrapper;
import java.time.LocalDate;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
ProcessInstanceResultSet result = okmWorkflow.searchStartedByMe(null, null, null, null, null, null, 0, 10);
System.out.println("Total: " + result.getTotal());
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
searchOverview(String token, LocalDate start, LocalDate end, String status, Long procDefId, String taskName, String initiator, String taskUser, Integer offset, Integer limit) ProcessInstanceResultSet Searches for workflow process instances with a full set of filters (administrative overview).
  • The parameter start is the lower bound of the date range filter (may be null).
  • The parameter end is the upper bound of the date range filter (may be null).
  • The parameter status filters by task status (may be null).
  • The parameter procDefId filters by process definition ID (may be null).
  • The parameter taskName filters by task name (may be null).
  • The parameter initiator filters by the user who started the process (may be null).
  • The parameter taskUser filters by the user assigned to the task (may be null).
  • The parameter offset is used to skip that many results before returning results.
  • The parameter limit limits the number of results returned.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.workflow.ProcessInstanceResultSet;
import com.openkm.util.ContextWrapper;
import java.time.LocalDate;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
ProcessInstanceResultSet result = okmWorkflow.searchOverview(null, null, null, null, null, null, null, null, 0, 10);
System.out.println("Total: " + result.getTotal());
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
findAllProcessDefinitions(String token) List Retrieves a list of all registered workflow definitions.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.workflow.ProcessDefinition;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
// Get all workflow definitions
for (ProcessDefinition pd : okmWorkflow.findAllProcessDefinitions(null)) {
System.out.println("WF definition: " + pd);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
findLatestProcessDefinitions(String token) List Retrieves a list of the latest workflow definitions.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.workflow.ProcessDefinition;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
// Get all workflow definitions
for (ProcessDefinition pd : okmWorkflow.findLatestProcessDefinitions(null)) {
System.out.println("WF definition: " + pd);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
findLastProcessDefinition(String token, String name) ProcessDefinition Retrieves the last workflow definition of a specific workflow.
  • The parameter name identifies a specific workflow definition group.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.workflow.ProcessDefinition;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
ProcessDefinition pd = okmWorkflow.findLastProcessDefinition(null, "purchase");
System.out.println("WF definition: " + pd);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getProcessInstance(String token, long processInstanceId) ProcessInstance Returns the process instance.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.workflow.ProcessInstance;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long piId = 8108; // Some valid process instance id
ProcessInstance pi = okmWorkflow.getProcessInstance(null, piId);
System.out.println("PI: " + pi);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
suspendProcessInstance(String token, long processInstanceId) void Suspends the process instance.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long piId = 8108; // Some valid process instance id
okmWorkflow.suspendProcessInstance(null, piId);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
resumeProcessInstance(String token, long processInstanceId) void Resumes the process instance.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long piId = 8108; // Some valid process instance id
okmWorkflow.resumeProcessInstance(null, piId);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
findUserTaskInstances(String token, int offset, int limit) TaskInstanceResultSet Retrieves a list of task instances assigned to the user.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.workflow.TaskInstance;
import com.openkm.bean.workflow.TaskInstanceResultSet;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
TaskInstanceResultSet resultSet = okmWorkflow.findUserTaskInstances(null, 0, 10);
System.out.println("Total: " + resultSet.getTotal());
// Get all user task intances
for (TaskInstance ti : resultSet.getResults()) {
System.out.println(ti);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
findPooledTaskInstances(String token, int offset, int limit) TaskInstanceResultSet Retrieves a list of pooled task instances assigned to the user.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.workflow.TaskInstance;
import com.openkm.bean.workflow.TaskInstanceResultSet;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
TaskInstanceResultSet resultSet = okmWorkflow.findPooledTaskInstances(null, 0, 10);
System.out.println("Total: " + resultSet.getTotal());
// Get all user task intances
for (TaskInstance ti : resultSet.getResults()) {
System.out.println(ti);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
findTaskInstances(String token, long processInstanceId) List Retrieves a list of task instances for a process instance.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.workflow.TaskInstance;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
// Get all user task intances
long piId = 8108; // Some valid process instance id
for (TaskInstance ti : okmWorkflow.findTaskInstances(null, piId)) {
System.out.println(ti);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
setTaskInstanceValues(String token, long taskInstanceId, String transitionName, List values) void Sets a task instance’s values.
  • The parameter taskInstanceId is a valid task instance ID.
  • The parameter transitionName is the chosen transition.
  • The parameter values are form element values needed to start the workflow (not all workflow tasks need form values).

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.form.FormElement;
import com.openkm.util.ContextWrapper;
import java.util.ArrayList;
import java.util.List;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long tiId = 8110; // Some valid task instance id
List<FormElement> feList = new ArrayList<>();
okmWorkflow.setTaskInstanceValues(null, tiId, "approve", feList);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getTaskInstance(String token, long taskInstanceId) TaskInstance Returns a task instance.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.workflow.TaskInstance;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long tiId = 8110; // Some valid task instance id
TaskInstance ti = okmWorkflow.getTaskInstance(null, tiId);
System.out.println(ti);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
setTaskInstanceActorId(String token, long taskInstanceId, String actorId) void Sets the actor for a task instance.
  • The parameter taskInstanceId is a valid task instance ID.
  • The parameter actorId must be a valid OpenKM user ID.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long tiId = 8110; // Some valid task instance id
okmWorkflow.setTaskInstanceActorId(null, tiId, "okmAdmin");
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
unsetTaskInstanceActor(String token, long taskInstanceId) void Removes the actor assignment from a task instance, returning it to the pool.
  • The parameter taskInstanceId is a valid task instance ID.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long tiId = 8110; // Some valid task instance id
okmWorkflow.unsetTaskInstanceActor(null, tiId);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
startTaskInstance(String token, long taskInstanceId) void Starts a task instance.
  • The parameter taskInstanceId is a valid task instance ID.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long tiId = 8110; // Some valid task instance id
okmWorkflow.startTaskInstance(null, tiId);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
endTaskInstance(String token, long taskInstanceId, String transitionName) void Ends a task instance.
  • The parameter taskInstanceId is a valid task instance ID.
  • The parameter transitionName is a transaction name.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
long tiId = 8110; // Some valid task instance id
okmWorkflow.endTaskInstance(null, tiId, "end");
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getSuggestBoxKeyValuesFiltered(String token, String nodeId, long processDefinitionId, String taskName, String propertyName, String filter) List Returns a filtered list of key-value pairs for a workflow suggest box form field.
  • The parameter nodeId is the UUID of the associated document, folder, mail, or record node (may be null).
  • The parameter processDefinitionId is a valid workflow process definition ID.
  • The parameter taskName is the name of the workflow task that contains the suggest box.
  • The parameter propertyName is the name of the suggest box form property.
  • The parameter filter is a string used to filter the returned values.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.KeyValue;
import com.openkm.util.ContextWrapper;
import java.util.List;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
List<KeyValue> values = okmWorkflow.getSuggestBoxKeyValuesFiltered(null, null, 5L, "review", "assignee", "adm");
for (KeyValue kv : values) {
System.out.println(kv.getKey() + " = " + kv.getValue());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getSuggestBoxKeyValue(String token, String nodeId, long processDefinitionId, String taskName, String propertyName, String key) KeyValue Returns the key-value pair for a specific key in a workflow suggest box form field.
  • The parameter nodeId is the UUID of the associated document, folder, mail, or record node (may be null).
  • The parameter processDefinitionId is a valid workflow process definition ID.
  • The parameter taskName is the name of the workflow task that contains the suggest box.
  • The parameter propertyName is the name of the suggest box form property.
  • The parameter key is the specific key to retrieve.

Example:

package com.openkm;
import com.openkm.api.OKMWorkflow;
import com.openkm.bean.KeyValue;
import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) {
try {
OKMWorkflow okmWorkflow = ContextWrapper.getContext().getBean(OKMWorkflow.class);
KeyValue kv = okmWorkflow.getSuggestBoxKeyValue(null, null, 5L, "review", "assignee", "okmAdmin");
System.out.println(kv.getKey() + " = " + kv.getValue());
} catch (Exception e) {
e.printStackTrace();
}
}
}