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:34 UTC

[incubator-streampipes] 01/16: [STREAMPIPES-349] Add query element 'Ordering By Time' 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 303b6e6af4618147b36ebf433fe559e5b3e8f7e4
Author: Daniel Ebi <eb...@fzi.de>
AuthorDate: Fri Jun 11 19:06:01 2021 +0200

    [STREAMPIPES-349] Add query element 'Ordering By Time' and corresponding parameter class
---
 .../v4/params/OrderingByTimeParams.java            | 36 ++++++++++++++++++++++
 .../v4/query/elements/OrderingByTime.java          | 34 ++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/params/OrderingByTimeParams.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/params/OrderingByTimeParams.java
new file mode 100644
index 0000000..b7b71e9
--- /dev/null
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/params/OrderingByTimeParams.java
@@ -0,0 +1,36 @@
+/*
+ * 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 OrderingByTimeParams extends QueryParamsV4 {
+    private final String ordering;
+
+    public static OrderingByTimeParams from(String measurementID, String ordering) {
+        return new OrderingByTimeParams(measurementID, ordering);
+    }
+
+    public OrderingByTimeParams(String measurementID, String ordering) {
+        super(measurementID);
+        this.ordering = ordering;
+    }
+
+    public String getOrdering() {
+        return this.ordering;
+    }
+}
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/elements/OrderingByTime.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/elements/OrderingByTime.java
new file mode 100644
index 0000000..877d7e0
--- /dev/null
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/elements/OrderingByTime.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.OrderingByTimeParams;
+import org.apache.streampipes.dataexplorer.v4.template.QueryTemplatesV4;
+
+public class OrderingByTime extends QueryElement<OrderingByTimeParams> {
+
+    public OrderingByTime(OrderingByTimeParams orderingByTimeParams) {
+        super(orderingByTimeParams);
+    }
+
+    @Override
+    protected String buildStatement(OrderingByTimeParams orderingByTimeParams) {
+        return QueryTemplatesV4.orderByTime(orderingByTimeParams.getOrdering());
+    }
+}