added process instance query operations

This commit is contained in:
Brian Long 2022-12-02 12:15:53 -05:00
parent 8697d67b39
commit 7048e42ca1
8 changed files with 708 additions and 23 deletions

View File

@ -17,6 +17,7 @@ package com.inteligr8.alfresco.activiti;
import com.inteligr8.alfresco.activiti.api.AdminApi;
import com.inteligr8.alfresco.activiti.api.AppDefinitionsApi;
import com.inteligr8.alfresco.activiti.api.AppVersionApi;
import com.inteligr8.alfresco.activiti.api.HistoricProcessInstancesApi;
import com.inteligr8.alfresco.activiti.api.ModelsApi;
import com.inteligr8.alfresco.activiti.api.ProcessInstancesApi;
import com.inteligr8.alfresco.activiti.api.ProfileApi;
@ -44,6 +45,10 @@ public interface ApsPublicRestApi {
default AppVersionApi getAppVersionApi() {
return this.getApi(AppVersionApi.class);
}
default HistoricProcessInstancesApi getHistoricProcessInstancesApi() {
return this.getApi(HistoricProcessInstancesApi.class);
}
default ModelsApi getModelsApi() {
return this.getApi(ModelsApi.class);

View File

@ -0,0 +1,34 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.inteligr8.alfresco.activiti.api;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import com.inteligr8.alfresco.activiti.model.HistoricProcessInstanceQueryRepresentation;
import com.inteligr8.alfresco.activiti.model.ProcessInstance;
import com.inteligr8.alfresco.activiti.model.ResultListDataRepresentation;
@Path("/api/enterprise/historic-process-instances")
public interface HistoricProcessInstancesApi {
@POST
@Consumes({ "application/json" })
@Produces({ "application/json" })
ResultListDataRepresentation<ProcessInstance> query(HistoricProcessInstanceQueryRepresentation request);
}

View File

@ -27,6 +27,8 @@ import javax.ws.rs.Produces;
import com.inteligr8.alfresco.activiti.model.CreateProcessInstance;
import com.inteligr8.alfresco.activiti.model.ProcessInstance;
import com.inteligr8.alfresco.activiti.model.ProcessInstanceQueryRepresentation;
import com.inteligr8.alfresco.activiti.model.ResultListDataRepresentation;
import com.inteligr8.alfresco.activiti.model.Variable;
@Path("/api/enterprise/process-instances")
@ -36,6 +38,11 @@ public interface ProcessInstancesApi {
@Consumes({ "application/json" })
@Produces({ "application/json" })
ProcessInstance create(CreateProcessInstance processInstance);
@POST
@Consumes({ "application/json" })
@Produces({ "application/json" })
ResultListDataRepresentation<ProcessInstance> query(ProcessInstanceQueryRepresentation request);
@GET
@Path("{processInstanceId}")

View File

@ -0,0 +1,395 @@
package com.inteligr8.alfresco.activiti.model;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"excludeSubprocesses",
"finished",
"finishedAfter",
"finishedBefore",
"includeProcessVariables",
"involvedUser",
"order",
"processBusinessKey",
"processDefinitionId",
"processDefinitionKey",
"processInstanceId",
"processInstanceIds",
"size",
"sort",
"start",
"startedAfter",
"startedBefore",
"startedBy",
"superProcessInstanceId",
"tenantId",
"tenantIdLike",
"variables",
"withoutTenantId"
})
public class HistoricProcessInstanceQueryRepresentation {
@JsonProperty("excludeSubprocesses")
private boolean excludeSubprocesses;
@JsonProperty("finished")
private boolean finished;
@JsonProperty("finishedAfter")
private OffsetDateTime finishedAfter;
@JsonProperty("finishedBefore")
private OffsetDateTime finishedBefore;
@JsonProperty("includeProcessVariables")
private boolean includeProcessVariables;
@JsonProperty("involvedUser")
private String involvedUser;
@JsonProperty("order")
private String order;
@JsonProperty("processBusinessKey")
private String processBusinessKey;
@JsonProperty("processDefinitionId")
private String processDefinitionId;
@JsonProperty("processDefinitionKey")
private String processDefinitionKey;
@JsonProperty("processInstanceId")
private String processInstanceId;
@JsonProperty("processInstanceIds")
private List<String> processInstanceIds;
@JsonProperty("size")
private int size;
@JsonProperty("sort")
private String sort;
@JsonProperty("start")
private int start;
@JsonProperty("startedAfter")
private OffsetDateTime startedAfter;
@JsonProperty("startedBefore")
private OffsetDateTime startedBefore;
@JsonProperty("startedBy")
private String startedBy;
@JsonProperty("superProcessInstanceId")
private String superProcessInstanceId;
@JsonProperty("tenantId")
private String tenantId;
@JsonProperty("tenantIdLike")
private String tenantIdLike;
@JsonProperty("variables")
private List<QueryVariable> variables = new ArrayList<QueryVariable>();
@JsonProperty("withoutTenantId")
private boolean withoutTenantId;
/**
* No args constructor for use in serialization
*/
public HistoricProcessInstanceQueryRepresentation() {
}
public boolean isExcludeSubprocesses() {
return excludeSubprocesses;
}
public void setExcludeSubprocesses(boolean excludeSubprocesses) {
this.excludeSubprocesses = excludeSubprocesses;
}
public HistoricProcessInstanceQueryRepresentation withExcludeSubprocesses(boolean excludeSubprocesses) {
this.excludeSubprocesses = excludeSubprocesses;
return this;
}
public boolean isFinished() {
return finished;
}
public void setFinished(boolean finished) {
this.finished = finished;
}
public HistoricProcessInstanceQueryRepresentation withFinished(boolean finished) {
this.finished = finished;
return this;
}
public OffsetDateTime getFinishedAfter() {
return finishedAfter;
}
public void setFinishedAfter(OffsetDateTime finishedAfter) {
this.finishedAfter = finishedAfter;
}
public HistoricProcessInstanceQueryRepresentation withFinishedAfter(OffsetDateTime finishedAfter) {
this.finishedAfter = finishedAfter;
return this;
}
public OffsetDateTime getFinishedBefore() {
return finishedBefore;
}
public void setFinishedBefore(OffsetDateTime finishedBefore) {
this.finishedBefore = finishedBefore;
}
public HistoricProcessInstanceQueryRepresentation withFinishedBefore(OffsetDateTime finishedBefore) {
this.finishedBefore = finishedBefore;
return this;
}
public boolean isIncludeProcessVariables() {
return includeProcessVariables;
}
public void setIncludeProcessVariables(boolean includeProcessVariables) {
this.includeProcessVariables = includeProcessVariables;
}
public HistoricProcessInstanceQueryRepresentation withIncludeProcessVariables(boolean includeProcessVariables) {
this.includeProcessVariables = includeProcessVariables;
return this;
}
public String getInvolvedUser() {
return involvedUser;
}
public void setInvolvedUser(String involvedUser) {
this.involvedUser = involvedUser;
}
public HistoricProcessInstanceQueryRepresentation withInvolvedUser(String involvedUser) {
this.involvedUser = involvedUser;
return this;
}
public String getOrder() {
return order;
}
public void setOrder(String order) {
this.order = order;
}
public HistoricProcessInstanceQueryRepresentation withOrder(String order) {
this.order = order;
return this;
}
public String getProcessBusinessKey() {
return processBusinessKey;
}
public void setProcessBusinessKey(String processBusinessKey) {
this.processBusinessKey = processBusinessKey;
}
public HistoricProcessInstanceQueryRepresentation withProcessBusinessKey(String processBusinessKey) {
this.processBusinessKey = processBusinessKey;
return this;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
public HistoricProcessInstanceQueryRepresentation withProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
return this;
}
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public void setProcessDefinitionKey(String processDefinitionKey) {
this.processDefinitionKey = processDefinitionKey;
}
public HistoricProcessInstanceQueryRepresentation withProcessDefinitionKey(String processDefinitionKey) {
this.processDefinitionKey = processDefinitionKey;
return this;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public HistoricProcessInstanceQueryRepresentation withProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
return this;
}
public List<String> getProcessInstanceIds() {
return processInstanceIds;
}
public void setProcessInstanceIds(List<String> processInstanceIds) {
this.processInstanceIds = processInstanceIds;
}
public HistoricProcessInstanceQueryRepresentation withProcessInstanceIds(List<String> processInstanceIds) {
this.processInstanceIds = processInstanceIds;
return this;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public HistoricProcessInstanceQueryRepresentation withSize(int size) {
this.size = size;
return this;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
public HistoricProcessInstanceQueryRepresentation withSort(String sort) {
this.sort = sort;
return this;
}
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
public HistoricProcessInstanceQueryRepresentation withStart(int start) {
this.start = start;
return this;
}
public OffsetDateTime getStartedAfter() {
return startedAfter;
}
public void setStartedAfter(OffsetDateTime startedAfter) {
this.startedAfter = startedAfter;
}
public HistoricProcessInstanceQueryRepresentation withStartedAfter(OffsetDateTime startedAfter) {
this.startedAfter = startedAfter;
return this;
}
public OffsetDateTime getStartedBefore() {
return startedBefore;
}
public void setStartedBefore(OffsetDateTime startedBefore) {
this.startedBefore = startedBefore;
}
public HistoricProcessInstanceQueryRepresentation withStartedBefore(OffsetDateTime startedBefore) {
this.startedBefore = startedBefore;
return this;
}
public String getStartedBy() {
return startedBy;
}
public void setStartedBy(String startedBy) {
this.startedBy = startedBy;
}
public HistoricProcessInstanceQueryRepresentation withStartedBy(String startedBy) {
this.startedBy = startedBy;
return this;
}
public String getSuperProcessInstanceId() {
return superProcessInstanceId;
}
public void setSuperProcessInstanceId(String superProcessInstanceId) {
this.superProcessInstanceId = superProcessInstanceId;
}
public HistoricProcessInstanceQueryRepresentation withSuperProcessInstanceId(String superProcessInstanceId) {
this.superProcessInstanceId = superProcessInstanceId;
return this;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public HistoricProcessInstanceQueryRepresentation withTenantId(String tenantId) {
this.tenantId = tenantId;
return this;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public void setTenantIdLike(String tenantIdLike) {
this.tenantIdLike = tenantIdLike;
}
public HistoricProcessInstanceQueryRepresentation withTenantIdLike(String tenantIdLike) {
this.tenantIdLike = tenantIdLike;
return this;
}
public List<QueryVariable> getVariables() {
return variables;
}
public void setVariables(List<QueryVariable> variables) {
this.variables = variables;
}
public HistoricProcessInstanceQueryRepresentation withVariables(List<QueryVariable> variables) {
this.variables = variables;
return this;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
public void setWithoutTenantId(boolean withoutTenantId) {
this.withoutTenantId = withoutTenantId;
}
public HistoricProcessInstanceQueryRepresentation withWithoutTenantId(boolean withoutTenantId) {
this.withoutTenantId = withoutTenantId;
return this;
}
}

View File

@ -11,26 +11,26 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"businessKey",
"ended",
"graphicalNotationDefined",
"id",
"name",
"processDefinitionCategory",
"processDefinitionDeploymentId",
"processDefinitionDescription",
"businessKey",
"processDefinitionId",
"processDefinitionKey",
"processDefinitionName",
"processDefinitionVersion",
"startFormDefined",
"started",
"startedBy",
"suspended",
"tenantId",
"started",
"ended",
"startedBy",
"processDefinitionName",
"processDefinitionDescription",
"processDefinitionKey",
"processDefinitionCategory",
"processDefinitionVersion",
"processDefinitionDeploymentId",
"graphicalNotationDefined",
"startFormDefined",
"suspended",
"variables"
})
public class ProcessInstance {
public class ProcessInstance extends Datum {
@JsonProperty("businessKey")
private String businessKey;

View File

@ -0,0 +1,154 @@
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({
"appDefinitionId",
"page",
"processDefinitionId",
"processInstanceId",
"size",
"sort",
"start",
"state"
})
public class ProcessInstanceQueryRepresentation {
public enum Sort {
@JsonProperty("created-asc")
CreatedAsc,
@JsonProperty("created-desc")
CreatedDesc,
@JsonProperty("ended-asc")
EndedAsc,
@JsonProperty("ended-desc")
EndedDesc,
}
public enum State {
@JsonProperty("all")
All,
@JsonProperty("completed")
Completed,
@JsonProperty("running")
Running
}
@JsonProperty("appDefinitionId")
private long appDefinitionId;
@JsonProperty("processDefinitionId")
private String processDefinitionId;
@JsonProperty("processInstanceId")
private String processInstanceId;
@JsonProperty("size")
private int size;
@JsonProperty("sort")
private Sort sort;
@JsonProperty("start")
private int start;
@JsonProperty("state")
private State state;
/**
* No args constructor for use in serialization
*/
public ProcessInstanceQueryRepresentation() {
}
public long getAppDefinitionId() {
return appDefinitionId;
}
public void setAppDefinitionId(long appDefinitionId) {
this.appDefinitionId = appDefinitionId;
}
public ProcessInstanceQueryRepresentation withAppDefinitionId(long appDefinitionId) {
this.appDefinitionId = appDefinitionId;
return this;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
public ProcessInstanceQueryRepresentation withProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
return this;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public ProcessInstanceQueryRepresentation withProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
return this;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public ProcessInstanceQueryRepresentation withSize(int size) {
this.size = size;
return this;
}
public Sort getSort() {
return sort;
}
public void setSort(Sort sort) {
this.sort = sort;
}
public ProcessInstanceQueryRepresentation withSort(Sort sort) {
this.sort = sort;
return this;
}
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
public ProcessInstanceQueryRepresentation withStart(int start) {
this.start = start;
return this;
}
public State getState() {
return state;
}
public void setState(State state) {
this.state = state;
}
public ProcessInstanceQueryRepresentation withState(State state) {
this.state = state;
return this;
}
}

View File

@ -0,0 +1,90 @@
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",
"operation",
"type",
"value"
})
public class QueryVariable {
@JsonProperty("name")
private String name;
@JsonProperty("operation")
private String operation;
@JsonProperty("type")
private String type;
@JsonProperty("value")
private Object value;
/**
* No args constructor for use in serialization
*/
public QueryVariable() {
}
public QueryVariable(String name, String operation, String type, Object value) {
this.name = name;
this.operation = operation;
this.type = type;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public QueryVariable withName(String name) {
this.name = name;
return this;
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
public QueryVariable withOperation(String operation) {
this.operation = operation;
return this;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public QueryVariable withType(String type) {
this.type = type;
return this;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
public QueryVariable withValue(Object value) {
this.value = value;
return this;
}
}

View File

@ -26,10 +26,10 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
"start",
"total"
})
public class ResultListDataRepresentation {
public class ResultListDataRepresentation<T extends Datum> {
@JsonProperty("data")
private List<Datum> data = new ArrayList<Datum>();
private List<T> data = new ArrayList<>();
@JsonProperty("size")
private Integer size;
@JsonProperty("start")
@ -40,16 +40,16 @@ public class ResultListDataRepresentation {
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
@JsonProperty("data")
public List<Datum> getData() {
public List<T> getData() {
return data;
}
@JsonProperty("data")
public void setData(List<Datum> data) {
public void setData(List<T> data) {
this.data = data;
}
public ResultListDataRepresentation withData(List<Datum> data) {
public ResultListDataRepresentation<T> withData(List<T> data) {
this.data = data;
return this;
}
@ -64,7 +64,7 @@ public class ResultListDataRepresentation {
this.size = size;
}
public ResultListDataRepresentation withSize(Integer size) {
public ResultListDataRepresentation<T> withSize(Integer size) {
this.size = size;
return this;
}
@ -79,7 +79,7 @@ public class ResultListDataRepresentation {
this.start = start;
}
public ResultListDataRepresentation withStart(Integer start) {
public ResultListDataRepresentation<T> withStart(Integer start) {
this.start = start;
return this;
}
@ -94,7 +94,7 @@ public class ResultListDataRepresentation {
this.total = total;
}
public ResultListDataRepresentation withTotal(Integer total) {
public ResultListDataRepresentation<T> withTotal(Integer total) {
this.total = total;
return this;
}
@ -109,7 +109,7 @@ public class ResultListDataRepresentation {
this.additionalProperties.put(name, value);
}
public ResultListDataRepresentation withAdditionalProperty(String name, Object value) {
public ResultListDataRepresentation<T> withAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
return this;
}