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:24 UTC
[incubator-streampipes] 16/29: Add query element "Grouping 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 aec29d60ea90859b07af2957dd997a6889aa7f85
Author: Daniel Ebi <eb...@fzi.de>
AuthorDate: Fri Jun 11 19:09:57 2021 +0200
Add query element "Grouping By Time" and corresponding parameter class
---
.../v4/params/GroupingByTimeParams.java | 36 ++++++++++++++++++++++
.../v4/query/elements/GroupingByTime.java | 34 ++++++++++++++++++++
2 files changed, 70 insertions(+)
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/params/GroupingByTimeParams.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/params/GroupingByTimeParams.java
new file mode 100644
index 0000000..1751bcc
--- /dev/null
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/params/GroupingByTimeParams.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 GroupingByTimeParams extends QueryParamsV4 {
+ private final String timeInterval;
+
+ public static GroupingByTimeParams from(String measurementID, String timeInterval) {
+ return new GroupingByTimeParams(measurementID, timeInterval);
+ }
+
+ public GroupingByTimeParams(String measurementID, String timeInterval) {
+ super(measurementID);
+ this.timeInterval = timeInterval;
+ }
+
+ public String getTimeInterval() {
+ return this.timeInterval;
+ }
+}
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/elements/GroupingByTime.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/elements/GroupingByTime.java
new file mode 100644
index 0000000..dc16b65
--- /dev/null
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/elements/GroupingByTime.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.GroupingByTimeParams;
+import org.apache.streampipes.dataexplorer.v4.template.QueryTemplatesV4;
+
+public class GroupingByTime extends QueryElement<GroupingByTimeParams> {
+
+ public GroupingByTime(GroupingByTimeParams groupingByTimeParams) {
+ super(groupingByTimeParams);
+ }
+
+ @Override
+ protected String buildStatement(GroupingByTimeParams groupingByTimeParams) {
+ return QueryTemplatesV4.groupByTime(groupingByTimeParams.getTimeInterval());
+ }
+}