added ProcessDefinitionApi
This commit is contained in:
parent
8d993b68be
commit
9019889239
@ -18,6 +18,7 @@ import com.inteligr8.activiti.api.DeadletterJobsApi;
|
||||
import com.inteligr8.activiti.api.ExecutionApi;
|
||||
import com.inteligr8.activiti.api.JobsApi;
|
||||
import com.inteligr8.activiti.api.ManagementApi;
|
||||
import com.inteligr8.activiti.api.ProcessDefinitionApi;
|
||||
import com.inteligr8.activiti.api.ProcessInstanceApi;
|
||||
import com.inteligr8.activiti.api.RuntimeApi;
|
||||
import com.inteligr8.activiti.api.TimerJobsApi;
|
||||
@ -52,6 +53,10 @@ public interface ActivitiPublicRestApi {
|
||||
return this.getApi(TimerJobsApi.class);
|
||||
}
|
||||
|
||||
default ProcessDefinitionApi getProcessDefinitionApi() {
|
||||
return this.getApi(ProcessDefinitionApi.class);
|
||||
}
|
||||
|
||||
default ProcessInstanceApi getProcessInstanceApi() {
|
||||
return this.getApi(ProcessInstanceApi.class);
|
||||
}
|
||||
|
@ -0,0 +1,136 @@
|
||||
/*
|
||||
* 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.activiti.api;
|
||||
|
||||
import com.inteligr8.activiti.api.ProcessInstanceApi.Sort;
|
||||
import com.inteligr8.activiti.model.ProcessDefinitionAction;
|
||||
import com.inteligr8.activiti.model.ResultList;
|
||||
import com.inteligr8.activiti.model.SortOrder;
|
||||
import com.inteligr8.activiti.model.ProcessDefinitionAction.ActionValue;
|
||||
import com.inteligr8.alfresco.activiti.model.ProcessDefinition;
|
||||
import com.inteligr8.alfresco.activiti.model.ProcessInstance;
|
||||
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.PUT;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.QueryParam;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
|
||||
@Path("/api/repository/process-definitions")
|
||||
public interface ProcessDefinitionApi {
|
||||
|
||||
@GET
|
||||
@Path("{processDefinitionId}")
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
ProcessDefinition get(
|
||||
@PathParam("processDefinitionId") String processDefinitionId);
|
||||
|
||||
default void activate(
|
||||
String processDefinitionId) {
|
||||
this.act(processDefinitionId, new ProcessDefinitionAction(ActionValue.Activate));
|
||||
}
|
||||
|
||||
default void suspend(
|
||||
String processDefinitionId) {
|
||||
this.act(processDefinitionId, new ProcessDefinitionAction(ActionValue.Suspend));
|
||||
}
|
||||
|
||||
@PUT
|
||||
@Path("{processDefinitionId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
void act(
|
||||
@PathParam("processDefinitionId") String processDefinitionId,
|
||||
ProcessDefinitionAction action);
|
||||
|
||||
default ResultList<ProcessInstance> getByTenant(
|
||||
String category,
|
||||
String categoryLike,
|
||||
String categoryNotEquals,
|
||||
String key,
|
||||
String keyLike,
|
||||
String name,
|
||||
String nameLike,
|
||||
String resourceName,
|
||||
String resourceNameLike,
|
||||
String version,
|
||||
Boolean suspended,
|
||||
boolean latest,
|
||||
String deploymentId,
|
||||
String startableByUser,
|
||||
String tenantId,
|
||||
Sort sort,
|
||||
SortOrder sortOrder,
|
||||
Integer pageStart,
|
||||
Integer pageSize) {
|
||||
return this.getByAny(category, categoryLike, categoryNotEquals, key, keyLike,
|
||||
name, nameLike, resourceName, resourceNameLike, version,
|
||||
suspended, latest, deploymentId, startableByUser,
|
||||
tenantId, null, sort, sortOrder, pageStart, pageSize);
|
||||
}
|
||||
|
||||
default ResultList<ProcessInstance> getByTenants(
|
||||
String category,
|
||||
String categoryLike,
|
||||
String categoryNotEquals,
|
||||
String key,
|
||||
String keyLike,
|
||||
String name,
|
||||
String nameLike,
|
||||
String resourceName,
|
||||
String resourceNameLike,
|
||||
String version,
|
||||
Boolean suspended,
|
||||
boolean latest,
|
||||
String deploymentId,
|
||||
String startableByUser,
|
||||
String tenantIdLike,
|
||||
Sort sort,
|
||||
SortOrder sortOrder,
|
||||
Integer pageStart,
|
||||
Integer pageSize) {
|
||||
return this.getByAny(category, categoryLike, categoryNotEquals, key, keyLike,
|
||||
name, nameLike, resourceName, resourceNameLike, version,
|
||||
suspended, latest, deploymentId, startableByUser,
|
||||
null, tenantIdLike, sort, sortOrder, pageStart, pageSize);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public ResultList<ProcessInstance> getByAny(
|
||||
@QueryParam("category") String category,
|
||||
@QueryParam("categoryLike") String categoryLike,
|
||||
@QueryParam("categoryNotEquals") String categoryNotEquals,
|
||||
@QueryParam("key") String key,
|
||||
@QueryParam("keyLike") String keyLike,
|
||||
@QueryParam("name") String name,
|
||||
@QueryParam("nameLike") String nameLike,
|
||||
@QueryParam("resourceName") String resourceName,
|
||||
@QueryParam("resourceNameLike") String resourceNameLike,
|
||||
@QueryParam("version") String version,
|
||||
@QueryParam("suspended") Boolean suspended,
|
||||
@QueryParam("latest") Boolean latest,
|
||||
@QueryParam("deploymentId") String deploymentId,
|
||||
@QueryParam("startableByUser") String startableByUser,
|
||||
@QueryParam("tenantId") String tenantId,
|
||||
@QueryParam("tenantIdLike") String tenantIdLike,
|
||||
@QueryParam("sort") Sort sort,
|
||||
@QueryParam("order") SortOrder sortOrder,
|
||||
@QueryParam("start") Integer pageStart,
|
||||
@QueryParam("size") Integer pageSize);
|
||||
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package com.inteligr8.activiti.model;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ProcessDefinitionAction {
|
||||
|
||||
public enum ActionValue {
|
||||
@JsonProperty("suspend")
|
||||
Suspend,
|
||||
@JsonProperty("activate")
|
||||
Activate
|
||||
}
|
||||
|
||||
@JsonProperty("action")
|
||||
private ActionValue action;
|
||||
@JsonProperty("includeProcessInstances")
|
||||
private boolean includeProcessInstances;
|
||||
@JsonProperty("date")
|
||||
private OffsetDateTime date;
|
||||
@JsonProperty("category")
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* No args constructor for use in serialization
|
||||
*/
|
||||
public ProcessDefinitionAction() {
|
||||
}
|
||||
|
||||
public ProcessDefinitionAction(ActionValue action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public ActionValue getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(ActionValue action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public ProcessDefinitionAction withAction(ActionValue action) {
|
||||
this.action = action;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isIncludeProcessInstances() {
|
||||
return includeProcessInstances;
|
||||
}
|
||||
|
||||
public void setIncludeProcessInstances(boolean includeProcessInstances) {
|
||||
this.includeProcessInstances = includeProcessInstances;
|
||||
}
|
||||
|
||||
public ProcessDefinitionAction withIncludeProcessInstances(boolean includeProcessInstances) {
|
||||
this.includeProcessInstances = includeProcessInstances;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OffsetDateTime getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(OffsetDateTime date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public ProcessDefinitionAction withDate(OffsetDateTime date) {
|
||||
this.date = date;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public ProcessDefinitionAction withCategory(String category) {
|
||||
this.category = category;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user