added ProcessInstanceApi and ExecutionApi

This commit is contained in:
Brian Long 2023-11-13 17:08:16 -05:00
parent 24ad70c25c
commit 14a2f74a60
16 changed files with 1511 additions and 243 deletions

View File

@ -0,0 +1,225 @@
/*
* 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 java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.inteligr8.activiti.model.Action;
import com.inteligr8.activiti.model.Action.ActionValue;
import com.inteligr8.activiti.model.Execution;
import com.inteligr8.activiti.model.ResultList;
import com.inteligr8.activiti.model.SignalEventAction;
import com.inteligr8.activiti.model.SortOrder;
import com.inteligr8.activiti.model.Variable;
@Path("/api/runtime/executions")
public interface ExecutionApi {
public enum Sort {
@JsonProperty("id")
ProcessInstanceId,
@JsonProperty("processDefinitionId")
ProcessDefinitionId,
@JsonProperty("tenantId")
TenantId,
@JsonProperty("processDefinitionKey")
ProcessDefinitionKey;
}
public enum VariableScope {
@JsonProperty("local")
Local,
@JsonProperty("global")
Global,
}
@GET
@Path("{executionId}")
@Produces({ MediaType.APPLICATION_JSON })
Execution get(
@PathParam("executionId") String executionId);
@GET
@Path("{executionId}/activities")
@Produces({ MediaType.APPLICATION_JSON })
List<String> getActiveActivities(
@PathParam("executionId") String executionId);
default Execution signal(
String processInstanceId,
List<Variable> variables) {
Action action = new Action(ActionValue.Signal);
if (variables != null && !variables.isEmpty())
action.setVariables(variables);
return this.execute(processInstanceId, action);
}
default Execution signalReceived(
String processInstanceId,
String signal,
List<Variable> variables) {
Action action = new SignalEventAction(ActionValue.SignalReceived, signal);
if (variables != null && !variables.isEmpty())
action.setVariables(variables);
return this.execute(processInstanceId, action);
}
default Execution messageReceived(
String processInstanceId,
String message,
List<Variable> variables) {
Action action = new SignalEventAction(ActionValue.MessageReceived, message);
if (variables != null && !variables.isEmpty())
action.setVariables(variables);
return this.execute(processInstanceId, action);
}
@PUT
@Path("{executionId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
Execution execute(
@PathParam("executionId") String executionId,
Action action);
default ResultList<Execution> getWithoutTenant(
String executionId,
String activityId,
String processDefinitionKey,
String processDefinitionId,
String processInstanceId,
String messageEventSubscriptionName,
String signalEventSubscriptionName,
String parentId,
Sort sort,
SortOrder sortOrder,
Integer pageStart,
Integer pageSize) {
return this.getByAny(executionId, activityId, processDefinitionKey, processDefinitionId, processInstanceId,
messageEventSubscriptionName, signalEventSubscriptionName, parentId, null, null, true,
sort, sortOrder, pageStart, pageSize);
}
default ResultList<Execution> getByTenant(
String executionId,
String activityId,
String processDefinitionKey,
String processDefinitionId,
String processInstanceId,
String messageEventSubscriptionName,
String signalEventSubscriptionName,
String parentId,
String tenantId,
Sort sort,
SortOrder sortOrder,
Integer pageStart,
Integer pageSize) {
return this.getByAny(executionId, activityId, processDefinitionKey, processDefinitionId, processInstanceId,
messageEventSubscriptionName, signalEventSubscriptionName, parentId, tenantId, null, false,
sort, sortOrder, pageStart, pageSize);
}
default ResultList<Execution> getByTenants(
String executionId,
String activityId,
String processDefinitionKey,
String processDefinitionId,
String processInstanceId,
String messageEventSubscriptionName,
String signalEventSubscriptionName,
String parentId,
String tenantIdLike,
Sort sort,
SortOrder sortOrder,
Integer pageStart,
Integer pageSize) {
return this.getByAny(executionId, activityId, processDefinitionKey, processDefinitionId, processInstanceId,
messageEventSubscriptionName, signalEventSubscriptionName, parentId, null, tenantIdLike, false,
sort, sortOrder, pageStart, pageSize);
}
@GET
@Produces({ MediaType.APPLICATION_JSON })
public ResultList<Execution> getByAny(
@QueryParam("id") String executionId,
@QueryParam("activityId") String activityId,
@QueryParam("processDefinitionKey") String processDefinitionKey,
@QueryParam("processDefinitionId") String processDefinitionId,
@QueryParam("processInstanceId") String processInstanceId,
@QueryParam("messageEventSubscriptionName") String messageEventSubscriptionName,
@QueryParam("signalEventSubscriptionName") String signalEventSubscriptionName,
@QueryParam("parentId") String parentId,
@QueryParam("tenantId") String tenantId,
@QueryParam("tenantIdLike") String tenantIdLike,
@QueryParam("withoutTenantId") Boolean withoutTenantId,
@QueryParam("sort") Sort sort,
@QueryParam("order") SortOrder sortOrder,
@QueryParam("start") Integer pageStart,
@QueryParam("size") Integer pageSize);
@GET
@Path("{executionId}/variables")
@Produces({ MediaType.APPLICATION_JSON })
List<Variable> getVariables(
@PathParam("executionId") String executionId,
@QueryParam("scope") VariableScope scope);
@GET
@Path("{executionId}/variables/{variableName}")
@Produces({ MediaType.APPLICATION_JSON })
Variable getVariable(
@PathParam("executionId") String executionId,
@PathParam("variableName") String variableName);
@POST
@Path("{executionId}/variables")
@Consumes({ MediaType.APPLICATION_JSON })
void createVariables(
@PathParam("executionId") String executionId,
List<Variable> variables);
@PUT
@Path("{executionId}/variables")
@Consumes({ MediaType.APPLICATION_JSON })
void updateVariables(
@PathParam("executionId") String executionId,
List<Variable> variables);
default void updateVariable(
String executionId,
Variable variable) {
this.updateVariable(executionId, variable.getName(), variable);
}
@PUT
@Path("{executionId}/variables/{variableName}")
@Consumes({ MediaType.APPLICATION_JSON })
void updateVariable(
@PathParam("executionId") String executionId,
@PathParam("variableName") String variableName,
Variable variable);
}

View File

@ -25,149 +25,167 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.inteligr8.activiti.model.Action;
import com.inteligr8.activiti.model.Action.ActionValue;
import com.inteligr8.activiti.model.Engine;
import com.inteligr8.activiti.model.EngineProperties;
import com.inteligr8.activiti.model.ExecuteAction;
import com.inteligr8.activiti.model.ExecuteAction.Action;
import com.inteligr8.activiti.model.Job;
import com.inteligr8.activiti.model.ResultList;
@Path("/api/management")
public interface ManagementApi {
public enum JobType {
@JsonProperty("jobs")
Job,
@JsonProperty("deadletter-jobs")
DeadletterJob
}
@GET
@Path("engine")
@Produces({ "application/json" })
@Produces({ MediaType.APPLICATION_JSON })
public Engine getEngine();
@GET
@Path("properties")
@Produces({ "application/json" })
@Produces({ MediaType.APPLICATION_JSON })
public EngineProperties getEngineProperties();
@GET
@Path("{jobType}/{jobId}")
@Produces({ "application/json" })
public Job getJob(
@PathParam("jobType") JobType jobType,
@PathParam("jobId") String jobId);
@DELETE
@Path("{jobType}/{jobId}")
public void deleteJob(
@PathParam("jobType") JobType jobType,
@PathParam("jobId") String jobId);
@POST
@Path("{jobType}/{jobId}")
@Consumes({ "application/json" })
public void executeJob(
@PathParam("jobType") JobType jobType,
@PathParam("jobId") String jobId,
ExecuteAction execute);
@Path("jobs")
public interface JobsApiImpl extends JobsApi {}
default void executeJob(
JobType jobType,
String jobId,
Action action) {
this.executeJob(jobType, jobId, new ExecuteAction(action));
}
@Path("timer-jobs")
public interface TimerJobsApiImpl extends JobsApi {}
default void executeJob(
JobType jobType,
String jobId) {
this.executeJob(jobType, jobId, new ExecuteAction(Action.Execute));
}
@Path("deadletter-jobs")
public interface DeadletterJobsApiImpl extends JobsApi {}
@GET
@Path("{jobType}/{jobId}/execution-stacktrace")
@Produces({ "application/octet-stream" })
public File getJobStacktrace(
@PathParam("jobType") JobType jobType,
@PathParam("jobId") String jobId);
@GET
@Path("{jobType}")
@Produces({ "application/json" })
public ResultList<Job> queryJobs(
@PathParam("jobType") JobType jobType,
@QueryParam("id") String jobId,
@QueryParam("processInstanceId") String processInstanceId,
@QueryParam("executionId") String executionId,
@QueryParam("processDefinitionId") String processDefinitionId,
@QueryParam("withRetriesLeft") Boolean withRetriesLeft,
@QueryParam("executable") Boolean executable,
@QueryParam("timersOnly") Boolean timersOnly,
@QueryParam("messagesOnly") Boolean messagesOnly,
@QueryParam("withException") Boolean withException,
@QueryParam("dueBefore") LocalDate dueBefore,
@QueryParam("dueAfter") LocalDate dueAfter,
@QueryParam("exceptionMessage") String exceptionMessage,
@QueryParam("withoutTenantId") Boolean withoutTenatId,
@QueryParam("sort") String sort);
@GET
@Path("{jobType}")
@Produces({ "application/json" })
public ResultList<Job> queryJobs(
@PathParam("jobType") JobType jobType,
@QueryParam("id") String jobId,
@QueryParam("processInstanceId") String processInstanceId,
@QueryParam("executionId") String executionId,
@QueryParam("processDefinitionId") String processDefinitionId,
@QueryParam("withRetriesLeft") Boolean withRetriesLeft,
@QueryParam("executable") Boolean executable,
@QueryParam("timersOnly") Boolean timersOnly,
@QueryParam("messagesOnly") Boolean messagesOnly,
@QueryParam("withException") Boolean withException,
@QueryParam("dueBefore") LocalDate dueBefore,
@QueryParam("dueAfter") LocalDate dueAfter,
@QueryParam("exceptionMessage") String exceptionMessage,
@QueryParam("tenantId") String tenantId,
@QueryParam("tenantIdLike") String tenantIdLike,
@QueryParam("sort") String sort);
default ResultList<Job> queryTimerJobs(
JobType jobType,
@QueryParam("id") String jobId,
@QueryParam("processInstanceId") String processInstanceId,
@QueryParam("executionId") String executionId,
@QueryParam("processDefinitionId") String processDefinitionId,
@QueryParam("withRetriesLeft") Boolean withRetriesLeft,
@QueryParam("executable") Boolean executable,
@QueryParam("withException") Boolean withException,
@QueryParam("dueBefore") LocalDate dueBefore,
@QueryParam("dueAfter") LocalDate dueAfter,
@QueryParam("exceptionMessage") String exceptionMessage,
@QueryParam("withoutTenantId") Boolean withoutTenantId,
@QueryParam("sort") String sort) {
return this.queryJobs(jobType, jobId, processInstanceId, executionId, processDefinitionId, withRetriesLeft, executable, true, false, withException, dueBefore, dueAfter, exceptionMessage, withoutTenantId, sort);
}
default ResultList<Job> queryMessagesJobs(
JobType jobType,
@QueryParam("id") String jobId,
@QueryParam("processInstanceId") String processInstanceId,
@QueryParam("executionId") String executionId,
@QueryParam("processDefinitionId") String processDefinitionId,
@QueryParam("withRetriesLeft") Boolean withRetriesLeft,
@QueryParam("executable") Boolean executable,
@QueryParam("withException") Boolean withException,
@QueryParam("dueBefore") LocalDate dueBefore,
@QueryParam("dueAfter") LocalDate dueAfter,
@QueryParam("exceptionMessage") String exceptionMessage,
@QueryParam("withoutTenantId") Boolean withoutTenantId,
@QueryParam("sort") String sort) {
return this.queryJobs(jobType, jobId, processInstanceId, executionId, processDefinitionId, withRetriesLeft, executable, false, true, withException, dueBefore, dueAfter, exceptionMessage, withoutTenantId, sort);
public interface JobsApi {
@GET
@Path("{jobId}")
@Produces({ MediaType.APPLICATION_JSON })
public Job getJob(
@PathParam("jobId") String jobId);
@DELETE
@Path("{jobId}")
public void deleteJob(
@PathParam("jobId") String jobId);
@POST
@Path("{jobId}")
@Consumes({ MediaType.APPLICATION_JSON })
public void executeJob(
@PathParam("jobId") String jobId,
Action execute);
default void executeJob(
String jobId,
ActionValue action) {
this.executeJob(jobId, new Action(action));
}
default void executeJob(
String jobId) {
this.executeJob(jobId, new Action(ActionValue.Execute));
}
@GET
@Path("{jobId}/execution-stacktrace")
@Produces({ MediaType.APPLICATION_OCTET_STREAM })
public File getJobStacktrace(
@PathParam("jobId") String jobId);
@GET
@Produces({ MediaType.APPLICATION_JSON })
public ResultList<Job> queryJobs(
@QueryParam("processInstanceId") String processInstanceId,
@QueryParam("executionId") String executionId,
@QueryParam("processDefinitionId") String processDefinitionId,
@QueryParam("withRetriesLeft") Boolean withRetriesLeft,
@QueryParam("executable") Boolean executable,
@QueryParam("dueBefore") LocalDate dueBefore,
@QueryParam("dueAfter") LocalDate dueAfter,
@QueryParam("withoutTenantId") Boolean withoutTenatId,
@QueryParam("sort") String sort);
@GET
@Produces({ MediaType.APPLICATION_JSON })
public ResultList<Job> queryJobs(
@QueryParam("processInstanceId") String processInstanceId,
@QueryParam("executionId") String executionId,
@QueryParam("processDefinitionId") String processDefinitionId,
@QueryParam("withRetriesLeft") Boolean withRetriesLeft,
@QueryParam("executable") Boolean executable,
@QueryParam("dueBefore") LocalDate dueBefore,
@QueryParam("dueAfter") LocalDate dueAfter,
@QueryParam("tenantId") String tenantId,
@QueryParam("tenantIdLike") String tenantIdLike,
@QueryParam("sort") String sort);
@GET
@Produces({ MediaType.APPLICATION_JSON })
public ResultList<Job> queryJobs(
@QueryParam("processInstanceId") String processInstanceId,
@QueryParam("executionId") String executionId,
@QueryParam("processDefinitionId") String processDefinitionId,
@QueryParam("withRetriesLeft") Boolean withRetriesLeft,
@QueryParam("executable") Boolean executable,
@QueryParam("withException") Boolean withException,
@QueryParam("dueBefore") LocalDate dueBefore,
@QueryParam("dueAfter") LocalDate dueAfter,
@QueryParam("exceptionMessage") String exceptionMessage,
@QueryParam("withoutTenantId") Boolean withoutTenatId,
@QueryParam("sort") String sort);
@GET
@Produces({ MediaType.APPLICATION_JSON })
public ResultList<Job> queryJobs(
@QueryParam("processInstanceId") String processInstanceId,
@QueryParam("executionId") String executionId,
@QueryParam("processDefinitionId") String processDefinitionId,
@QueryParam("withRetriesLeft") Boolean withRetriesLeft,
@QueryParam("executable") Boolean executable,
@QueryParam("withException") Boolean withException,
@QueryParam("dueBefore") LocalDate dueBefore,
@QueryParam("dueAfter") LocalDate dueAfter,
@QueryParam("exceptionMessage") String exceptionMessage,
@QueryParam("tenantId") String tenantId,
@QueryParam("tenantIdLike") String tenantIdLike,
@QueryParam("sort") String sort);
@GET
@Produces({ MediaType.APPLICATION_JSON })
public ResultList<Job> queryJobs(
@QueryParam("id") String jobId,
@QueryParam("processInstanceId") String processInstanceId,
@QueryParam("executionId") String executionId,
@QueryParam("processDefinitionId") String processDefinitionId,
@QueryParam("withRetriesLeft") Boolean withRetriesLeft,
@QueryParam("executable") Boolean executable,
@QueryParam("withException") Boolean withException,
@QueryParam("dueBefore") LocalDate dueBefore,
@QueryParam("dueAfter") LocalDate dueAfter,
@QueryParam("exceptionMessage") String exceptionMessage,
@QueryParam("withoutTenantId") Boolean withoutTenatId,
@QueryParam("sort") String sort);
@GET
@Produces({ MediaType.APPLICATION_JSON })
public ResultList<Job> queryJobs(
@QueryParam("id") String jobId,
@QueryParam("processInstanceId") String processInstanceId,
@QueryParam("executionId") String executionId,
@QueryParam("processDefinitionId") String processDefinitionId,
@QueryParam("withRetriesLeft") Boolean withRetriesLeft,
@QueryParam("executable") Boolean executable,
@QueryParam("withException") Boolean withException,
@QueryParam("dueBefore") LocalDate dueBefore,
@QueryParam("dueAfter") LocalDate dueAfter,
@QueryParam("exceptionMessage") String exceptionMessage,
@QueryParam("tenantId") String tenantId,
@QueryParam("tenantIdLike") String tenantIdLike,
@QueryParam("sort") String sort);
}
}

View File

@ -0,0 +1,214 @@
/*
* 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 java.io.File;
import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.inteligr8.activiti.model.Action;
import com.inteligr8.activiti.model.Action.ActionValue;
import com.inteligr8.activiti.model.ResultList;
import com.inteligr8.activiti.model.SortOrder;
import com.inteligr8.activiti.model.Variable;
import com.inteligr8.alfresco.activiti.model.ProcessInstance;
@Path("/api/runtime/process-instances")
public interface ProcessInstanceApi {
public enum Sort {
@JsonProperty("id")
ProcessInstanceId,
@JsonProperty("processDefinitionId")
ProcessDefinitionId,
@JsonProperty("tenantId")
TenantId,
@JsonProperty("processDefinitionKey")
ProcessDefinitionKey;
}
@GET
@Path("{processInstanceId}")
@Produces({ MediaType.APPLICATION_JSON })
ProcessInstance get(
@PathParam("processInstanceId") String processInstanceId);
@DELETE
@Path("{processInstanceId}")
void delete(
@PathParam("processInstanceId") String processInstanceId);
default void activate(
String processInstanceId) {
this.act(processInstanceId, new Action(ActionValue.Activate));
}
default void suspend(
String processInstanceId) {
this.act(processInstanceId, new Action(ActionValue.Suspend));
}
@PUT
@Path("{processInstanceId}")
@Consumes({ MediaType.APPLICATION_JSON })
void act(
@PathParam("processInstanceId") String processInstanceId,
Action action);
default ResultList<ProcessInstance> getWithoutTenant(
String processInstanceId,
String processDefinitionKey,
String processDefinitionId,
String businessKey,
String involvedUser,
Boolean suspended,
String superProcessInstanceId,
String subProcessInstanceId,
Boolean excludeSubprocesses,
Boolean includeProcessVariables,
Sort sort,
SortOrder sortOrder,
Integer pageStart,
Integer pageSize) {
return this.getByAny(processInstanceId, processDefinitionKey, processDefinitionId,
businessKey, involvedUser, suspended, superProcessInstanceId, subProcessInstanceId,
excludeSubprocesses, includeProcessVariables, null, null, true,
sort, sortOrder, pageStart, pageSize);
}
default ResultList<ProcessInstance> getByTenant(
String processInstanceId,
String processDefinitionKey,
String processDefinitionId,
String businessKey,
String involvedUser,
Boolean suspended,
String superProcessInstanceId,
String subProcessInstanceId,
Boolean excludeSubprocesses,
Boolean includeProcessVariables,
String tenantId,
Sort sort,
SortOrder sortOrder,
Integer pageStart,
Integer pageSize) {
return this.getByAny(processInstanceId, processDefinitionKey, processDefinitionId,
businessKey, involvedUser, suspended, superProcessInstanceId, subProcessInstanceId,
excludeSubprocesses, includeProcessVariables, tenantId, null, false,
sort, sortOrder, pageStart, pageSize);
}
default ResultList<ProcessInstance> getByTenants(
String processInstanceId,
String processDefinitionKey,
String processDefinitionId,
String businessKey,
String involvedUser,
Boolean suspended,
String superProcessInstanceId,
String subProcessInstanceId,
Boolean excludeSubprocesses,
Boolean includeProcessVariables,
String tenantIdLike,
Sort sort,
SortOrder sortOrder,
Integer pageStart,
Integer pageSize) {
return this.getByAny(processInstanceId, processDefinitionKey, processDefinitionId,
businessKey, involvedUser, suspended, superProcessInstanceId, subProcessInstanceId,
excludeSubprocesses, includeProcessVariables, null, tenantIdLike, false,
sort, sortOrder, pageStart, pageSize);
}
@GET
@Produces({ MediaType.APPLICATION_JSON })
public ResultList<ProcessInstance> getByAny(
@QueryParam("id") String processInstanceId,
@QueryParam("processDefinitionKey") String processDefinitionKey,
@QueryParam("processDefinitionId") String processDefinitionId,
@QueryParam("businessKey") String businessKey,
@QueryParam("involvedUser") String involvedUser,
@QueryParam("suspended") Boolean suspended,
@QueryParam("superProcessInstanceId") String superProcessInstanceId,
@QueryParam("subProcessInstanceId") String subProcessInstanceId,
@QueryParam("excludeSubprocesses") Boolean excludeSubprocesses,
@QueryParam("includeProcessVariables") Boolean includeProcessVariables,
@QueryParam("tenantId") String tenantId,
@QueryParam("tenantIdLike") String tenantIdLike,
@QueryParam("withoutTenantId") Boolean withoutTenantId,
@QueryParam("sort") Sort sort,
@QueryParam("order") SortOrder sortOrder,
@QueryParam("start") Integer pageStart,
@QueryParam("size") Integer pageSize);
@GET
@Path("{processInstanceId}/diagram")
@Produces({ "image/png" })
File getDiagram(
@PathParam("processInstanceId") String processInstanceId);
@GET
@Path("{processInstanceId}/variables")
@Produces({ MediaType.APPLICATION_JSON })
List<Variable> getVariables(
@PathParam("processInstanceId") String processInstanceId);
@GET
@Path("{processInstanceId}/variables/{variableName}")
@Produces({ MediaType.APPLICATION_JSON })
Variable getVariable(
@PathParam("processInstanceId") String processInstanceId,
@PathParam("variableName") String variableName);
@POST
@Path("{processInstanceId}/variables")
@Consumes({ MediaType.APPLICATION_JSON })
void createVariables(
@PathParam("processInstanceId") String processInstanceId,
List<Variable> variables);
@PUT
@Path("{processInstanceId}/variables")
@Consumes({ MediaType.APPLICATION_JSON })
void updateVariables(
@PathParam("processInstanceId") String processInstanceId,
List<Variable> variables);
default void updateVariable(
String processInstanceId,
Variable variable) {
this.updateVariable(processInstanceId, variable.getName(), variable);
}
@PUT
@Path("{processInstanceId}/variables/{variableName}")
@Consumes({ MediaType.APPLICATION_JSON })
void updateVariable(
@PathParam("processInstanceId") String processInstanceId,
@PathParam("variableName") String variableName,
Variable variable);
}

View File

@ -0,0 +1,38 @@
/*
* 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 java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import com.inteligr8.activiti.model.Variable;
@Path("/api/runtime")
public interface RuntimeApi {
@POST
@Path("signals")
@Consumes({ MediaType.APPLICATION_JSON })
void signalReceived(
String signal,
String tenantId,
Boolean async,
List<Variable> variables);
}

View File

@ -0,0 +1,67 @@
package com.inteligr8.activiti.model;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Action {
public enum ActionValue {
@JsonProperty("execute")
Execute,
@JsonProperty("suspend")
Suspend,
@JsonProperty("activate")
Activate,
@JsonProperty("signal")
Signal,
@JsonProperty("signalEventReceived")
SignalReceived,
@JsonProperty("messageEventReceived")
MessageReceived
}
@JsonProperty("action")
private ActionValue action;
@JsonProperty("variables")
private List<Variable> variables;
/**
* No args constructor for use in serialization
*/
public Action() {
}
public Action(ActionValue action) {
this.action = action;
}
public ActionValue getAction() {
return action;
}
public void setAction(ActionValue action) {
this.action = action;
}
public Action withAction(ActionValue action) {
this.action = action;
return this;
}
public List<Variable> getVariables() {
return variables;
}
public void setVariables(List<Variable> variables) {
this.variables = variables;
}
public Action withVariables(List<Variable> variables) {
this.variables = variables;
return this;
}
}

