diff --git a/src/main/java/com/inteligr8/activiti/ActivitiPublicRestApi.java b/src/main/java/com/inteligr8/activiti/ActivitiPublicRestApi.java index 940c8a8..ae6ac0c 100644 --- a/src/main/java/com/inteligr8/activiti/ActivitiPublicRestApi.java +++ b/src/main/java/com/inteligr8/activiti/ActivitiPublicRestApi.java @@ -14,10 +14,13 @@ */ package com.inteligr8.activiti; +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.ProcessInstanceApi; import com.inteligr8.activiti.api.RuntimeApi; +import com.inteligr8.activiti.api.TimerJobsApi; /** * This interface consolidates the JAX-RS APIs available in the open-source @@ -36,6 +39,18 @@ public interface ActivitiPublicRestApi { default RuntimeApi getRuntimeApi() { return this.getApi(RuntimeApi.class); } + + default JobsApi getJobsApi() { + return this.getApi(JobsApi.class); + } + + default DeadletterJobsApi getDeadletterJobsApi() { + return this.getApi(DeadletterJobsApi.class); + } + + default TimerJobsApi getTimerJobsApi() { + return this.getApi(TimerJobsApi.class); + } default ProcessInstanceApi getProcessInstanceApi() { return this.getApi(ProcessInstanceApi.class); diff --git a/src/main/java/com/inteligr8/activiti/api/BaseJobsApi.java b/src/main/java/com/inteligr8/activiti/api/BaseJobsApi.java new file mode 100644 index 0000000..84ddb65 --- /dev/null +++ b/src/main/java/com/inteligr8/activiti/api/BaseJobsApi.java @@ -0,0 +1,163 @@ +/* + * 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 . + */ +package com.inteligr8.activiti.api; + +import java.io.File; +import java.time.LocalDate; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +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.activiti.model.Action; +import com.inteligr8.activiti.model.Action.ActionValue; +import com.inteligr8.activiti.model.Job; +import com.inteligr8.activiti.model.ResultList; + +public interface BaseJobsApi { + + @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 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 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 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 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 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 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); + +} diff --git a/src/main/java/com/inteligr8/activiti/api/DeadletterJobsApi.java b/src/main/java/com/inteligr8/activiti/api/DeadletterJobsApi.java new file mode 100644 index 0000000..d0c849e --- /dev/null +++ b/src/main/java/com/inteligr8/activiti/api/DeadletterJobsApi.java @@ -0,0 +1,21 @@ +/* + * 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 . + */ +package com.inteligr8.activiti.api; + +import javax.ws.rs.Path; + +@Path("/api/management/deadletter-jobs") +public interface DeadletterJobsApi extends BaseJobsApi { +} diff --git a/src/main/java/com/inteligr8/activiti/api/JobsApi.java b/src/main/java/com/inteligr8/activiti/api/JobsApi.java new file mode 100644 index 0000000..936a2d5 --- /dev/null +++ b/src/main/java/com/inteligr8/activiti/api/JobsApi.java @@ -0,0 +1,21 @@ +/* + * 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 . + */ +package com.inteligr8.activiti.api; + +import javax.ws.rs.Path; + +@Path("/api/management/jobs") +public interface JobsApi extends BaseJobsApi { +} diff --git a/src/main/java/com/inteligr8/activiti/api/ManagementApi.java b/src/main/java/com/inteligr8/activiti/api/ManagementApi.java index 5b9c012..7052ae7 100644 --- a/src/main/java/com/inteligr8/activiti/api/ManagementApi.java +++ b/src/main/java/com/inteligr8/activiti/api/ManagementApi.java @@ -14,25 +14,13 @@ */ package com.inteligr8.activiti.api; -import java.io.File; -import java.time.LocalDate; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; import javax.ws.rs.GET; -import javax.ws.rs.POST; 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.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.Job; -import com.inteligr8.activiti.model.ResultList; @Path("/api/management") public interface ManagementApi { @@ -46,146 +34,5 @@ public interface ManagementApi { @Path("properties") @Produces({ MediaType.APPLICATION_JSON }) public EngineProperties getEngineProperties(); - - - - @Path("jobs") - public interface JobsApiImpl extends JobsApi {} - - @Path("timer-jobs") - public interface TimerJobsApiImpl extends JobsApi {} - - @Path("deadletter-jobs") - public interface DeadletterJobsApiImpl extends JobsApi {} - - 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 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 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 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 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 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 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); - - } } diff --git a/src/main/java/com/inteligr8/activiti/api/TimerJobsApi.java b/src/main/java/com/inteligr8/activiti/api/TimerJobsApi.java new file mode 100644 index 0000000..fdf6553 --- /dev/null +++ b/src/main/java/com/inteligr8/activiti/api/TimerJobsApi.java @@ -0,0 +1,21 @@ +/* + * 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 . + */ +package com.inteligr8.activiti.api; + +import javax.ws.rs.Path; + +@Path("/api/management/timer-jobs") +public interface TimerJobsApi extends BaseJobsApi { +} diff --git a/src/main/java/com/inteligr8/alfresco/activiti/model/Variable.java b/src/main/java/com/inteligr8/alfresco/activiti/model/Variable.java index 4d8e275..8f6b9a9 100644 --- a/src/main/java/com/inteligr8/alfresco/activiti/model/Variable.java +++ b/src/main/java/com/inteligr8/alfresco/activiti/model/Variable.java @@ -4,5 +4,15 @@ import com.fasterxml.jackson.annotation.JsonInclude; @JsonInclude(JsonInclude.Include.NON_NULL) public class Variable extends com.inteligr8.activiti.model.Variable { + + /** + * No args constructor for use in serialization + */ + public Variable() { + } + + public Variable(String name, String scope, String type, Object value) { + super(name, scope, type, value); + } }