You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by bo...@apache.org on 2022/12/18 19:59:33 UTC
[streampipes] 02/04: add checkstyle to streampipes-platform-services
This is an automated email from the ASF dual-hosted git repository.
bossenti pushed a commit to branch chore/checkstyle
in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit 7486c95a279b436f5fa3056d9bcf4b5d444c22d2
Author: bossenti <bo...@posteo.de>
AuthorDate: Sun Dec 18 20:47:00 2022 +0100
add checkstyle to streampipes-platform-services
---
streampipes-platform-services/pom.xml | 11 +-
.../streampipes/ps/DataLakeImageResource.java | 3 +-
.../streampipes/ps/DataLakeMeasureResourceV3.java | 40 +-
.../streampipes/ps/DataLakeMeasureResourceV4.java | 101 ++--
.../apache/streampipes/ps/DataLakeResourceV3.java | 1 +
.../apache/streampipes/ps/DataLakeResourceV4.java | 583 +++++++++++++--------
.../ps/PipelineElementTemplateResource.java | 212 ++++----
7 files changed, 558 insertions(+), 393 deletions(-)
diff --git a/streampipes-platform-services/pom.xml b/streampipes-platform-services/pom.xml
index d797eeda5..f529b5017 100644
--- a/streampipes-platform-services/pom.xml
+++ b/streampipes-platform-services/pom.xml
@@ -17,7 +17,8 @@
~
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>streampipes-parent</artifactId>
<groupId>org.apache.streampipes</groupId>
@@ -60,4 +61,12 @@
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeImageResource.java b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeImageResource.java
index f8a73e077..3c20fc6b8 100644
--- a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeImageResource.java
+++ b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeImageResource.java
@@ -1,4 +1,3 @@
-package org.apache.streampipes.ps;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -17,6 +16,8 @@ package org.apache.streampipes.ps;
*
*/
+package org.apache.streampipes.ps;
+
import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
import org.apache.streampipes.storage.management.StorageDispatcher;
diff --git a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeMeasureResourceV3.java b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeMeasureResourceV3.java
index 877b88451..41858cdba 100644
--- a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeMeasureResourceV3.java
+++ b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeMeasureResourceV3.java
@@ -23,7 +23,11 @@ import org.apache.streampipes.model.schema.EventSchema;
import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
-import javax.ws.rs.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@@ -31,23 +35,23 @@ import javax.ws.rs.core.Response;
@Deprecated
public class DataLakeMeasureResourceV3 extends AbstractAuthGuardedRestResource {
- private DataLakeNoUserManagementV3 dataLakeManagement;
-
- public DataLakeMeasureResourceV3() {
- this.dataLakeManagement = new DataLakeNoUserManagementV3();
+ private DataLakeNoUserManagementV3 dataLakeManagement;
+
+ public DataLakeMeasureResourceV3() {
+ this.dataLakeManagement = new DataLakeNoUserManagementV3();
+ }
+
+ @POST
+ @JacksonSerialized
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/{measure}")
+ public Response addDataLake(@PathParam("measure") String measure, EventSchema eventSchema) {
+ if (this.dataLakeManagement.addDataLake(measure, eventSchema)) {
+ return ok();
+ } else {
+ return Response.status(409).build();
}
- @POST
- @JacksonSerialized
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/{measure}")
- public Response addDataLake(@PathParam("measure") String measure, EventSchema eventSchema) {
- if (this.dataLakeManagement.addDataLake(measure, eventSchema)) {
- return ok();
- } else {
- return Response.status(409).build();
- }
-
- }
+ }
}
diff --git a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeMeasureResourceV4.java b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeMeasureResourceV4.java
index 636cf0c0d..640633172 100644
--- a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeMeasureResourceV4.java
+++ b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeMeasureResourceV4.java
@@ -23,64 +23,71 @@ import org.apache.streampipes.model.datalake.DataLakeMeasure;
import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
-import javax.ws.rs.*;
+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.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/v4/datalake/measure")
public class DataLakeMeasureResourceV4 extends AbstractAuthGuardedRestResource {
- private DataLakeManagementV4 dataLakeManagement;
+ private DataLakeManagementV4 dataLakeManagement;
- public DataLakeMeasureResourceV4() {
- this.dataLakeManagement = new DataLakeManagementV4();
- }
+ public DataLakeMeasureResourceV4() {
+ this.dataLakeManagement = new DataLakeManagementV4();
+ }
- @POST
- @JacksonSerialized
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/")
- public Response addDataLake(DataLakeMeasure dataLakeMeasure) {
- DataLakeMeasure result = this.dataLakeManagement.addDataLake(dataLakeMeasure);
- return ok(result);
- }
+ @POST
+ @JacksonSerialized
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("/")
+ public Response addDataLake(DataLakeMeasure dataLakeMeasure) {
+ DataLakeMeasure result = this.dataLakeManagement.addDataLake(dataLakeMeasure);
+ return ok(result);
+ }
- @GET
- @JacksonSerialized
- @Produces(MediaType.APPLICATION_JSON)
- @Path("{id}")
- public Response getDataLakeMeasure(@PathParam("id") String measureId) {
- return ok(this.dataLakeManagement.getById(measureId));
- }
+ @GET
+ @JacksonSerialized
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("{id}")
+ public Response getDataLakeMeasure(@PathParam("id") String measureId) {
+ return ok(this.dataLakeManagement.getById(measureId));
+ }
- @PUT
- @JacksonSerialized
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("{id}")
- public Response updateDataLakeMeasure(@PathParam("id") String measureId,
- DataLakeMeasure measure) {
- if (measureId.equals(measure.getElementId())) {
- try {
- this.dataLakeManagement.updateDataLake(measure);
- return ok();
- } catch (IllegalArgumentException e) {
- return badRequest(e.getMessage());
- }
- }
- return badRequest();
+ @PUT
+ @JacksonSerialized
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Path("{id}")
+ public Response updateDataLakeMeasure(@PathParam("id") String measureId,
+ DataLakeMeasure measure) {
+ if (measureId.equals(measure.getElementId())) {
+ try {
+ this.dataLakeManagement.updateDataLake(measure);
+ return ok();
+ } catch (IllegalArgumentException e) {
+ return badRequest(e.getMessage());
+ }
}
+ return badRequest();
+ }
- @DELETE
- @JacksonSerialized
- @Path("{id}")
- public Response deleteDataLakeMeasure(@PathParam("id") String measureId) {
- try {
- this.dataLakeManagement.deleteDataLakeMeasure(measureId);
- return ok();
- } catch (IllegalArgumentException e) {
- return badRequest(e.getMessage());
- }
+ @DELETE
+ @JacksonSerialized
+ @Path("{id}")
+ public Response deleteDataLakeMeasure(@PathParam("id") String measureId) {
+ try {
+ this.dataLakeManagement.deleteDataLakeMeasure(measureId);
+ return ok();
+ } catch (IllegalArgumentException e) {
+ return badRequest(e.getMessage());
}
+ }
}
diff --git a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV3.java b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV3.java
index 00fd8c9b7..31d9c4ef1 100644
--- a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV3.java
+++ b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV3.java
@@ -28,6 +28,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+
import java.util.List;
@Path("/v3/datalake")
diff --git a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java
index dd75bd445..955d9e20f 100644
--- a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java
+++ b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java
@@ -18,260 +18,383 @@
package org.apache.streampipes.ps;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.enums.ParameterIn;
-import io.swagger.v3.oas.annotations.media.ArraySchema;
-import io.swagger.v3.oas.annotations.media.Content;
-import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.responses.ApiResponse;
import org.apache.streampipes.dataexplorer.DataLakeManagementV4;
import org.apache.streampipes.dataexplorer.v4.ProvidedQueryParams;
import org.apache.streampipes.dataexplorer.v4.query.writer.OutputFormat;
import org.apache.streampipes.model.StreamPipesErrorMessage;
import org.apache.streampipes.model.datalake.DataLakeConfiguration;
import org.apache.streampipes.model.datalake.DataLakeMeasure;
-import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.model.datalake.DataSeries;
import org.apache.streampipes.model.datalake.SpQueryResult;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.ws.rs.*;
-import javax.ws.rs.core.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+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.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.StreamingOutput;
+import javax.ws.rs.core.UriInfo;
+
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
-import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.*;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_AGGREGATION_FUNCTION;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_AUTO_AGGREGATE;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_COLUMNS;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_COUNT_ONLY;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_CSV_DELIMITER;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_END_DATE;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_FILTER;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_FORMAT;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_GROUP_BY;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_LIMIT;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_MAXIMUM_AMOUNT_OF_EVENTS;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_MISSING_VALUE_BEHAVIOUR;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_OFFSET;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_ORDER;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_PAGE;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_START_DATE;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.QP_TIME_INTERVAL;
+import static org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters.SUPPORTED_PARAMS;
@Path("v4/datalake")
public class DataLakeResourceV4 extends AbstractRestResource {
- private static final Logger logger = LoggerFactory.getLogger(DataLakeResourceV4.class);
-
- private DataLakeManagementV4 dataLakeManagement;
-
- public DataLakeResourceV4() {
- this.dataLakeManagement = new DataLakeManagementV4();
- }
-
- public DataLakeResourceV4(DataLakeManagementV4 dataLakeManagement) {
- this.dataLakeManagement = dataLakeManagement;
- }
-
-
- @POST
- @Path("/configuration")
- @Consumes(MediaType.APPLICATION_JSON)
- @Operation(summary = "Configure the parameters of the data lake", tags = {"Data Lake"},
- responses = {@ApiResponse(responseCode = "200", description = "Configuration was successful")})
- public Response configureMeasurement(@Parameter(in = ParameterIn.QUERY, description = "should any parameter be reset to its default value?") @DefaultValue("false") @QueryParam("resetToDefault") boolean resetToDefault,
- @Parameter(in = ParameterIn.DEFAULT, description = "the configuration parameters") DataLakeConfiguration config) {
- return ok(this.dataLakeManagement.editMeasurementConfiguration(config, resetToDefault));
- }
-
- @DELETE
- @Path("/measurements/{measurementID}")
- @Operation(summary = "Remove data from a single measurement series with given id", tags = {"Data Lake"},
- responses = {
- @ApiResponse(responseCode = "200", description = "Data from measurement series successfully removed"),
- @ApiResponse(responseCode = "400", description = "Measurement series with given id not found")})
- public Response deleteData(@Parameter(in = ParameterIn.PATH, description = "the id of the measurement series", required = true) @PathParam("measurementID") String measurementID
- , @Parameter(in = ParameterIn.QUERY, description = "start date for slicing operation") @QueryParam("startDate") Long startDate
- , @Parameter(in = ParameterIn.QUERY, description = "end date for slicing operation") @QueryParam("endDate") Long endDate) {
-
- SpQueryResult result = this.dataLakeManagement.deleteData(measurementID, startDate, endDate);
+ private static final Logger logger = LoggerFactory.getLogger(DataLakeResourceV4.class);
+
+ private DataLakeManagementV4 dataLakeManagement;
+
+ public DataLakeResourceV4() {
+ this.dataLakeManagement = new DataLakeManagementV4();
+ }
+
+ public DataLakeResourceV4(DataLakeManagementV4 dataLakeManagement) {
+ this.dataLakeManagement = dataLakeManagement;
+ }
+
+
+ @POST
+ @Path("/configuration")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Operation(summary = "Configure the parameters of the data lake", tags = {"Data Lake"},
+ responses = {@ApiResponse(responseCode = "200", description = "Configuration was successful")})
+ public Response configureMeasurement(
+ @Parameter(in = ParameterIn.QUERY, description = "should any parameter be reset to its default value?")
+ @DefaultValue("false") @QueryParam("resetToDefault") boolean resetToDefault,
+ @Parameter(in = ParameterIn.DEFAULT, description = "the configuration parameters") DataLakeConfiguration config) {
+ return ok(this.dataLakeManagement.editMeasurementConfiguration(config, resetToDefault));
+ }
+
+ @DELETE
+ @Path("/measurements/{measurementID}")
+ @Operation(summary = "Remove data from a single measurement series with given id", tags = {"Data Lake"},
+ responses = {
+ @ApiResponse(responseCode = "200", description = "Data from measurement series successfully removed"),
+ @ApiResponse(responseCode = "400", description = "Measurement series with given id not found")})
+ public Response deleteData(
+ @Parameter(in = ParameterIn.PATH, description = "the id of the measurement series", required = true)
+ @PathParam("measurementID") String measurementID
+ , @Parameter(in = ParameterIn.QUERY, description = "start date for slicing operation") @QueryParam("startDate")
+ Long startDate
+ , @Parameter(in = ParameterIn.QUERY, description = "end date for slicing operation") @QueryParam("endDate")
+ Long endDate) {
+
+ SpQueryResult result = this.dataLakeManagement.deleteData(measurementID, startDate, endDate);
+ return ok();
+ }
+
+ @DELETE
+ @Path("/measurements/{measurementID}/drop")
+ @Operation(summary = "Drop a single measurement series with given id from Data Lake and "
+ + "remove related event property",
+ tags = {
+ "Data Lake"},
+ responses = {
+ @ApiResponse(
+ responseCode = "200",
+ description = "Measurement series successfully dropped from Data Lake"),
+ @ApiResponse(
+ responseCode = "400",
+ description = "Measurement series with given id or related event property not found")})
+ public Response dropMeasurementSeries(
+ @Parameter(in = ParameterIn.PATH, description = "the id of the measurement series", required = true)
+ @PathParam("measurementID") String measurementID) {
+
+ boolean isSuccessDataLake = this.dataLakeManagement.removeMeasurement(measurementID);
+
+ if (isSuccessDataLake) {
+ boolean isSuccessEventProperty = this.dataLakeManagement.removeEventProperty(measurementID);
+ if (isSuccessEventProperty) {
return ok();
+ } else {
+ return Response.status(Response.Status.NOT_FOUND)
+ .entity("Event property related to measurement series with given id not found.").build();
+ }
+ } else {
+ return Response.status(Response.Status.NOT_FOUND).entity("Measurement series with given id not found.").build();
}
-
- @DELETE
- @Path("/measurements/{measurementID}/drop")
- @Operation(summary = "Drop a single measurement series with given id from Data Lake and remove related event property", tags = {"Data Lake"},
- responses = {
- @ApiResponse(responseCode = "200", description = "Measurement series successfully dropped from Data Lake"),
- @ApiResponse(responseCode = "400", description = "Measurement series with given id or related event property not found")})
- public Response dropMeasurementSeries(@Parameter(in = ParameterIn.PATH, description = "the id of the measurement series", required = true) @PathParam("measurementID") String measurementID) {
-
- boolean isSuccessDataLake = this.dataLakeManagement.removeMeasurement(measurementID);
-
- if (isSuccessDataLake) {
- boolean isSuccessEventProperty = this.dataLakeManagement.removeEventProperty(measurementID);
- if (isSuccessEventProperty) {
- return ok();
- } else {
- return Response.status(Response.Status.NOT_FOUND).entity("Event property related to measurement series with given id not found.").build();
- }
- } else {
- return Response.status(Response.Status.NOT_FOUND).entity("Measurement series with given id not found.").build();
- }
- }
-
- @GET
- @Path("/measurements")
- @Produces(MediaType.APPLICATION_JSON)
- @Operation(summary = "Get a list of all measurement series", tags = {"Data Lake"},
- responses = {
- @ApiResponse(responseCode = "200", description = "array of stored measurement series", content = @Content(array = @ArraySchema(schema = @Schema(implementation = DataLakeMeasure.class))))})
- public Response getAll() {
- List<DataLakeMeasure> allMeasurements = this.dataLakeManagement.getAllMeasurements();
- return ok(allMeasurements);
- }
-
- @GET
- @Path("/measurements/{measurementId}/tags")
- @Produces(MediaType.APPLICATION_JSON)
- public Response getTagValues(@PathParam("measurementId") String measurementId,
- @QueryParam("fields") String fields) {
- Map<String, Object> tagValues = dataLakeManagement.getTagValues(measurementId, fields);
- return ok(tagValues);
- }
-
-
- @GET
- @Path("/measurements/{measurementID}")
- @Produces(MediaType.APPLICATION_JSON)
- @Operation(summary = "Get data from a single measurement series by a given id", tags = {"Data Lake"},
- responses = {
- @ApiResponse(responseCode = "400", description = "Measurement series with given id and requested query specification not found"),
- @ApiResponse(responseCode = "200", description = "requested data", content = @Content(schema = @Schema(implementation = DataSeries.class)))})
- public Response getData(@Parameter(in = ParameterIn.PATH, description = "the id of the measurement series", required = true) @PathParam("measurementID") String measurementID
- , @Parameter(in = ParameterIn.QUERY, description = "the columns to be selected (comma-separated)") @QueryParam(QP_COLUMNS) String columns
- , @Parameter(in = ParameterIn.QUERY, description = "start date for slicing operation") @QueryParam(QP_START_DATE) Long startDate
- , @Parameter(in = ParameterIn.QUERY, description = "end date for slicing operation") @QueryParam(QP_END_DATE) Long endDate
- , @Parameter(in = ParameterIn.QUERY, description = "page number for paging operation") @QueryParam(QP_PAGE) Integer page
- , @Parameter(in = ParameterIn.QUERY, description = "maximum number of retrieved query results") @QueryParam(QP_LIMIT) Integer limit
- , @Parameter(in = ParameterIn.QUERY, description = "offset") @QueryParam(QP_OFFSET) Integer offset
- , @Parameter(in = ParameterIn.QUERY, description = "grouping tags (comma-separated) for grouping operation") @QueryParam(QP_GROUP_BY) String groupBy
- , @Parameter(in = ParameterIn.QUERY, description = "ordering of retrieved query results (ASC or DESC - default is ASC)") @QueryParam(QP_ORDER) String order
- , @Parameter(in = ParameterIn.QUERY, description = "name of aggregation function used for grouping operation") @QueryParam(QP_AGGREGATION_FUNCTION) String aggregationFunction
- , @Parameter(in = ParameterIn.QUERY, description = "time interval for aggregation (e.g. 1m - one minute) for grouping operation") @QueryParam(QP_TIME_INTERVAL) String timeInterval
- , @Parameter(in = ParameterIn.QUERY, description = "only return the number of results") @QueryParam(QP_COUNT_ONLY) String countOnly
- , @Parameter(in = ParameterIn.QUERY, description = "auto-aggregate the number of results to avoid browser overload") @QueryParam(QP_AUTO_AGGREGATE) boolean autoAggregate
- , @Parameter(in = ParameterIn.QUERY, description = "filter conditions (a comma-separated list of filter conditions such as [field,operator,condition])") @QueryParam(QP_FILTER) String filter
- , @Parameter(in = ParameterIn.QUERY, description = "missingValueBehaviour (ignore or empty)") @QueryParam(QP_MISSING_VALUE_BEHAVIOUR) String missingValueBehaviour
- , @Parameter(in = ParameterIn.QUERY, description = "the maximum amount of resulting events, when too high the query status is set to TOO_MUCH_DATA") @QueryParam(QP_MAXIMUM_AMOUNT_OF_EVENTS) Integer maximumAmountOfResults
- , @Context UriInfo uriInfo) {
-
- MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
-
- if (!(checkProvidedQueryParams(queryParams))) {
- return badRequest();
- } else {
- ProvidedQueryParams sanitizedParams = populate(measurementID, queryParams);
- try {
- SpQueryResult result =
- this.dataLakeManagement.getData(sanitizedParams, isIgnoreMissingValues(missingValueBehaviour));
- return ok(result);
- } catch (RuntimeException e) {
- return badRequest(StreamPipesErrorMessage.from(e));
- }
- }
- }
-
- @POST
- @Path("/query")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response getData(List<Map<String, String>> queryParams) {
- var results = queryParams
- .stream()
- .map(qp -> new ProvidedQueryParams(qp.get("measureName"), qp))
- .map(params -> this.dataLakeManagement.getData(params, true))
- .collect(Collectors.toList());
-
- return ok(results);
- }
-
- @GET
- @Path("/measurements/{measurementID}/download")
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
- @Operation(summary = "Download data from a single measurement series by a given id", tags = {"Data Lake"},
- responses = {
- @ApiResponse(responseCode = "400", description = "Measurement series with given id and requested query specification not found"),
- @ApiResponse(responseCode = "200", description = "requested data", content = @Content(schema = @Schema(implementation = DataSeries.class)))})
- public Response downloadData(@Parameter(in = ParameterIn.PATH, description = "the id of the measurement series", required = true) @PathParam("measurementID") String measurementID
- , @Parameter(in = ParameterIn.QUERY, description = "the columns to be selected (comma-separated)") @QueryParam(QP_COLUMNS) String columns
- , @Parameter(in = ParameterIn.QUERY, description = "start date for slicing operation") @QueryParam(QP_START_DATE) Long startDate
- , @Parameter(in = ParameterIn.QUERY, description = "end date for slicing operation") @QueryParam(QP_END_DATE) Long endDate
- , @Parameter(in = ParameterIn.QUERY, description = "page number for paging operation") @QueryParam(QP_PAGE) Integer page
- , @Parameter(in = ParameterIn.QUERY, description = "maximum number of retrieved query results") @QueryParam(QP_LIMIT) Integer limit
- , @Parameter(in = ParameterIn.QUERY, description = "offset") @QueryParam(QP_OFFSET) Integer offset
- , @Parameter(in = ParameterIn.QUERY, description = "grouping tags (comma-separated) for grouping operation") @QueryParam(QP_GROUP_BY) String groupBy
- , @Parameter(in = ParameterIn.QUERY, description = "ordering of retrieved query results (ASC or DESC - default is ASC)") @QueryParam(QP_ORDER) String order
- , @Parameter(in = ParameterIn.QUERY, description = "name of aggregation function used for grouping operation") @QueryParam(QP_AGGREGATION_FUNCTION) String aggregationFunction
- , @Parameter(in = ParameterIn.QUERY, description = "time interval for aggregation (e.g. 1m - one minute) for grouping operation") @QueryParam(QP_TIME_INTERVAL) String timeInterval
- , @Parameter(in = ParameterIn.QUERY, description = "format specification (csv, json - default is csv) for data download") @QueryParam(QP_FORMAT) String format
- , @Parameter(in = ParameterIn.QUERY, description = "csv delimiter (comma or semicolon)") @QueryParam(QP_CSV_DELIMITER) String csvDelimiter
- , @Parameter(in = ParameterIn.QUERY, description = "missingValueBehaviour (ignore or empty)") @QueryParam(QP_MISSING_VALUE_BEHAVIOUR) String missingValueBehaviour
- , @Parameter(in = ParameterIn.QUERY, description = "filter conditions (a comma-separated list of filter conditions such as [field,operator,condition])") @QueryParam(QP_FILTER) String filter
- , @Context UriInfo uriInfo) {
-
- MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
-
- if (!(checkProvidedQueryParams(queryParams))) {
- return badRequest();
- } else {
- ProvidedQueryParams sanitizedParams = populate(measurementID, queryParams);
- if (format == null) {
- format = "csv";
- }
-
- OutputFormat outputFormat = format.equals("csv") ? OutputFormat.CSV : OutputFormat.JSON;
- StreamingOutput streamingOutput = output -> dataLakeManagement.getDataAsStream(
- sanitizedParams,
- outputFormat,
- isIgnoreMissingValues(missingValueBehaviour),
- output);
-
- return Response.ok(streamingOutput, MediaType.APPLICATION_OCTET_STREAM).
- header("Content-Disposition", "attachment; filename=\"datalake." + outputFormat + "\"")
- .build();
- }
- }
-
-
- @GET
- @Path("/configuration")
- @Produces(MediaType.APPLICATION_JSON)
- @Operation(summary = "Get the configuration parameters of the data lake", tags = {"Data Lake"},
- responses = {
- @ApiResponse(responseCode = "200", description = "configuration parameters", content = @Content(schema = @Schema(implementation = DataLakeConfiguration.class)))})
- public Response getMeasurementConfiguration(@Parameter(in = ParameterIn.QUERY, description = "the id of a specific configuration parameter") @QueryParam("parameterID") String parameterID) {
- return ok(this.dataLakeManagement.getDataLakeConfiguration());
- }
-
- @DELETE
- @Path("/measurements")
- @Operation(summary = "Remove all stored measurement series from Data Lake", tags = {"Data Lake"},
- responses = {
- @ApiResponse(responseCode = "200", description = "All measurement series successfully removed")})
- public Response removeAll() {
- boolean isSuccess = this.dataLakeManagement.removeAllMeasurements();
- return Response.ok(isSuccess).build();
- }
-
- private boolean checkProvidedQueryParams(MultivaluedMap<String, String> providedParams) {
- return SUPPORTED_PARAMS.containsAll(providedParams.keySet());
+ }
+
+ @GET
+ @Path("/measurements")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(summary = "Get a list of all measurement series", tags = {"Data Lake"},
+ responses = {
+ @ApiResponse(
+ responseCode = "200",
+ description = "array of stored measurement series",
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = DataLakeMeasure.class))))})
+ public Response getAll() {
+ List<DataLakeMeasure> allMeasurements = this.dataLakeManagement.getAllMeasurements();
+ return ok(allMeasurements);
+ }
+
+ @GET
+ @Path("/measurements/{measurementId}/tags")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getTagValues(@PathParam("measurementId") String measurementId,
+ @QueryParam("fields") String fields) {
+ Map<String, Object> tagValues = dataLakeManagement.getTagValues(measurementId, fields);
+ return ok(tagValues);
+ }
+
+
+ @GET
+ @Path("/measurements/{measurementID}")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(summary = "Get data from a single measurement series by a given id", tags = {"Data Lake"},
+ responses = {
+ @ApiResponse(
+ responseCode = "400",
+ description = "Measurement series with given id and requested query specification not found"),
+ @ApiResponse(
+ responseCode = "200",
+ description = "requested data", content = @Content(schema = @Schema(implementation = DataSeries.class)))})
+ public Response getData(
+ @Parameter(in = ParameterIn.PATH, description = "the id of the measurement series", required = true)
+ @PathParam("measurementID") String measurementID
+ , @Parameter(in = ParameterIn.QUERY, description = "the columns to be selected (comma-separated)")
+ @QueryParam(QP_COLUMNS) String columns
+ , @Parameter(in = ParameterIn.QUERY, description = "start date for slicing operation") @QueryParam(QP_START_DATE)
+ Long startDate
+ , @Parameter(in = ParameterIn.QUERY, description = "end date for slicing operation") @QueryParam(QP_END_DATE)
+ Long endDate
+ , @Parameter(in = ParameterIn.QUERY, description = "page number for paging operation") @QueryParam(QP_PAGE)
+ Integer page
+ , @Parameter(in = ParameterIn.QUERY, description = "maximum number of retrieved query results")
+ @QueryParam(QP_LIMIT) Integer limit
+ , @Parameter(in = ParameterIn.QUERY, description = "offset") @QueryParam(QP_OFFSET) Integer offset
+ , @Parameter(in = ParameterIn.QUERY, description = "grouping tags (comma-separated) for grouping operation")
+ @QueryParam(QP_GROUP_BY) String groupBy
+ ,
+ @Parameter(
+ in = ParameterIn.QUERY,
+ description = "ordering of retrieved query results (ASC or DESC - default is ASC)")
+ @QueryParam(QP_ORDER) String order
+ , @Parameter(in = ParameterIn.QUERY, description = "name of aggregation function used for grouping operation")
+ @QueryParam(QP_AGGREGATION_FUNCTION) String aggregationFunction
+ ,
+ @Parameter(
+ in = ParameterIn.QUERY,
+ description = "time interval for aggregation (e.g. 1m - one minute) for grouping operation")
+ @QueryParam(QP_TIME_INTERVAL) String timeInterval
+ , @Parameter(in = ParameterIn.QUERY, description = "only return the number of results") @QueryParam(QP_COUNT_ONLY)
+ String countOnly
+ ,
+ @Parameter(in = ParameterIn.QUERY, description = "auto-aggregate the number of results to avoid browser overload")
+ @QueryParam(QP_AUTO_AGGREGATE) boolean autoAggregate
+ ,
+ @Parameter(
+ in = ParameterIn.QUERY,
+ description = "filter conditions (a comma-separated list of filter conditions"
+ + "such as [field,operator,condition])")
+ @QueryParam(QP_FILTER) String filter
+ , @Parameter(in = ParameterIn.QUERY, description = "missingValueBehaviour (ignore or empty)")
+ @QueryParam(QP_MISSING_VALUE_BEHAVIOUR) String missingValueBehaviour
+ ,
+ @Parameter(
+ in = ParameterIn.QUERY,
+ description = "the maximum amount of resulting events,"
+ + "when too high the query status is set to TOO_MUCH_DATA")
+ @QueryParam(QP_MAXIMUM_AMOUNT_OF_EVENTS) Integer maximumAmountOfResults
+ , @Context UriInfo uriInfo) {
+
+ MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
+
+ if (!(checkProvidedQueryParams(queryParams))) {
+ return badRequest();
+ } else {
+ ProvidedQueryParams sanitizedParams = populate(measurementID, queryParams);
+ try {
+ SpQueryResult result =
+ this.dataLakeManagement.getData(sanitizedParams, isIgnoreMissingValues(missingValueBehaviour));
+ return ok(result);
+ } catch (RuntimeException e) {
+ return badRequest(StreamPipesErrorMessage.from(e));
+ }
}
-
- private ProvidedQueryParams populate(String measurementId, MultivaluedMap<String, String> rawParams) {
- Map<String, String> queryParamMap = new HashMap<>();
- rawParams.forEach((key, value) -> queryParamMap.put(key, String.join(",", value)));
-
- return new ProvidedQueryParams(measurementId, queryParamMap);
+ }
+
+ @POST
+ @Path("/query")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Response getData(List<Map<String, String>> queryParams) {
+ var results = queryParams
+ .stream()
+ .map(qp -> new ProvidedQueryParams(qp.get("measureName"), qp))
+ .map(params -> this.dataLakeManagement.getData(params, true))
+ .collect(Collectors.toList());
+
+ return ok(results);
+ }
+
+ @GET
+ @Path("/measurements/{measurementID}/download")
+ @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @Operation(summary = "Download data from a single measurement series by a given id", tags = {"Data Lake"},
+ responses = {
+ @ApiResponse(
+ responseCode = "400",
+ description = "Measurement series with given id and requested query specification not found"),
+ @ApiResponse(
+ responseCode = "200",
+ description = "requested data", content = @Content(schema = @Schema(implementation = DataSeries.class)))})
+ public Response downloadData(
+ @Parameter(in = ParameterIn.PATH, description = "the id of the measurement series", required = true)
+ @PathParam("measurementID") String measurementID
+ , @Parameter(in = ParameterIn.QUERY, description = "the columns to be selected (comma-separated)")
+ @QueryParam(QP_COLUMNS) String columns
+ , @Parameter(in = ParameterIn.QUERY, description = "start date for slicing operation") @QueryParam(QP_START_DATE)
+ Long startDate
+ , @Parameter(in = ParameterIn.QUERY, description = "end date for slicing operation") @QueryParam(QP_END_DATE)
+ Long endDate
+ , @Parameter(in = ParameterIn.QUERY, description = "page number for paging operation") @QueryParam(QP_PAGE)
+ Integer page
+ , @Parameter(in = ParameterIn.QUERY, description = "maximum number of retrieved query results")
+ @QueryParam(QP_LIMIT) Integer limit
+ , @Parameter(in = ParameterIn.QUERY, description = "offset") @QueryParam(QP_OFFSET) Integer offset
+ , @Parameter(in = ParameterIn.QUERY, description = "grouping tags (comma-separated) for grouping operation")
+ @QueryParam(QP_GROUP_BY) String groupBy
+ ,
+ @Parameter(
+ in = ParameterIn.QUERY,
+ description = "ordering of retrieved query results (ASC or DESC - default is ASC)")
+ @QueryParam(QP_ORDER) String order
+ , @Parameter(in = ParameterIn.QUERY, description = "name of aggregation function used for grouping operation")
+ @QueryParam(QP_AGGREGATION_FUNCTION) String aggregationFunction
+ ,
+ @Parameter(
+ in = ParameterIn.QUERY,
+ description = "time interval for aggregation (e.g. 1m - one minute) for grouping operation")
+ @QueryParam(QP_TIME_INTERVAL) String timeInterval
+ ,
+ @Parameter(
+ in = ParameterIn.QUERY,
+ description = "format specification (csv, json - default is csv) for data download")
+ @QueryParam(QP_FORMAT) String format
+ , @Parameter(in = ParameterIn.QUERY, description = "csv delimiter (comma or semicolon)")
+ @QueryParam(QP_CSV_DELIMITER) String csvDelimiter
+ , @Parameter(in = ParameterIn.QUERY, description = "missingValueBehaviour (ignore or empty)")
+ @QueryParam(QP_MISSING_VALUE_BEHAVIOUR) String missingValueBehaviour
+ ,
+ @Parameter(
+ in = ParameterIn.QUERY,
+ description = "filter conditions (a comma-separated list of filter conditions"
+ + "such as [field,operator,condition])")
+ @QueryParam(QP_FILTER) String filter
+ , @Context UriInfo uriInfo) {
+
+ MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
+
+ if (!(checkProvidedQueryParams(queryParams))) {
+ return badRequest();
+ } else {
+ ProvidedQueryParams sanitizedParams = populate(measurementID, queryParams);
+ if (format == null) {
+ format = "csv";
+ }
+
+ OutputFormat outputFormat = format.equals("csv") ? OutputFormat.CSV : OutputFormat.JSON;
+ StreamingOutput streamingOutput = output -> dataLakeManagement.getDataAsStream(
+ sanitizedParams,
+ outputFormat,
+ isIgnoreMissingValues(missingValueBehaviour),
+ output);
+
+ return Response.ok(streamingOutput, MediaType.APPLICATION_OCTET_STREAM).
+ header("Content-Disposition", "attachment; filename=\"datalake." + outputFormat + "\"")
+ .build();
}
-
- // Checks if the parameter for missing value behaviour is set
- private boolean isIgnoreMissingValues(String missingValueBehaviour) {
- boolean ignoreMissingValues;
- if ("ignore".equals(missingValueBehaviour)) {
- ignoreMissingValues = true;
- } else {
- ignoreMissingValues = false;
- }
- return ignoreMissingValues;
+ }
+
+
+ @GET
+ @Path("/configuration")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(summary = "Get the configuration parameters of the data lake", tags = {"Data Lake"},
+ responses = {
+ @ApiResponse(
+ responseCode = "200",
+ description = "configuration parameters",
+ content = @Content(schema = @Schema(implementation = DataLakeConfiguration.class)))})
+ public Response getMeasurementConfiguration(
+ @Parameter(in = ParameterIn.QUERY, description = "the id of a specific configuration parameter")
+ @QueryParam("parameterID") String parameterID) {
+ return ok(this.dataLakeManagement.getDataLakeConfiguration());
+ }
+
+ @DELETE
+ @Path("/measurements")
+ @Operation(summary = "Remove all stored measurement series from Data Lake", tags = {"Data Lake"},
+ responses = {
+ @ApiResponse(responseCode = "200", description = "All measurement series successfully removed")})
+ public Response removeAll() {
+ boolean isSuccess = this.dataLakeManagement.removeAllMeasurements();
+ return Response.ok(isSuccess).build();
+ }
+
+ private boolean checkProvidedQueryParams(MultivaluedMap<String, String> providedParams) {
+ return SUPPORTED_PARAMS.containsAll(providedParams.keySet());
+ }
+
+ private ProvidedQueryParams populate(String measurementId, MultivaluedMap<String, String> rawParams) {
+ Map<String, String> queryParamMap = new HashMap<>();
+ rawParams.forEach((key, value) -> queryParamMap.put(key, String.join(",", value)));
+
+ return new ProvidedQueryParams(measurementId, queryParamMap);
+ }
+
+ // Checks if the parameter for missing value behaviour is set
+ private boolean isIgnoreMissingValues(String missingValueBehaviour) {
+ boolean ignoreMissingValues;
+ if ("ignore".equals(missingValueBehaviour)) {
+ ignoreMissingValues = true;
+ } else {
+ ignoreMissingValues = false;
}
+ return ignoreMissingValues;
+ }
}
diff --git a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/PipelineElementTemplateResource.java b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/PipelineElementTemplateResource.java
index d159e2e46..79c577d75 100644
--- a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/PipelineElementTemplateResource.java
+++ b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/PipelineElementTemplateResource.java
@@ -17,13 +17,6 @@
*/
package org.apache.streampipes.ps;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.media.ArraySchema;
-import io.swagger.v3.oas.annotations.media.Content;
-import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.parameters.RequestBody;
-import io.swagger.v3.oas.annotations.responses.ApiResponse;
import org.apache.streampipes.manager.template.AdapterTemplateHandler;
import org.apache.streampipes.manager.template.DataProcessorTemplateHandler;
import org.apache.streampipes.manager.template.DataSinkTemplateHandler;
@@ -34,7 +27,23 @@ import org.apache.streampipes.model.template.PipelineElementTemplate;
import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
-import javax.ws.rs.*;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.parameters.RequestBody;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+
+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 javax.ws.rs.core.Response;
@@ -45,14 +54,14 @@ public class PipelineElementTemplateResource extends AbstractRestResource {
@Produces(MediaType.APPLICATION_JSON)
@JacksonSerialized
@Operation(summary = "Get a list of all pipeline element templates",
- tags = {"Pipeline Element Templates"},
- responses = {
- @ApiResponse(content = {
- @Content(
- mediaType = "application/json",
- array = @ArraySchema(schema = @Schema(implementation = PipelineElementTemplate.class)))
- })
+ tags = {"Pipeline Element Templates"},
+ responses = {
+ @ApiResponse(content = {
+ @Content(
+ mediaType = "application/json",
+ array = @ArraySchema(schema = @Schema(implementation = PipelineElementTemplate.class)))
})
+ })
public Response getAll(@Parameter(description = "Filter all templates by this appId")
@QueryParam("appId") String appId) {
if (appId == null) {
@@ -67,15 +76,15 @@ public class PipelineElementTemplateResource extends AbstractRestResource {
@Produces(MediaType.APPLICATION_JSON)
@JacksonSerialized
@Operation(summary = "Get a single pipeline element template by a given id",
- tags = {"Pipeline Element Templates"},
- responses = {
- @ApiResponse(content = {
- @Content(
- mediaType = "application/json",
- schema = @Schema(implementation = PipelineElementTemplate.class))
- }),
- @ApiResponse(responseCode = "400", description = "Template with given id not found")
- })
+ tags = {"Pipeline Element Templates"},
+ responses = {
+ @ApiResponse(content = {
+ @Content(
+ mediaType = "application/json",
+ schema = @Schema(implementation = PipelineElementTemplate.class))
+ }),
+ @ApiResponse(responseCode = "400", description = "Template with given id not found")
+ })
public Response getById(@Parameter(description = "The id of the pipeline element template", required = true)
@PathParam("id") String s) {
try {
@@ -89,12 +98,13 @@ public class PipelineElementTemplateResource extends AbstractRestResource {
@Consumes(MediaType.APPLICATION_JSON)
@JacksonSerialized
@Operation(summary = "Store a new pipeline element template",
- tags = {"Pipeline Element Templates"},
- responses = {
- @ApiResponse(responseCode = "200", description = "Template successfully stored")
- })
+ tags = {"Pipeline Element Templates"},
+ responses = {
+ @ApiResponse(responseCode = "200", description = "Template successfully stored")
+ })
public Response create(@RequestBody(description = "The pipeline element template to be stored",
- content = @Content(schema = @Schema(implementation = PipelineElementTemplate.class))) PipelineElementTemplate entity) {
+ content = @Content(schema = @Schema(implementation = PipelineElementTemplate.class)))
+ PipelineElementTemplate entity) {
getPipelineElementTemplateStorage().createElement(entity);
return ok();
}
@@ -105,15 +115,15 @@ public class PipelineElementTemplateResource extends AbstractRestResource {
@Consumes(MediaType.APPLICATION_JSON)
@JacksonSerialized
@Operation(summary = "Update a pipeline element template",
- tags = {"Pipeline Element Templates"},
- responses = {
- @ApiResponse(content = {
- @Content(
- mediaType = "application/json",
- schema = @Schema(implementation = PipelineElementTemplate.class))
- }, responseCode = "200", description = "Template successfully updated"),
- @ApiResponse(responseCode = "400", description = "Template with given id not found")
- })
+ tags = {"Pipeline Element Templates"},
+ responses = {
+ @ApiResponse(content = {
+ @Content(
+ mediaType = "application/json",
+ schema = @Schema(implementation = PipelineElementTemplate.class))
+ }, responseCode = "200", description = "Template successfully updated"),
+ @ApiResponse(responseCode = "400", description = "Template with given id not found")
+ })
public Response update(@Parameter(description = "The id of the pipeline element template", required = true)
@PathParam("id") String id, PipelineElementTemplate entity) {
try {
@@ -130,11 +140,11 @@ public class PipelineElementTemplateResource extends AbstractRestResource {
@DELETE
@Path("{id}")
@Operation(summary = "Delete a pipeline element template by a given id",
- tags = {"Pipeline Element Templates"},
- responses = {
- @ApiResponse(responseCode = "200", description = "Pipeline element template successfully deleted"),
- @ApiResponse(responseCode = "400", description = "Template with given id not found")
- })
+ tags = {"Pipeline Element Templates"},
+ responses = {
+ @ApiResponse(responseCode = "200", description = "Pipeline element template successfully deleted"),
+ @ApiResponse(responseCode = "400", description = "Template with given id not found")
+ })
public Response delete(@Parameter(description = "The id of the pipeline element template", required = true)
@PathParam("id") String s) {
PipelineElementTemplate template = getPipelineElementTemplateStorage().getElementById(s);
@@ -148,25 +158,29 @@ public class PipelineElementTemplateResource extends AbstractRestResource {
@Consumes(MediaType.APPLICATION_JSON)
@JacksonSerialized
@Operation(summary = "Configure a data sink with a pipeline element template.",
- tags = {"Pipeline Element Templates"},
- responses = {
- @ApiResponse(content = {
- @Content(
- mediaType = "application/json",
- schema = @Schema(implementation = DataSinkInvocation.class))
- }, responseCode = "200", description = "The configured data sink invocation model"),
- })
- public Response getPipelineElementForTemplate(@Parameter(description = "The id of the pipeline element template", required = true)
- @PathParam("id") String id,
-
- @Parameter(description = "Overwrite the name and description of the pipeline element with the labels given in the pipeline element template")
- @QueryParam("overwriteNames") String overwriteNameAndDescription,
-
- @RequestBody(description = "The data sink invocation that should be configured with the template contents",
- content = @Content(schema = @Schema(implementation = DataSinkInvocation.class))) DataSinkInvocation invocation) {
+ tags = {"Pipeline Element Templates"},
+ responses = {
+ @ApiResponse(content = {
+ @Content(
+ mediaType = "application/json",
+ schema = @Schema(implementation = DataSinkInvocation.class))
+ }, responseCode = "200", description = "The configured data sink invocation model"),
+ })
+ public Response getPipelineElementForTemplate(
+ @Parameter(description = "The id of the pipeline element template", required = true)
+ @PathParam("id") String id,
+
+ @Parameter(
+ description = "Overwrite the name and description of the pipeline element"
+ + "with the labels given in the pipeline element template")
+ @QueryParam("overwriteNames") String overwriteNameAndDescription,
+
+ @RequestBody(description = "The data sink invocation that should be configured with the template contents",
+ content = @Content(schema = @Schema(implementation = DataSinkInvocation.class)))
+ DataSinkInvocation invocation) {
PipelineElementTemplate template = getPipelineElementTemplateStorage().getElementById(id);
return ok(new DataSinkTemplateHandler(template, invocation, Boolean.parseBoolean(overwriteNameAndDescription))
- .applyTemplateOnPipelineElement());
+ .applyTemplateOnPipelineElement());
}
@POST
@@ -175,26 +189,28 @@ public class PipelineElementTemplateResource extends AbstractRestResource {
@Consumes(MediaType.APPLICATION_JSON)
@JacksonSerialized
@Operation(summary = "Configure a data processor with a pipeline element template.",
- tags = {"Pipeline Element Templates"},
- responses = {
- @ApiResponse(content = {
- @Content(
- mediaType = "application/json",
- schema = @Schema(implementation = DataProcessorInvocation.class))
- }, responseCode = "200", description = "The configured data processor invocation model"),
- })
- public Response getPipelineElementForTemplate(@Parameter(description = "The id of the pipeline element template", required = true)
- @PathParam("id") String id,
-
- @Parameter(description = "Overwrite the name and description of the pipeline element with the labels given in the pipeline element template")
- @QueryParam("overwriteNames") String overwriteNameAndDescription,
-
- @RequestBody(description = "The data processor invocation that should be configured with the template contents",
- content = @Content(schema = @Schema(implementation = DataProcessorInvocation.class)))
- DataProcessorInvocation invocation) {
+ tags = {"Pipeline Element Templates"},
+ responses = {
+ @ApiResponse(content = {
+ @Content(
+ mediaType = "application/json",
+ schema = @Schema(implementation = DataProcessorInvocation.class))
+ }, responseCode = "200", description = "The configured data processor invocation model"),
+ })
+ public Response getPipelineElementForTemplate(
+ @Parameter(description = "The id of the pipeline element template", required = true)
+ @PathParam("id") String id,
+
+ @Parameter(description = "Overwrite the name and description of the pipeline element with"
+ + "the labels given in the pipeline element template")
+ @QueryParam("overwriteNames") String overwriteNameAndDescription,
+
+ @RequestBody(description = "The data processor invocation that should be configured with the template contents",
+ content = @Content(schema = @Schema(implementation = DataProcessorInvocation.class)))
+ DataProcessorInvocation invocation) {
PipelineElementTemplate template = getPipelineElementTemplateStorage().getElementById(id);
return ok(new DataProcessorTemplateHandler(template, invocation, Boolean.parseBoolean(overwriteNameAndDescription))
- .applyTemplateOnPipelineElement());
+ .applyTemplateOnPipelineElement());
}
@POST
@@ -203,25 +219,29 @@ public class PipelineElementTemplateResource extends AbstractRestResource {
@Consumes(MediaType.APPLICATION_JSON)
@JacksonSerialized
@Operation(summary = "Configure an adapter with a pipeline element template.",
- tags = {"Pipeline Element Templates"},
- responses = {
- @ApiResponse(content = {
- @Content(
- mediaType = "application/json",
- schema = @Schema(implementation = AdapterDescription.class))
- }, responseCode = "200", description = "The configured adapter model"),
- })
- public Response getPipelineElementForTemplate(@Parameter(description = "The id of the pipeline element template", required = true)
- @PathParam("id") String id,
-
- @Parameter(description = "Overwrite the name and description of the pipeline element with the labels given in the pipeline element template")
- @QueryParam("overwriteNames") String overwriteNameAndDescription,
-
- @RequestBody(description = "The adapter that should be configured with the template contents",
- content = @Content(schema = @Schema(implementation = AdapterDescription.class))) AdapterDescription adapterDescription) {
+ tags = {"Pipeline Element Templates"},
+ responses = {
+ @ApiResponse(content = {
+ @Content(
+ mediaType = "application/json",
+ schema = @Schema(implementation = AdapterDescription.class))
+ }, responseCode = "200", description = "The configured adapter model"),
+ })
+ public Response getPipelineElementForTemplate(
+ @Parameter(description = "The id of the pipeline element template", required = true)
+ @PathParam("id") String id,
+
+ @Parameter(description = "Overwrite the name and description of the pipeline element"
+ + "with the labels given in the pipeline element template")
+ @QueryParam("overwriteNames") String overwriteNameAndDescription,
+
+ @RequestBody(description = "The adapter that should be configured with the template contents",
+ content = @Content(schema = @Schema(implementation = AdapterDescription.class)))
+ AdapterDescription adapterDescription) {
PipelineElementTemplate template = getPipelineElementTemplateStorage().getElementById(id);
- var desc = new AdapterTemplateHandler(template, adapterDescription, Boolean.parseBoolean(overwriteNameAndDescription))
- .applyTemplateOnPipelineElement();
+ var desc =
+ new AdapterTemplateHandler(template, adapterDescription, Boolean.parseBoolean(overwriteNameAndDescription))
+ .applyTemplateOnPipelineElement();
return ok(desc);
}
}