WorkflowBeans
Data transfer objects (DTOs) for workflow operations including actors, process definitions, process instances, and task instances.
Classes for context variables
Actor
Description:
| Property | Type | Description |
|---|---|---|
|
id |
String |
The unique identifier of the actor. |
|
name |
String |
The display name of the actor. |
|
|
String |
The email address of the actor. |
|
roles |
List<String> |
The list of roles assigned to the actor. |
Example:
import com.openkm.okmflow.bean.Actor;
import java.util.Arrays;
try {
Actor actor = new Actor();
actor.setId("user123");
actor.setName("John Doe");
actor.setEmail("john.doe@example.com");
actor.setRoles(Arrays.asList("ROLE_USER", "ROLE_APPROVER"));
System.out.println("Actor: " + actor.getName());
System.out.println("Email: " + actor.getEmail());
} catch (Exception e) {
e.printStackTrace();
}
ProcessDefinition
Description:
| Property | Type | Description |
|---|---|---|
|
id |
Long |
The unique identifier of the process definition. |
|
name |
String |
The name of the process definition. |
|
version |
Integer |
The version number of the process definition. |
Example:
import com.openkm.okmflow.bean.ProcessDefinition;
try {
ProcessDefinition processDef = new ProcessDefinition();
processDef.setId(456L);
processDef.setName("DocumentApproval");
processDef.setVersion(2);
System.out.println("Process: " + processDef.getName());
System.out.println("Version: " + processDef.getVersion());
} catch (Exception e) {
e.printStackTrace();
}
ProcessInstance
Description:
| Property | Type | Description |
|---|---|---|
|
id |
Long |
The unique identifier of the process instance. |
Example:
import com.openkm.okmflow.bean.ProcessInstance;
try {
ProcessInstance processInstance = new ProcessInstance();
processInstance.setId(789L);
System.out.println("Process Instance ID: " + processInstance.getId());
} catch (Exception e) {
e.printStackTrace();
}
TaskInstance
Description:
| Property | Type | Description |
|---|---|---|
|
id |
Long |
The unique identifier of the task instance. |
Example:
import com.openkm.okmflow.bean.TaskInstance;
try {
TaskInstance taskInstance = new TaskInstance();
taskInstance.setId(101L);
System.out.println("Task Instance ID: " + taskInstance.getId());
} catch (Exception e) {
e.printStackTrace();
}
Classes from WorkflowUtils methods
ProcessDefinitionDTO
Description:
| Property | Type | Description |
|---|---|---|
|
id |
Long |
The unique identifier of the process definition. |
|
name |
String |
The name of the process definition. |
|
locked |
Boolean |
Whether the process definition is locked for editing. |
|
version |
Integer |
The version number of the process definition. |
|
nodes |
List<NodeDTO> |
The list of workflow nodes in the process definition. |
Example:
import com.openkm.okmflow.rest.dto.ProcessDefinitionDTO;
import com.openkm.okmflow.util.WorkflowUtils;
try {
ProcessDefinitionDTO processDef = WorkflowUtils.getProcessDefinitionByName("DocumentApproval");
System.out.println("Process ID: " + processDef.getId());
System.out.println("Process Name: " + processDef.getName());
System.out.println("Version: " + processDef.getVersion());
System.out.println("Locked: " + processDef.getLocked());
} catch (Exception e) {
e.printStackTrace();
}
ProcessInstanceDTO
Description:
| Property | Type | Description |
|---|---|---|
|
id |
Long |
The unique identifier of the process instance. |
|
lastActivity |
LocalDateTime |
The timestamp of the last activity in the process instance. |
|
currentNode |
NodeDTO |
The current node where the process instance is waiting. |
|
procDefName |
String |
The name of the process definition. |
|
status |
String |
The current status of the process instance. |
|
formVariables |
Map<String, FormElementComplex> |
The form variables associated with the process instance. |
|
miscVariables |
Map<String, Object> |
Miscellaneous variables stored in the process instance. |
Example:
import com.openkm.okmflow.rest.dto.ProcessInstanceDTO;
import com.openkm.okmflow.util.WorkflowUtils;
try {
Long processId = 123L;
ProcessInstanceDTO processInstance = WorkflowUtils.getProcessInstance(processId);
System.out.println("Process Instance ID: " + processInstance.getId());
System.out.println("Status: " + processInstance.getStatus());
System.out.println("Process Name: " + processInstance.getProcDefName());
System.out.println("Current Node: " + processInstance.getCurrentNode().getName());
} catch (Exception e) {
e.printStackTrace();
}
TaskInstanceDTO
Description:
| Property | Type | Description |
|---|---|---|
|
id |
Long |
The unique identifier of the task instance. |
|
name |
String |
The name of the task. |
|
status |
String |
The current status of the task instance. |
|
actor |
String |
The actor assigned to this task instance. |
|
pooledActors |
Set<String> |
The set of pooled actors who can claim this task. |
|
start |
LocalDateTime |
The timestamp when the task instance started. |
|
end |
LocalDateTime |
The timestamp when the task instance ended. |
|
form |
String |
The form associated with this task. |
Example:
import com.openkm.okmflow.rest.dto.TaskInstanceDTO;
import com.openkm.okmflow.util.WorkflowUtils;
try {
Long processId = 123L;
TaskInstanceDTO taskInstance = WorkflowUtils.getCurrentTaskInstance(processId);
if (taskInstance != null) {
System.out.println("Task ID: " + taskInstance.getId());
System.out.println("Task Name: " + taskInstance.getName());
System.out.println("Status: " + taskInstance.getStatus());
System.out.println("Assigned Actor: " + taskInstance.getActor());
System.out.println("Form: " + taskInstance.getForm());
}
} catch (Exception e) {
e.printStackTrace();
}