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 2021/06/11 18:47:37 UTC

[incubator-streampipes] 04/16: [STREAMPIPES-349] Add query element 'Item Limitation' and corresponding parameter class

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

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

commit 32e6b791130f0c5aa7ffad2a40eb155357ea351e
Author: Daniel Ebi <eb...@fzi.de>
AuthorDate: Fri Jun 11 19:13:26 2021 +0200

    [STREAMPIPES-349] Add query element 'Item Limitation' and corresponding parameter class
---
 .../v4/params/ItemLimitationParams.java            | 37 ++++++++++++++++++++++
 .../v4/query/elements/ItemLimitation.java          | 34 ++++++++++++++++++++
 2 files changed, 71 insertions(+)

diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/params/ItemLimitationParams.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/params/ItemLimitationParams.java
new file mode 100644
index 0000000..6656ad5
--- /dev/null
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/params/ItemLimitationParams.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.streampipes.dataexplorer.v4.params;
+
+public class ItemLimitationParams extends QueryParamsV4 {
+
+    private final Integer limit;
+
+    public static ItemLimitationParams from(String measurementID, Integer limit) {
+        return new ItemLimitationParams(measurementID, limit);
+    }
+
+    public ItemLimitationParams(String measurementID, Integer limit) {
+        super(measurementID);
+        this.limit = limit;
+    }
+
+    public Integer getLimit() {
+        return limit;
+    }
+}
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/elements/ItemLimitation.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/elements/ItemLimitation.java
new file mode 100644
index 0000000..b4f42e0
--- /dev/null
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/elements/ItemLimitation.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.streampipes.dataexplorer.v4.query.elements;
+
+import org.apache.streampipes.dataexplorer.v4.params.ItemLimitationParams;
+import org.apache.streampipes.dataexplorer.v4.template.QueryTemplatesV4;
+
+public class ItemLimitation extends QueryElement<ItemLimitationParams> {
+
+    public ItemLimitation(ItemLimitationParams itemLimitationParams) {
+        super(itemLimitationParams);
+    }
+
+    @Override
+    protected String buildStatement(ItemLimitationParams itemLimitationParams) {
+        return QueryTemplatesV4.limitItems(itemLimitationParams.getLimit());
+    }
+}