You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by eb...@apache.org on 2020/05/13 10:37:26 UTC

[incubator-streampipes] 01/09: Add endpoint for updating labels in database

This is an automated email from the ASF dual-hosted git repository.

ebi pushed a commit to branch timeseries-labeling
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit 215163efeffd730196059301f74302cdc78431f6
Author: Daniel Ebi <eb...@fzi.de>
AuthorDate: Wed May 13 09:27:05 2020 +0200

    Add endpoint for updating labels in database
---
 .../rest/impl/datalake/DataLakeResourceV3.java     | 24 +++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
index 2eb79f9..f845cbb 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
@@ -26,16 +26,17 @@ import org.apache.streampipes.rest.impl.datalake.model.DataResult;
 import org.apache.streampipes.rest.impl.datalake.model.GroupedDataResult;
 import org.apache.streampipes.rest.impl.datalake.model.PageResult;
 import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
+import org.influxdb.InfluxDB;
+import org.influxdb.dto.Point;
 
 import java.io.IOException;
 import java.text.ParseException;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
-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.*;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
@@ -156,6 +157,7 @@ public class DataLakeResourceV3 extends AbstractRestInterface {
     String aggregationValue = info.getQueryParameters().getFirst("aggregationValue");
 
     DataResult result;
+
     try {
       if (aggregationUnit != null && aggregationValue != null) {
           result = dataLakeManagement.getEvents(index, startdate, enddate, aggregationUnit,
@@ -208,4 +210,16 @@ public class DataLakeResourceV3 extends AbstractRestInterface {
             .build();
   }
 
+  @POST
+  @Produces(MediaType.TEXT_PLAIN)
+  @Path("/data/{index}/labeling/{startdate}/{enddate}/{label}")
+    public Response labelData(@PathParam("index") String index,
+                              @PathParam("startdate") long startdate,
+                              @PathParam("enddate") long enddate,
+                              @PathParam("label") String label) {
+    
+    return Response.ok("Successfully updated database.", MediaType.TEXT_PLAIN).build();
+  }
+
+
 }