added some key task-form API endpoints

This commit is contained in:
Brian Long 2023-06-01 10:24:40 -04:00
parent 117e946460
commit 24ad70c25c
6 changed files with 470 additions and 22 deletions

View File

@ -27,6 +27,9 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import com.inteligr8.alfresco.activiti.model.AssigneeIdentifier;
import com.inteligr8.alfresco.activiti.model.CompleteForm;
import com.inteligr8.alfresco.activiti.model.FormDefinition;
import com.inteligr8.alfresco.activiti.model.FormValue;
import com.inteligr8.alfresco.activiti.model.ResultListDataRepresentation;
import com.inteligr8.alfresco.activiti.model.Task;
import com.inteligr8.alfresco.activiti.model.TaskFilterRepresentation;
@ -35,110 +38,130 @@ import com.inteligr8.alfresco.activiti.model.TaskUpdate;
import com.inteligr8.alfresco.activiti.model.UserIdentifier;
import com.inteligr8.alfresco.activiti.model.Variable;
@Path("/api/enterprise/tasks")
@Path("/api/enterprise")
public interface TasksApi {
@GET
@Path("{taskId}")
@Path("tasks/{taskId}")
@Produces({ "application/json" })
Task get(@PathParam("taskId") String taskId);
@GET
@Path("task-forms/{taskId}")
@Produces({ "application/json" })
FormDefinition getForm(@PathParam("taskId") String taskId);
@GET
@Path("task-forms/{taskId}/form-values/{field}")
@Produces({ "application/json" })
FormValue getFormValue(@PathParam("taskId") String taskId, @PathParam("field") String field);
@GET
@Path("task-forms/{taskId}/form-values/{field}/{column}")
@Produces({ "application/json" })
FormValue getFormValue(@PathParam("taskId") String taskId, @PathParam("field") String field, @PathParam("column") String column);
@PUT
@Path("{taskId}")
@Path("tasks/{taskId}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
Task update(@PathParam("taskId") String taskId, TaskUpdate taskUpdate);
@DELETE
@Path("{taskId}")
@Path("tasks/{taskId}")
@Produces({ "application/json" })
void delete(@PathParam("taskId") String taskId);
@POST
@Path("query")
@Path("tasks/query")
@Consumes({ "application/json" })
@Produces({ "application/json" })
ResultListDataRepresentation<Task> query(TaskQueryRepresentation request);
@POST
@Path("filter")
@Path("tasks/filter")
@Consumes({ "application/json" })
@Produces({ "application/json" })
ResultListDataRepresentation<Task> filter(TaskFilterRepresentation request);
@PUT
@Path("{taskId}/action/assign")
@Path("tasks/{taskId}/action/assign")
@Consumes({ "application/json" })
@Produces({ "application/json" })
Task assign(@PathParam("taskId") String taskId, AssigneeIdentifier request);
@PUT
@Path("{taskId}/action/claim")
@Path("tasks/{taskId}/action/claim")
void claim(@PathParam("taskId") String taskId);
@PUT
@Path("{taskId}/action/complete")
@Path("tasks/{taskId}/action/complete")
void complete(@PathParam("taskId") String taskId);
@POST
@Path("task-forms/{taskId}")
@Consumes({ "application/json" })
void complete(@PathParam("taskId") String taskId, CompleteForm request);
@PUT
@Path("{taskId}/action/delegate")
@Path("tasks/{taskId}/action/delegate")
@Consumes({ "application/json" })
void delegate(@PathParam("taskId") String taskId, UserIdentifier request);
@PUT
@Path("{taskId}/action/involve")
@Path("tasks/{taskId}/action/involve")
@Consumes({ "application/json" })
void involve(@PathParam("taskId") String taskId, UserIdentifier request);
@POST
@Path("{taskId}/groups/{groupId}")
@Path("tasks/{taskId}/groups/{groupId}")
void involveGroup(@PathParam("taskId") String taskId, @PathParam("groupId") String groupId);
@DELETE
@Path("{taskId}/groups/{groupId}")
@Path("tasks/{taskId}/groups/{groupId}")
void removeInvolvedGroup(@PathParam("taskId") String taskId, @PathParam("groupId") String groupId);
@PUT
@Path("{taskId}/action/remove-involved")
@Path("tasks/{taskId}/action/remove-involved")
@Consumes({ "application/json" })
void removeInvolved(@PathParam("taskId") String taskId, UserIdentifier request);
@PUT
@Path("{taskId}/action/resolve")
@Path("tasks/{taskId}/action/resolve")
void resolve(@PathParam("taskId") String taskId);
@PUT
@Path("{taskId}/action/unclaim")
@Path("tasks/{taskId}/action/unclaim")
void unclaim(@PathParam("taskId") String taskId);
@GET
@Path("{taskId}/variables")
@Path("tasks/{taskId}/variables")
@Produces({ "application/json" })
List<Variable> getVariables(@PathParam("taskId") String taskId, @QueryParam("scope") String scope);
@POST
@Path("{taskId}/variables")
@Path("tasks/{taskId}/variables")
@Consumes({ "application/json" })
@Produces({ "application/json" })
List<Variable> setVariables(@PathParam("taskId") String taskId, List<Variable> variables);
@DELETE
@Path("{taskId}/variables")
@Path("tasks/{taskId}/variables")
List<Variable> removeVariables(@PathParam("taskId") String taskId);
@GET
@Path("{taskId}/variables/{variableName}")
@Path("tasks/{taskId}/variables/{variableName}")
@Produces({ "application/json" })
Variable getVariable(@PathParam("taskId") String taskId, @PathParam("variableName") String variableName, @QueryParam("scope") String scope);
@PUT
@Path("{taskId}/variables/{variableName}")
@Path("tasks/{taskId}/variables/{variableName}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
Variable setVariable(@PathParam("taskId") String taskId, @PathParam("variableName") String variableName, Variable variable);
@DELETE
@Path("{taskId}/variables/{variableName}")
@Path("tasks/{taskId}/variables/{variableName}")
void removeVariable(@PathParam("taskId") String taskId, @PathParam("variableName") String variableName, @QueryParam("scope") String scope);
}

View File

@ -0,0 +1,39 @@
package com.inteligr8.alfresco.activiti.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"outcome"
})
public class CompleteForm {
@JsonProperty("outcome")
private String outcome;
/**
* No args constructor for use in serialization
*/
public CompleteForm() {
}
public CompleteForm(String outcome) {
this.outcome = outcome;
}
public String getOutcome() {
return outcome;
}
public void setOutcome(String outcome) {
this.outcome = outcome;
}
public CompleteForm withOutcome(String outcome) {
this.outcome = outcome;
return this;
}
}

