Commit 6e0e1eaa authored by Brian Long's avatar Brian Long
Browse files

Merge branch 'develop' into stable

parents f4183d78 17515d4b
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -14,7 +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
@@ -30,4 +36,28 @@ public interface ActivitiPublicRestApi {
		return this.getApi(ManagementApi.class);
	}
    
    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);
    }
    
    default ExecutionApi getExecutionApi() {
        return this.getApi(ExecutionApi.class);
    }
    
}
+163 −0
Original line number Diff line number Diff line
/*
 * 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.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<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);

}
+21 −0
Original line number Diff line number Diff line
/*
 * 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 javax.ws.rs.Path;

@Path("/api/management/deadletter-jobs")
public interface DeadletterJobsApi extends BaseJobsApi {
}
+21 −0
Original line number Diff line number Diff line
/*
 * 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 javax.ws.rs.Path;

@Path("/api/management/jobs")
public interface JobsApi extends BaseJobsApi {
}
+0 −153
Original line number Diff line number Diff line
@@ -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 {
@@ -47,145 +35,4 @@ public interface ManagementApi {
    @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<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);
        
    }

}
Loading