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:20:26 UTC

[incubator-streampipes] 18/29: Add query element "Offset" 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 2513b45bfc0713e3b4bea44404934ef337219aa7
Author: Daniel Ebi <eb...@fzi.de>
AuthorDate: Fri Jun 11 19:14:55 2021 +0200

    Add query element "Offset" and corresponding parameter class
---
 .../dataexplorer/v4/params/OffsetParams.java       | 37 ++++++++++++++++++++++
 .../dataexplorer/v4/query/elements/Offset.java     | 34 ++++++++++++++++++++
 2 files changed, 71 insertions(+)

diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/params/OffsetParams.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/params/OffsetParams.java
new file mode 100644
index 0000000..ac6a1b3
--- /dev/null
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/params/OffsetParams.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 OffsetParams extends QueryParamsV4 {
+
+    private final Integer offset;
+
+    public static OffsetParams from(String measurementID, Integer offset) {
+        return new OffsetParams(measurementID, offset);
+    }
+
+    public OffsetParams(String measurementID, Integer offset) {
+        super(measurementID);
+        this.offset = offset;
+    }
+
+    public Integer getOffset() {
+        return offset;
+    }
+}
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/elements/Offset.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/elements/Offset.java
new file mode 100644
index 0000000..c8c8c0a
--- /dev/null
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/elements/Offset.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.OffsetParams;
+import org.apache.streampipes.dataexplorer.v4.template.QueryTemplatesV4;
+
+public class Offset extends QueryElement<OffsetParams> {
+
+    public Offset(OffsetParams offsetParams) {
+        super(offsetParams);
+    }
+
+    @Override
+    protected String buildStatement(OffsetParams offsetParams) {
+        return QueryTemplatesV4.offset(offsetParams.getOffset());
+    }
+}