View File

@ -0,0 +1,201 @@
package com.inteligr8.alfresco.activiti.model;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.inteligr8.activiti.model.Datum;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class FormDefinition extends Datum {
@JsonProperty("className")
private String className;
@JsonProperty("id")
private String id;
@JsonProperty("name")
private String name;
@JsonProperty("processDefinitionId")
private String processDefinitionId;
@JsonProperty("processDefinitionKey")
private String processDefinitionKey;
@JsonProperty("processDefinitionName")
private String processDefinitionName;
@JsonProperty("outcomes")
private List<FormOutcome> outcomes = new ArrayList<>();
@JsonProperty("selectedOutcome")
private String selectedOutcome;
@JsonProperty("taskDefinitionKey")
private String taskDefinitionKey;
@JsonProperty("taskId")
private String taskId;
@JsonProperty("taskName")
private String taskName;
@JsonProperty("variables")
private List<FormVariable> variables = new ArrayList<>();
/**
* No args constructor for use in serialization
*/
public FormDefinition() {
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public FormDefinition withClassName(String className) {
this.className = className;
return this;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public FormDefinition withId(String id) {
this.id = id;
return this;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public FormDefinition withName(String name) {
this.name = name;
return this;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
public FormDefinition withProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
return this;
}
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public void setProcessDefinitionKey(String processDefinitionKey) {
this.processDefinitionKey = processDefinitionKey;
}
public FormDefinition withProcessDefinitionKey(String processDefinitionKey) {
this.processDefinitionKey = processDefinitionKey;
return this;
}
public String getProcessDefinitionName() {
return processDefinitionName;
}
public void setProcessDefinitionName(String processDefinitionName) {
this.processDefinitionName = processDefinitionName;
}
public FormDefinition withProcessDefinitionName(String processDefinitionName) {
this.processDefinitionName = processDefinitionName;
return this;
}
public List<FormOutcome> getOutcomes() {
return outcomes;
}
public void setOutcomes(List<FormOutcome> outcomes) {
this.outcomes = outcomes;
}
public FormDefinition withOutcomes(List<FormOutcome> outcomes) {
this.outcomes = outcomes;
return this;
}
public String getSelectedOutcome() {
return selectedOutcome;
}
public void setSelectedOutcome(String selectedOutcome) {
this.selectedOutcome = selectedOutcome;
}
public FormDefinition withSelectedOutcome(String selectedOutcome) {
this.selectedOutcome = selectedOutcome;
return this;
}
public String getTaskDefinitionKey() {
return taskDefinitionKey;
}
public void setTaskDefinitionKey(String taskDefinitionKey) {
this.taskDefinitionKey = taskDefinitionKey;
}
public FormDefinition withTaskDefinitionKey(String taskDefinitionKey) {
this.taskDefinitionKey = taskDefinitionKey;
return this;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public FormDefinition withTaskId(String taskId) {
this.taskId = taskId;
return this;
}
public String getTaskName() {
return taskName;
}
public void setTaskName(String taskName) {
this.taskName = taskName;
}
public FormDefinition withTaskName(String taskName) {
this.taskName = taskName;
return this;
}
public List<FormVariable> getVariables() {
return variables;
}
public void setVariables(List<FormVariable> variables) {
this.variables = variables;
}
public FormDefinition withVariables(List<FormVariable> variables) {
this.variables = variables;
return this;
}
}

View File

@ -0,0 +1,56 @@
package com.inteligr8.alfresco.activiti.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"id",
"name"
})
public class FormOutcome {
@JsonProperty("id")
private String id;
@JsonProperty("name")
private String name;
/**
* No args constructor for use in serialization
*/
public FormOutcome() {
}
public FormOutcome(String id, String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public FormOutcome withId(String id) {
this.id = id;
return this;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public FormOutcome withName(String name) {
this.name = name;
return this;
}
}

View File

@ -0,0 +1,56 @@
package com.inteligr8.alfresco.activiti.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"id",
"name"
})
public class FormValue {
@JsonProperty("id")
private String id;
@JsonProperty("name")
private String name;
/**
* No args constructor for use in serialization
*/
public FormValue() {
}
public FormValue(String id, String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public FormValue withId(String id) {
this.id = id;
return this;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public FormValue withName(String name) {
this.name = name;
return this;
}
}

View File

@ -0,0 +1,73 @@
package com.inteligr8.alfresco.activiti.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"name",
"type",
"value"
})
public class FormVariable {
@JsonProperty("name")
private String name;
@JsonProperty("type")
private String type;
@JsonProperty("value")
private Object value;
/**
* No args constructor for use in serialization
*/
public FormVariable() {
}
public FormVariable(String name, String type, Object value) {
this.name = name;
this.type = type;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public FormVariable withName(String name) {
this.name = name;
return this;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public FormVariable withType(String type) {
this.type = type;
return this;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
public FormVariable withValue(Object value) {
this.value = value;
return this;
}
}