eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject eagle git commit: [MINOR] Support /streams?siteId=SITE_ID API
Date Mon, 20 Feb 2017 09:36:31 GMT
Repository: eagle
Updated Branches:
  refs/heads/master c85056736 -> a27289fd3


[MINOR] Support /streams?siteId=SITE_ID API

Support /streams?siteId=SITE_ID API to fix stream filter bug in #822

Author: Hao Chen <hao@apache.org>

Closes #823 from haoch/FixStreamSiteIdFilter.


Project: http://git-wip-us.apache.org/repos/asf/eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/eagle/commit/a27289fd
Tree: http://git-wip-us.apache.org/repos/asf/eagle/tree/a27289fd
Diff: http://git-wip-us.apache.org/repos/asf/eagle/diff/a27289fd

Branch: refs/heads/master
Commit: a27289fd3158f5c8cf8398b24d1a102a22d3ea5e
Parents: c850567
Author: Hao Chen <hao@apache.org>
Authored: Mon Feb 20 17:36:25 2017 +0800
Committer: Hao Chen <hao@apache.org>
Committed: Mon Feb 20 17:36:25 2017 +0800

----------------------------------------------------------------------
 .../service/metadata/resource/MetadataResource.java      | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/eagle/blob/a27289fd/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/MetadataResource.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/MetadataResource.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/MetadataResource.java
index 2d30e85..36a3044 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/MetadataResource.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/MetadataResource.java
@@ -42,6 +42,7 @@ import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @since Apr 11, 2016.
@@ -129,8 +130,14 @@ public class MetadataResource {
 
     @Path("/streams")
     @GET
-    public List<StreamDefinition> listStreams() {
-        return dao.listStreams();
+    public List<StreamDefinition> listStreams(@QueryParam("siteId") String siteId)
{
+        if (siteId == null) {
+            return dao.listStreams();
+        } else {
+            return dao.listStreams().stream()
+                .filter((streamDefinition -> streamDefinition.getSiteId().equals(siteId)))
+                .collect(Collectors.toList());
+        }
     }
 
     @Path("/streams")


Mime
View raw message