View File

@ -1,40 +0,0 @@
package com.inteligr8.activiti.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ExecuteAction {
public enum Action {
@JsonProperty("execute")
Execute
}
@JsonProperty("action")
private Action action;
/**
* No args constructor for use in serialization
*/
public ExecuteAction() {
}
public ExecuteAction(Action action) {
this.action = action;
}
public Action getAction() {
return action;
}
public void setAction(Action action) {
this.action = action;
}
public ExecuteAction withAction(Action action) {
this.action = action;
return this;
}
}

View File

@ -0,0 +1,182 @@
package com.inteligr8.activiti.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Execution extends Datum {
@JsonProperty("activityId")
private String activityId;
@JsonProperty("id")
private String id;
@JsonProperty("parentId")
private String parentId;
@JsonProperty("parentUrl")
private String parentUrl;
@JsonProperty("processInstanceId")
private String processInstanceId;
@JsonProperty("processInstanceUrl")
private String processInstanceUrl;
@JsonProperty("superExecutionId")
private String superExecutionId;
@JsonProperty("superExecutionUrl")
private String superExecutionUrl;
@JsonProperty("suspended")
private Boolean suspended;
@JsonProperty("tenantId")
private String tenantId;
@JsonProperty("url")
private String url;
/**
* No args constructor for use in serialization
*/
public Execution() {
}
public String getActivityId() {
return activityId;
}
public void setActivityId(String activityId) {
this.activityId = activityId;
}
public Execution withActivityId(String activityId) {
this.activityId = activityId;
return this;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Execution withId(String id) {
this.id = id;
return this;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public Execution withParentId(String parentId) {
this.parentId = parentId;
return this;
}
public String getParentUrl() {
return parentUrl;
}
public void setParentUrl(String parentUrl) {
this.parentUrl = parentUrl;
}
public Execution withParentUrl(String parentUrl) {
this.parentUrl = parentUrl;
return this;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public Execution withProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
return this;
}
public String getProcessInstanceUrl() {
return processInstanceUrl;
}
public void setProcessInstanceUrl(String processInstanceUrl) {
this.processInstanceUrl = processInstanceUrl;
}
public Execution withProcessInstanceUrl(String processInstanceUrl) {
this.processInstanceUrl = processInstanceUrl;
return this;
}
public String getSuperExecutionId() {
return superExecutionId;
}
public void setSuperExecutionId(String superExecutionId) {
this.superExecutionId = superExecutionId;
}
public Execution withSuperExecutionId(String superExecutionId) {
this.superExecutionId = superExecutionId;
return this;
}
public String getSuperExecutionUrl() {
return superExecutionUrl;
}
public void setSuperExecutionUrl(String superExecutionUrl) {
this.superExecutionUrl = superExecutionUrl;
}
public Execution withSuperExecutionUrl(String superExecutionUrl) {
this.superExecutionUrl = superExecutionUrl;
return this;
}
public Boolean getSuspended() {
return suspended;
}
public void setSuspended(Boolean suspended) {
this.suspended = suspended;
}
public Execution withSuspended(Boolean suspended) {
this.suspended = suspended;
return this;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public Execution withTenantId(String tenantId) {
this.tenantId = tenantId;
return this;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Execution withUrl(String url) {
this.url = url;
return this;
}
}

View File

@ -0,0 +1,37 @@
package com.inteligr8.activiti.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class MessageEventAction extends Action {
@JsonProperty("messageName")
private String message;
/**
* No args constructor for use in serialization
*/
public MessageEventAction() {
}
public MessageEventAction(ActionValue action, String message) {
super(action);
this.message = message;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public MessageEventAction withMessage(String message) {
this.message = message;
return this;
}
}

View File

@ -0,0 +1,202 @@
package com.inteligr8.activiti.model;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ProcessInstance extends Datum {
@JsonProperty("activityId")
private String activityId;
@JsonProperty("businessKey")
private String businessKey;
@JsonProperty("completed")
private Boolean completed;
@JsonProperty("ended")
private Boolean ended;
@JsonProperty("id")
private String id;
@JsonProperty("name")
private String name;
@JsonProperty("processDefinitionId")
private String processDefinitionId;
@JsonProperty("processDefinitionKey")
private String processDefinitionKey;
@JsonProperty("processDefinitionUrl")
private String processDefinitionUrl;
@JsonProperty("suspended")
private Boolean suspended;
@JsonProperty("tenantId")
private String tenantId;
@JsonProperty("url")
private String url;
@JsonProperty("variables")
private List<Variable> variables = new ArrayList<Variable>();
/**
* No args constructor for use in serialization
*/
public ProcessInstance() {
}
public String getActivityId() {
return activityId;
}
public void setActivityId(String activityId) {
this.activityId = activityId;
}
public ProcessInstance withActivityId(String activityId) {
this.activityId = activityId;
return this;
}
public String getBusinessKey() {
return businessKey;
}
public void setBusinessKey(String businessKey) {
this.businessKey = businessKey;
}
public ProcessInstance withBusinessKey(String businessKey) {
this.businessKey = businessKey;
return this;
}
public Boolean getCompleted() {
return completed;
}
public void setCompleted(Boolean completed) {
this.completed = completed;
}
public ProcessInstance withCompleted(Boolean completed) {
this.completed = completed;
return this;
}
public Boolean getEnded() {
return ended;
}
public void setEnded(Boolean ended) {
this.ended = ended;
}
public ProcessInstance withEnded(Boolean ended) {
this.ended = ended;
return this;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public ProcessInstance withId(String id) {
this.id = id;
return this;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ProcessInstance withName(String name) {
this.name = name;
return this;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
public ProcessInstance withProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
return this;
}
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public void setProcessDefinitionKey(String processDefinitionKey) {
this.processDefinitionKey = processDefinitionKey;
}
public ProcessInstance withProcessDefinitionKey(String processDefinitionKey) {
this.processDefinitionKey = processDefinitionKey;
return this;
}
public Boolean getSuspended() {
return suspended;
}
public void setSuspended(Boolean suspended) {
this.suspended = suspended;
}
public ProcessInstance withSuspended(Boolean suspended) {
this.suspended = suspended;
return this;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public ProcessInstance withTenantId(String tenantId) {
this.tenantId = tenantId;
return this;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public ProcessInstance withUrl(String url) {
this.url = url;
return this;
}
public List<Variable> getVariables() {
return variables;
}
public void setVariables(List<Variable> variables) {
this.variables = variables;
}
public ProcessInstance withVariables(List<Variable> variables) {
this.variables = variables;
return this;
}
}

View File

@ -0,0 +1,84 @@
package com.inteligr8.activiti.model;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SignalEvent {
@JsonProperty("signalName")
private String signal;
@JsonProperty("tenantId")
private String tenantId;
@JsonProperty("async")
private Boolean async;
@JsonProperty("variables")
private List<Variable> variables;
/**
* No args constructor for use in serialization
*/
public SignalEvent() {
}
public SignalEvent(String signal, String tenantId, Boolean async) {
this.signal = signal;
this.tenantId = tenantId;
this.async = async;
}
public String getSignal() {
return signal;
}
public void setSignal(String signal) {
this.signal = signal;
}
public SignalEvent withSignal(String signal) {
this.signal = signal;
return this;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public SignalEvent withTenantId(String tenantId) {
this.tenantId = tenantId;
return this;
}
public Boolean getAsync() {
return async;
}
public void setAsync(Boolean async) {
this.async = async;
}
public SignalEvent withAsync(Boolean async) {
this.async = async;
return this;
}
public List<Variable> getVariables() {
return variables;
}
public void setVariables(List<Variable> variables) {
this.variables = variables;
}
public SignalEvent withVariables(List<Variable> variables) {
this.variables = variables;
return this;
}
}

View File

@ -0,0 +1,36 @@
package com.inteligr8.activiti.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SignalEventAction extends Action {
@JsonProperty("signalName")
private String signal;
/**
* No args constructor for use in serialization
*/
public SignalEventAction() {
}
public SignalEventAction(ActionValue action, String signal) {
super(action);
this.signal = signal;
}
public String getSignal() {
return signal;
}
public void setSignal(String signal) {
this.signal = signal;
}
public SignalEventAction withSignal(String signal) {
this.signal = signal;
return this;
}
}

View File

@ -0,0 +1,12 @@
package com.inteligr8.activiti.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public enum SortOrder {
@JsonProperty("asc")
Ascending,
@JsonProperty("desc")
Descending
}

View File

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

View File

@ -0,0 +1,61 @@
/*
* 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.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import com.inteligr8.alfresco.activiti.model.AppDeployment;
import com.inteligr8.alfresco.activiti.model.ResultListDataRepresentation;
@Path("/api/enterprise")
public interface AppDeploymentsApi {
@GET
@Path("runtime-app-deployment")
@Produces({ "application/json" })
AppDeployment get(
@QueryParam("deploymentId") String deploymentId);
@GET
@Path("runtime-app-deployments/{deploymentId}")
@Produces({ MediaType.APPLICATION_JSON })
AppDeployment get(
@PathParam("deploymentId") long deploymentId);
@DELETE
@Path("runtime-app-deployments/{deploymentId}")
@Produces({ MediaType.APPLICATION_JSON })
void remove(
@PathParam("deploymentId") long deploymentId);
@GET
@Path("runtime-app-deployments")
@Produces({ MediaType.APPLICATION_JSON })
ResultListDataRepresentation<AppDeployment> query(
@QueryParam("nameLike") String nameLike,
@QueryParam("tenantId") Integer tenantId,
@QueryParam("latest") Boolean latest,
@QueryParam("start") Integer start,
@QueryParam("sort") String sort,
@QueryParam("order") String order,
@QueryParam("size") Integer size);
}

View File

@ -0,0 +1,123 @@
package com.inteligr8.alfresco.activiti.model;
import java.time.OffsetDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonFormat.Shape;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.inteligr8.activiti.model.Datum;
/**
* AppDeploymentRepresentation
* <p>
*
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"id",
"appDefinition",
"created",
"createdBy",
"deploymentId",
"dmnDeploymentId"
})
public class AppDeployment extends Datum {
@JsonProperty("id")
private long id;
@JsonProperty("appDefinition")
private AppDefinition appDefinition;
@JsonProperty("created")
@JsonFormat(shape = Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXX")
private OffsetDateTime created;
@JsonProperty("createdBy")
private UserLight createdBy;
@JsonProperty("deploymentId")
private String deploymentId;
@JsonProperty("dmnDeploymentId")
private Long dmnDeploymentId;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public AppDeployment withId(long id) {
this.id = id;
return this;
}
public AppDefinition getAppDefinition() {
return appDefinition;
}
public void setAppDefinition(AppDefinition appDefinition) {
this.appDefinition = appDefinition;
}
public AppDeployment withAppDefinition(AppDefinition appDefinition) {
this.appDefinition = appDefinition;
return this;
}
public OffsetDateTime getCreated() {
return created;
}
public void setCreated(OffsetDateTime created) {
this.created = created;
}
public AppDeployment withCreated(OffsetDateTime created) {
this.created = created;
return this;
}
public UserLight getCreatedBy() {
return createdBy;
}
public void setCreatedBy(UserLight createdBy) {
this.createdBy = createdBy;
}
public AppDeployment withCreatedBy(UserLight createdBy) {
this.createdBy = createdBy;
return this;
}
public String getDeploymentId() {
return deploymentId;
}
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
public AppDeployment withDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
return this;
}
public Long getDmnDeploymentId() {
return dmnDeploymentId;
}
public void setDmnDeploymentId(Long dmnDeploymentId) {
this.dmnDeploymentId = dmnDeploymentId;
}
public AppDeployment withDmnDeploymentId(Long dmnDeploymentId) {
this.dmnDeploymentId = dmnDeploymentId;
return this;
}
}

View File

@ -1,89 +1,8 @@
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 Variable {
@JsonProperty("name")
private String name;
@JsonProperty("scope")
private String scope;
@JsonProperty("type")
private String type;
@JsonProperty("value")
private Object value;
/**
* No args constructor for use in serialization
*/
public Variable() {
}
public Variable(String name, String scope, String type, Object value) {
this.name = name;
this.scope = scope;
this.type = type;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Variable withName(String name) {
this.name = name;
return this;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public Variable withScope(String scope) {
this.scope = scope;
return this;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Variable withType(String type) {
this.type = type;
return this;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
public Variable withValue(Object value) {
this.value = value;
return this;
}
public class Variable extends com.inteligr8.activiti.model.Variable {
}