From ddad60988e1e756e807eb3743509798f7e8412ff Mon Sep 17 00:00:00 2001 From: "kevin.shehu" Date: Wed, 9 Feb 2022 19:09:05 +0100 Subject: [PATCH] NEW : REBASE THE ENTIRE WORKING PROJECT --- .gitignore | 134 --------- .idea/.gitignore | 2 - .idea/codeStyles/codeStyleConfig.xml | 5 - .idea/compiler.xml | 13 - .idea/copyright/Kevin_Shehu.xml | 6 - .idea/jarRepositories.xml | 25 -- .idea/jpa-buddy.xml | 6 - .idea/misc.xml | 45 --- .idea/runConfigurations.xml | 10 - .idea/uiDesigner.xml | 124 -------- .idea/vcs.xml | 6 - README.md | 39 --- pom.xml | 140 --------- .../java/Credentials/UserCredentials.java | 52 ---- .../09a91c61-6572-4476-8bf1-310a2fb2eb02.json | 1 - .../1f49de66-0921-4583-ae68-ff0fcc070bd1.json | 9 - .../22e5b1b0-b28c-4aa1-97c7-94ff12c51384.json | 1 - .../3b6a8c15-5cea-4994-954d-5b25c22e2c32.json | 1 - .../5209815d-974f-4729-ae1a-06bd1000db67.json | 1 - .../65e95c11-ec15-4039-840a-e9be3d77ca63.json | 1 - .../69bcaae0-9ccd-4342-8a71-c72dca37cfe9.json | 1 - src/main/java/Data/70B3D57050004223.json | 1 - src/main/java/Data/70B3D570500042D7.json | 1 - src/main/java/Data/70B3D57050004EF4.json | 1 - src/main/java/Data/70B3D57050006223.json | 1 - src/main/java/Data/70B3D5705000623C.json | 1 - .../77c174ad-37a8-4cc5-b690-570c3ac57c53.json | 1 - .../812c6e62-e855-424b-8ec1-78fb424a94b5.json | 1 - .../88c8442f-62b9-4952-b28c-73790a555060.json | 1 - src/main/java/Data/Germes.txt | 1 - src/main/java/Data/Heufs.txt | 1 - src/main/java/Data/Jacobs.txt | 1 - src/main/java/Data/Nica.txt | 1 - .../a0d80d32-303a-460b-954a-2e4f7bd76b68.json | 1 - .../adba09f9-ab84-4252-bf1a-ac49b1b6bdd3.json | 1 - .../bc08edce-d214-40db-ba51-a0802243c235.json | 1 - .../bdd1d27b-b2fb-4d9f-915f-ddc5a79be8b4.json | 1 - .../cd2e9ec6-ad80-477a-a510-6697b2953d19.json | 1 - .../d7c4c7a5-7010-489e-9526-999216fcf492.json | 1 - .../da62ffa0-56ad-44ee-a846-907357d0be8d.json | 1 - src/main/java/Data/devicesOutput.json | 266 ------------------ .../f75934dc-af98-4206-a5bd-22d23dd5f268.json | 1 - .../ff6f11e0-c969-4cbb-829c-f44a13683918.json | 1 - .../ffca826c-d1b5-4ac8-869a-ec0da15d9076.json | 1 - src/main/java/Data/securityToken.txt | 1 - src/main/java/Files/ReadFile.java | 26 -- src/main/java/Files/WriteFile.java | 34 --- src/main/java/HttpCall/HttpGet.java | 46 --- src/main/java/HttpCall/HttpPost.java | 41 --- src/main/java/JSON2RDF/JSON2RDF.java | 77 ----- .../java/JSON2RDF/JsonStreamRDFWriter.java | 124 -------- .../JSON_Unpack/GeneralCall4AllDevices.java | 29 -- .../java/JSON_Unpack/ReadSensors4Partner.java | 87 ------ src/main/java/Knowledgebase/DroolsTest.java | 53 ---- src/main/java/eu/hsrw/ias/ggd/ApiCall.java | 78 ----- src/main/java/eu/hsrw/ias/ggd/Device.java | 105 ------- src/main/java/eu/hsrw/ias/ggd/Greenhouse.java | 50 ---- src/main/java/eu/hsrw/ias/ggd/Isis.java | 32 --- src/main/java/eu/hsrw/ias/ggd/MainExe.java | 12 - .../java/eu/hsrw/ias/ggd/Notification.java | 38 --- .../java/eu/hsrw/ias/ggd/ScheduledTask.java | 54 ---- .../java/eu/hsrw/ias/ggd/SecurityToken.java | 23 -- src/main/java/eu/hsrw/ias/ggd/SensorMap.java | 16 -- src/main/java/eu/hsrw/ias/ggd/Severity.java | 10 - src/main/resources/META-INF/kmodule.xml | 6 - src/main/resources/maven/pom.properties | 3 - src/main/resources/rules/CriticalBattery.drl | 126 --------- .../resources/rules/CriticalPrecipitation.drl | 24 -- .../rules/CriticalSoilConductivity.drl | 7 - .../rules/CriticalSoilTemperature.drl | 7 - .../resources/rules/CriticalTemperature.drl | 42 --- .../rules/DielectricPermittivity.drl | 20 -- .../rules/device-sensor-critical.drl | 31 -- .../resources/rules/greenhouse_critical.drl | 25 -- src/main/resources/rules/optimal.drl | 15 - src/main/resources/rules/warnings.drl | 15 - target/classes/META-INF/kmodule.xml | 6 - target/classes/maven/pom.properties | 3 - target/classes/rules/CriticalBattery.drl | 126 --------- .../classes/rules/CriticalPrecipitation.drl | 24 -- .../rules/CriticalSoilConductivity.drl | 7 - target/classes/rules/CriticalSoilMoisture.drl | 44 --- .../classes/rules/CriticalSoilTemperature.drl | 7 - target/classes/rules/CriticalTemperature.drl | 47 ---- .../classes/rules/DielectricPermittivity.drl | 20 -- .../classes/rules/device-sensor-critical.drl | 31 -- target/classes/rules/greenhouse_critical.drl | 25 -- target/classes/rules/optimal.drl | 15 - target/classes/rules/warnings.drl | 15 - 89 files changed, 2537 deletions(-) delete mode 100644 .gitignore delete mode 100644 .idea/.gitignore delete mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/copyright/Kevin_Shehu.xml delete mode 100644 .idea/jarRepositories.xml delete mode 100644 .idea/jpa-buddy.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/runConfigurations.xml delete mode 100644 .idea/uiDesigner.xml delete mode 100644 .idea/vcs.xml delete mode 100644 README.md delete mode 100644 pom.xml delete mode 100644 src/main/java/Credentials/UserCredentials.java delete mode 100644 src/main/java/Data/09a91c61-6572-4476-8bf1-310a2fb2eb02.json delete mode 100644 src/main/java/Data/1f49de66-0921-4583-ae68-ff0fcc070bd1.json delete mode 100644 src/main/java/Data/22e5b1b0-b28c-4aa1-97c7-94ff12c51384.json delete mode 100644 src/main/java/Data/3b6a8c15-5cea-4994-954d-5b25c22e2c32.json delete mode 100644 src/main/java/Data/5209815d-974f-4729-ae1a-06bd1000db67.json delete mode 100644 src/main/java/Data/65e95c11-ec15-4039-840a-e9be3d77ca63.json delete mode 100644 src/main/java/Data/69bcaae0-9ccd-4342-8a71-c72dca37cfe9.json delete mode 100644 src/main/java/Data/70B3D57050004223.json delete mode 100644 src/main/java/Data/70B3D570500042D7.json delete mode 100644 src/main/java/Data/70B3D57050004EF4.json delete mode 100644 src/main/java/Data/70B3D57050006223.json delete mode 100644 src/main/java/Data/70B3D5705000623C.json delete mode 100644 src/main/java/Data/77c174ad-37a8-4cc5-b690-570c3ac57c53.json delete mode 100644 src/main/java/Data/812c6e62-e855-424b-8ec1-78fb424a94b5.json delete mode 100644 src/main/java/Data/88c8442f-62b9-4952-b28c-73790a555060.json delete mode 100644 src/main/java/Data/Germes.txt delete mode 100644 src/main/java/Data/Heufs.txt delete mode 100644 src/main/java/Data/Jacobs.txt delete mode 100644 src/main/java/Data/Nica.txt delete mode 100644 src/main/java/Data/a0d80d32-303a-460b-954a-2e4f7bd76b68.json delete mode 100644 src/main/java/Data/adba09f9-ab84-4252-bf1a-ac49b1b6bdd3.json delete mode 100644 src/main/java/Data/bc08edce-d214-40db-ba51-a0802243c235.json delete mode 100644 src/main/java/Data/bdd1d27b-b2fb-4d9f-915f-ddc5a79be8b4.json delete mode 100644 src/main/java/Data/cd2e9ec6-ad80-477a-a510-6697b2953d19.json delete mode 100644 src/main/java/Data/d7c4c7a5-7010-489e-9526-999216fcf492.json delete mode 100644 src/main/java/Data/da62ffa0-56ad-44ee-a846-907357d0be8d.json delete mode 100644 src/main/java/Data/devicesOutput.json delete mode 100644 src/main/java/Data/f75934dc-af98-4206-a5bd-22d23dd5f268.json delete mode 100644 src/main/java/Data/ff6f11e0-c969-4cbb-829c-f44a13683918.json delete mode 100644 src/main/java/Data/ffca826c-d1b5-4ac8-869a-ec0da15d9076.json delete mode 100644 src/main/java/Data/securityToken.txt delete mode 100644 src/main/java/Files/ReadFile.java delete mode 100644 src/main/java/Files/WriteFile.java delete mode 100644 src/main/java/HttpCall/HttpGet.java delete mode 100644 src/main/java/HttpCall/HttpPost.java delete mode 100644 src/main/java/JSON2RDF/JSON2RDF.java delete mode 100644 src/main/java/JSON2RDF/JsonStreamRDFWriter.java delete mode 100644 src/main/java/JSON_Unpack/GeneralCall4AllDevices.java delete mode 100644 src/main/java/JSON_Unpack/ReadSensors4Partner.java delete mode 100644 src/main/java/Knowledgebase/DroolsTest.java delete mode 100644 src/main/java/eu/hsrw/ias/ggd/ApiCall.java delete mode 100644 src/main/java/eu/hsrw/ias/ggd/Device.java delete mode 100644 src/main/java/eu/hsrw/ias/ggd/Greenhouse.java delete mode 100644 src/main/java/eu/hsrw/ias/ggd/Isis.java delete mode 100644 src/main/java/eu/hsrw/ias/ggd/MainExe.java delete mode 100644 src/main/java/eu/hsrw/ias/ggd/Notification.java delete mode 100644 src/main/java/eu/hsrw/ias/ggd/ScheduledTask.java delete mode 100644 src/main/java/eu/hsrw/ias/ggd/SecurityToken.java delete mode 100644 src/main/java/eu/hsrw/ias/ggd/SensorMap.java delete mode 100644 src/main/java/eu/hsrw/ias/ggd/Severity.java delete mode 100644 src/main/resources/META-INF/kmodule.xml delete mode 100644 src/main/resources/maven/pom.properties delete mode 100644 src/main/resources/rules/CriticalBattery.drl delete mode 100644 src/main/resources/rules/CriticalPrecipitation.drl delete mode 100644 src/main/resources/rules/CriticalSoilConductivity.drl delete mode 100644 src/main/resources/rules/CriticalSoilTemperature.drl delete mode 100644 src/main/resources/rules/CriticalTemperature.drl delete mode 100644 src/main/resources/rules/DielectricPermittivity.drl delete mode 100644 src/main/resources/rules/device-sensor-critical.drl delete mode 100644 src/main/resources/rules/greenhouse_critical.drl delete mode 100644 src/main/resources/rules/optimal.drl delete mode 100644 src/main/resources/rules/warnings.drl delete mode 100644 target/classes/META-INF/kmodule.xml delete mode 100644 target/classes/maven/pom.properties delete mode 100644 target/classes/rules/CriticalBattery.drl delete mode 100644 target/classes/rules/CriticalPrecipitation.drl delete mode 100644 target/classes/rules/CriticalSoilConductivity.drl delete mode 100644 target/classes/rules/CriticalSoilMoisture.drl delete mode 100644 target/classes/rules/CriticalSoilTemperature.drl delete mode 100644 target/classes/rules/CriticalTemperature.drl delete mode 100644 target/classes/rules/DielectricPermittivity.drl delete mode 100644 target/classes/rules/device-sensor-critical.drl delete mode 100644 target/classes/rules/greenhouse_critical.drl delete mode 100644 target/classes/rules/optimal.drl delete mode 100644 target/classes/rules/warnings.drl diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 4b981b9..0000000 --- a/.gitignore +++ /dev/null @@ -1,134 +0,0 @@ -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# AWS User-specific -.idea/**/aws.xml - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - -# CMake -cmake-build-*/ - -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# SonarLint plugin -.idea/sonarlint/ - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser - -### Intellij Patch ### -# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 - -# *.iml -# modules.xml -# .idea/misc.xml -# *.ipr - -# Sonarlint plugin -# https://plugins.jetbrains.com/plugin/7973-sonarlint -.idea/**/sonarlint/ - -# SonarQube Plugin -# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin -.idea/**/sonarIssues.xml - -# Markdown Navigator plugin -# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced -.idea/**/markdown-navigator.xml -.idea/**/markdown-navigator-enh.xml -.idea/**/markdown-navigator/ - -# Cache file creation bug -# See https://youtrack.jetbrains.com/issue/JBR-2257 -.idea/$CACHE_FILE$ - -# CodeStream plugin -# https://plugins.jetbrains.com/plugin/12206-codestream -.idea/codestream.xml - -### Java ### -# Compiled class file -*.class -src/main/java/Credentials/*.java -src/main/java/Data/*.json - -# Log file -*.log - -# BlueJ files -*.ctxt - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* -replay_pid* - - diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 5c98b42..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Default ignored files -/workspace.xml \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index a55e7a1..0000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index e1db647..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/copyright/Kevin_Shehu.xml b/.idea/copyright/Kevin_Shehu.xml deleted file mode 100644 index 0e5e24b..0000000 --- a/.idea/copyright/Kevin_Shehu.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index e29a48a..0000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/jpa-buddy.xml b/.idea/jpa-buddy.xml deleted file mode 100644 index d08f400..0000000 --- a/.idea/jpa-buddy.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 67fa7ec..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 797acea..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml deleted file mode 100644 index e96534f..0000000 --- a/.idea/uiDesigner.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 4ebd422..0000000 --- a/README.md +++ /dev/null @@ -1,39 +0,0 @@ -### **Gardeners Green Thumb Decision Support System** (GGD-DDS) - -The service of decision support system is inferring knowledge from the available data of the greenhouse, the user input, and historical data what a user/the gardener should do & which action a gardener should execute to be successful with the growing process of the plants. -These actions are called goals. -The list of inferred active goals is offered to other services of the system. - The approach of the DSS is based on three eu.hsrw.ias.ggd.MainExe concepts: - -**Fact knowledge (Knowledgebase)** - -1. Hardware Information(sensor data info) -2. Data information was given by an expert that is overwriting sensor data -3. User Input (We assume that the user is every time honest and that input is every time correct) - -**Rules (General structure, if premises then consequence)** -1. Explicit given by expert (before and during runtime) - 1. Battery - 2. Dielectric Permittivity - 3. Precipitation - 4. Soil Conductivity - 5. Soil Moisture - 6. Soil Temperature - 7. Temperature -2. All this information is considered as facts which are part of the entire knowledge graph -3. One particular rule can be fire on multiple rules can be fired. User defined. - -**Goals** -1. Goals are active rules which are able to change the fact -2. Goals can be activated and deactivated based on the user preferences -3. Goals can have priorities - -#### **Build** -Run the MainExe.java which is part of the eu.hsrw.ias.ggd package -#### **Usage** -You can reuse the project by changing the UserCredentials.java file located on the Credentials package. -It is possible to create new rules tailored to the needs. -#### **Examples** -For each sensor mentioned in the list of rules an example is given. You may change the values based on the needs of the expert/user. -#### **Dependencies** -drools.org \ No newline at end of file diff --git a/pom.xml b/pom.xml deleted file mode 100644 index a1c26ad..0000000 --- a/pom.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - 4.0.0 - - 7.48.0.Final - - org.example - GGD - 1.0-SNAPSHOT - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 11 - 11 - - - - - - - - - - - info.picocli - picocli - 4.5.1 - - - org.glassfish - javax.json - 1.1.4 - - - com.googlecode.json-simple - json-simple - 1.1.1 - - - - com.google.code.gson - gson - 2.8.6 - - - - org.json - json - 20201115 - - - - - org.slf4j - slf4j-simple - 1.7.30 - test - - - - - org.drools - drools-core - ${runtime.version} - - - - org.drools - drools-compiler - ${runtime.version} - - - - org.drools - drools-decisiontables - ${runtime.version} - - - - org.drools - kiebase-inclusion - ${runtime.version} - runtime - - - - - - - - - - - - org.kie - kie-ci - ${runtime.version} - - - - - - - - - - org.jbpm - jbpm-test - ${runtime.version} - - - - - - - jboss-public-repository-group - JBoss Public Repository Group - http://repository.jboss.org/nexus/content/groups/public/ - - true - never - - - true - daily - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/Credentials/UserCredentials.java b/src/main/java/Credentials/UserCredentials.java deleted file mode 100644 index acfd081..0000000 --- a/src/main/java/Credentials/UserCredentials.java +++ /dev/null @@ -1,52 +0,0 @@ -package Credentials; -//Before pushing files to the git run : npx prettier --write "**/*.java" - -public class UserCredentials { - - private final String username = "kevin.shehu@hochschule-rhein-waal.de"; - private final String password = "DK7SxFkGJgnLhnU3"; - private final String baseURL = "https://api.whysor.com/"; - private final String devUrl = "https://api.dev.whysor.com/"; - private static final String homeRoot = - "D:\\WORK\\GGD\\src\\main\\java\\Data\\"; - - public static String getHomeRoot() { - return homeRoot; - } - - public String getUsername() { - return username; - } - - public String getPassword() { - return password; - } - - public String getBaseURL() { - return baseURL; - } - - public String getDevUrl() { - return devUrl; - } - - @Override - public String toString() { - return ( - "UserCredentials{" + - "username='" + - username + - '\'' + - ", password='" + - password + - '\'' + - ", baseURL='" + - baseURL + - '\'' + - ", devUrl='" + - devUrl + - '\'' + - '}' - ); - } -} diff --git a/src/main/java/Data/09a91c61-6572-4476-8bf1-310a2fb2eb02.json b/src/main/java/Data/09a91c61-6572-4476-8bf1-310a2fb2eb02.json deleted file mode 100644 index 02649e5..0000000 --- a/src/main/java/Data/09a91c61-6572-4476-8bf1-310a2fb2eb02.json +++ /dev/null @@ -1 +0,0 @@ -[{"sensorId":"09a91c61-6572-4476-8bf1-310a2fb2eb02","datetimeMeasure":"2022-02-07T14:06:26.275Z","value":10.87,"groupId":null,"metadata":null}]externalTemperature,f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632 \ No newline at end of file diff --git a/src/main/java/Data/1f49de66-0921-4583-ae68-ff0fcc070bd1.json b/src/main/java/Data/1f49de66-0921-4583-ae68-ff0fcc070bd1.json deleted file mode 100644 index 6850160..0000000 --- a/src/main/java/Data/1f49de66-0921-4583-ae68-ff0fcc070bd1.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - { - "sensorId": "1f49de66-0921-4583-ae68-ff0fcc070bd1", - "datetimeMeasure": "2022-02-07T14:02:38.272Z", - "value": 21.21, - "groupId": null, - "metadata": null - } -]dielectricPermittivity,fd694041-581e-4c2c-9810-505e62b762e6 \ No newline at end of file diff --git a/src/main/java/Data/22e5b1b0-b28c-4aa1-97c7-94ff12c51384.json b/src/main/java/Data/22e5b1b0-b28c-4aa1-97c7-94ff12c51384.json deleted file mode 100644 index f9e028c..0000000 --- a/src/main/java/Data/22e5b1b0-b28c-4aa1-97c7-94ff12c51384.json +++ /dev/null @@ -1 +0,0 @@ -[{"sensorId":"22e5b1b0-b28c-4aa1-97c7-94ff12c51384","datetimeMeasure":"2022-02-07T14:02:38.272Z","value":10,"groupId":null,"metadata":null}]soilTemperature,fd694041-581e-4c2c-9810-505e62b762e6 \ No newline at end of file diff --git a/src/main/java/Data/3b6a8c15-5cea-4994-954d-5b25c22e2c32.json b/src/main/java/Data/3b6a8c15-5cea-4994-954d-5b25c22e2c32.json deleted file mode 100644 index 8c11dc0..0000000 --- a/src/main/java/Data/3b6a8c15-5cea-4994-954d-5b25c22e2c32.json +++ /dev/null @@ -1 +0,0 @@ -[{"sensorId":"3b6a8c15-5cea-4994-954d-5b25c22e2c32","datetimeMeasure":"2022-02-07T14:02:38.272Z","value":36,"groupId":null,"metadata":null}]soilMoisture,fd694041-581e-4c2c-9810-505e62b762e6 \ No newline at end of file diff --git a/src/main/java/Data/5209815d-974f-4729-ae1a-06bd1000db67.json b/src/main/java/Data/5209815d-974f-4729-ae1a-06bd1000db67.json deleted file mode 100644 index d6513e2..0000000 --- a/src/main/java/Data/5209815d-974f-4729-ae1a-06bd1000db67.json +++ /dev/null @@ -1 +0,0 @@ -[{"sensorId":"5209815d-974f-4729-ae1a-06bd1000db67","datetimeMeasure":"2022-02-07T14:02:38.272Z","value":0.06,"groupId":null,"metadata":null}]soilConductivity,fd694041-581e-4c2c-9810-505e62b762e6 \ No newline at end of file diff --git a/src/main/java/Data/65e95c11-ec15-4039-840a-e9be3d77ca63.json b/src/main/java/Data/65e95c11-ec15-4039-840a-e9be3d77ca63.json deleted file mode 100644 index f5ad358..0000000 --- a/src/main/java/Data/65e95c11-ec15-4039-840a-e9be3d77ca63.json +++ /dev/null @@ -1 +0,0 @@ -[{"sensorId":"65e95c11-ec15-4039-840a-e9be3d77ca63","datetimeMeasure":"2022-02-07T14:02:22.219Z","value":858.4,"groupId":null,"metadata":null}]precipitation,e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0 \ No newline at end of file diff --git a/src/main/java/Data/69bcaae0-9ccd-4342-8a71-c72dca37cfe9.json b/src/main/java/Data/69bcaae0-9ccd-4342-8a71-c72dca37cfe9.json deleted file mode 100644 index 4dbb5bb..0000000 --- a/src/main/java/Data/69bcaae0-9ccd-4342-8a71-c72dca37cfe9.json +++ /dev/null @@ -1 +0,0 @@ -[{"sensorId":"69bcaae0-9ccd-4342-8a71-c72dca37cfe9","datetimeMeasure":"2022-02-07T14:03:11.380Z","value":4.589,"groupId":null,"metadata":null}]battery,6c9efd4a-db04-453d-8ab8-d480ec97dd26 \ No newline at end of file diff --git a/src/main/java/Data/70B3D57050004223.json b/src/main/java/Data/70B3D57050004223.json deleted file mode 100644 index ee3e70e..0000000 --- a/src/main/java/Data/70B3D57050004223.json +++ /dev/null @@ -1 +0,0 @@ -[{"id":"77c174ad-37a8-4cc5-b690-570c3ac57c53","name":"","description":"","tag":"soilTemperature","hasForecast":false,"virtual":false,"deviceId":"b04821c6-ea7c-4e2e-9575-7c8e8ba9191a","sensorTemplateId":"f1ca68cc-cfd2-4f44-94cf-61138b71f5d2"},{"id":"a0d80d32-303a-460b-954a-2e4f7bd76b68","name":"","description":"","tag":"dielectricPermittivity","hasForecast":false,"virtual":false,"deviceId":"b04821c6-ea7c-4e2e-9575-7c8e8ba9191a","sensorTemplateId":"c04a55a7-51e8-4647-9b59-3d82966dd863"},{"id":"bdd1d27b-b2fb-4d9f-915f-ddc5a79be8b4","name":"","description":"","tag":"soilConductivity","hasForecast":false,"virtual":false,"deviceId":"b04821c6-ea7c-4e2e-9575-7c8e8ba9191a","sensorTemplateId":"057a689a-738a-4e78-bf73-6629ee56ab4c"},{"id":"d7c4c7a5-7010-489e-9526-999216fcf492","name":"","description":"","tag":"soilMoisture","hasForecast":false,"virtual":false,"deviceId":"b04821c6-ea7c-4e2e-9575-7c8e8ba9191a","sensorTemplateId":"8fac9339-de32-45a7-8df6-f38aca013e66"},{"id":"da62ffa0-56ad-44ee-a846-907357d0be8d","name":"","description":"","tag":"battery","hasForecast":false,"virtual":false,"deviceId":"b04821c6-ea7c-4e2e-9575-7c8e8ba9191a","sensorTemplateId":"978d7178-aa5a-41ca-a5c8-1868135ea928"}] \ No newline at end of file diff --git a/src/main/java/Data/70B3D570500042D7.json b/src/main/java/Data/70B3D570500042D7.json deleted file mode 100644 index 75c287e..0000000 --- a/src/main/java/Data/70B3D570500042D7.json +++ /dev/null @@ -1 +0,0 @@ -[{"id":"1f49de66-0921-4583-ae68-ff0fcc070bd1","name":"","description":"","tag":"dielectricPermittivity","hasForecast":false,"virtual":false,"deviceId":"fd694041-581e-4c2c-9810-505e62b762e6","sensorTemplateId":"c04a55a7-51e8-4647-9b59-3d82966dd863"},{"id":"22e5b1b0-b28c-4aa1-97c7-94ff12c51384","name":"","description":"","tag":"soilTemperature","hasForecast":false,"virtual":false,"deviceId":"fd694041-581e-4c2c-9810-505e62b762e6","sensorTemplateId":"f1ca68cc-cfd2-4f44-94cf-61138b71f5d2"},{"id":"3b6a8c15-5cea-4994-954d-5b25c22e2c32","name":"","description":"","tag":"soilMoisture","hasForecast":false,"virtual":false,"deviceId":"fd694041-581e-4c2c-9810-505e62b762e6","sensorTemplateId":"8fac9339-de32-45a7-8df6-f38aca013e66"},{"id":"5209815d-974f-4729-ae1a-06bd1000db67","name":"","description":"","tag":"soilConductivity","hasForecast":false,"virtual":false,"deviceId":"fd694041-581e-4c2c-9810-505e62b762e6","sensorTemplateId":"057a689a-738a-4e78-bf73-6629ee56ab4c"},{"id":"adba09f9-ab84-4252-bf1a-ac49b1b6bdd3","name":"","description":"","tag":"battery","hasForecast":false,"virtual":false,"deviceId":"fd694041-581e-4c2c-9810-505e62b762e6","sensorTemplateId":"978d7178-aa5a-41ca-a5c8-1868135ea928"}] \ No newline at end of file diff --git a/src/main/java/Data/70B3D57050004EF4.json b/src/main/java/Data/70B3D57050004EF4.json deleted file mode 100644 index 82540fb..0000000 --- a/src/main/java/Data/70B3D57050004EF4.json +++ /dev/null @@ -1 +0,0 @@ -[{"id":"65e95c11-ec15-4039-840a-e9be3d77ca63","name":"","description":"","tag":"precipitation","hasForecast":false,"virtual":false,"deviceId":"e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0","sensorTemplateId":"3985b5b6-92a4-41b1-b2e6-e553a663442c"},{"id":"812c6e62-e855-424b-8ec1-78fb424a94b5","name":"","description":"","tag":"soilMoisture","hasForecast":false,"virtual":false,"deviceId":"e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0","sensorTemplateId":"dbe5fd37-85bd-4af1-b335-554baa3f6d49"},{"id":"ffca826c-d1b5-4ac8-869a-ec0da15d9076","name":"","description":"","tag":"battery","hasForecast":false,"virtual":false,"deviceId":"e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0","sensorTemplateId":"71c8fcd4-3895-42e8-82d9-455366c956ef"}] \ No newline at end of file diff --git a/src/main/java/Data/70B3D57050006223.json b/src/main/java/Data/70B3D57050006223.json deleted file mode 100644 index 09a3e86..0000000 --- a/src/main/java/Data/70B3D57050006223.json +++ /dev/null @@ -1 +0,0 @@ -[{"id":"09a91c61-6572-4476-8bf1-310a2fb2eb02","name":"","description":"","tag":"externalTemperature","hasForecast":false,"virtual":false,"deviceId":"f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632","sensorTemplateId":"46bc5bf2-ad0c-4ec4-9df5-0bff12f911b6"},{"id":"88c8442f-62b9-4952-b28c-73790a555060","name":"","description":"","tag":"battery","hasForecast":false,"virtual":false,"deviceId":"f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632","sensorTemplateId":"71c8fcd4-3895-42e8-82d9-455366c956ef"},{"id":"bc08edce-d214-40db-ba51-a0802243c235","name":"","description":"","tag":"soilMoisture","hasForecast":false,"virtual":false,"deviceId":"f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632","sensorTemplateId":"dbe5fd37-85bd-4af1-b335-554baa3f6d49"}] \ No newline at end of file diff --git a/src/main/java/Data/70B3D5705000623C.json b/src/main/java/Data/70B3D5705000623C.json deleted file mode 100644 index 2599621..0000000 --- a/src/main/java/Data/70B3D5705000623C.json +++ /dev/null @@ -1 +0,0 @@ -[{"id":"69bcaae0-9ccd-4342-8a71-c72dca37cfe9","name":"","description":"","tag":"battery","hasForecast":false,"virtual":false,"deviceId":"6c9efd4a-db04-453d-8ab8-d480ec97dd26","sensorTemplateId":"71c8fcd4-3895-42e8-82d9-455366c956ef"},{"id":"cd2e9ec6-ad80-477a-a510-6697b2953d19","name":"","description":"","tag":"coordinates","hasForecast":false,"virtual":false,"deviceId":"6c9efd4a-db04-453d-8ab8-d480ec97dd26","sensorTemplateId":"c3591348-8ef1-4e19-a2eb-c9a377e4199e"},{"id":"f75934dc-af98-4206-a5bd-22d23dd5f268","name":"","description":"","tag":"temperature","hasForecast":false,"virtual":false,"deviceId":"6c9efd4a-db04-453d-8ab8-d480ec97dd26","sensorTemplateId":"46bc5bf2-ad0c-4ec4-9df5-0bff12f911b6"},{"id":"ff6f11e0-c969-4cbb-829c-f44a13683918","name":"","description":"","tag":"precipitation","hasForecast":false,"virtual":false,"deviceId":"6c9efd4a-db04-453d-8ab8-d480ec97dd26","sensorTemplateId":"3985b5b6-92a4-41b1-b2e6-e553a663442c"}] \ No newline at end of file diff --git a/src/main/java/Data/77c174ad-37a8-4cc5-b690-570c3ac57c53.json b/src/main/java/Data/77c174ad-37a8-4cc5-b690-570c3ac57c53.json deleted file mode 100644 index 0cd91d4..0000000 --- a/src/main/java/Data/77c174ad-37a8-4cc5-b690-570c3ac57c53.json +++ /dev/null @@ -1 +0,0 @@ -{"error":{"statusCode":403,"name":"AccessDeniedError","message":"Access denied","status":403,"code":"ACCESS_DENIED","stack":"AccessDeniedError: Access denied\n at Sensor.read (/usr/src/app/server/models/device/sensor.js:37:60)"}}soilTemperature,b04821c6-ea7c-4e2e-9575-7c8e8ba9191a \ No newline at end of file diff --git a/src/main/java/Data/812c6e62-e855-424b-8ec1-78fb424a94b5.json b/src/main/java/Data/812c6e62-e855-424b-8ec1-78fb424a94b5.json deleted file mode 100644 index 514ce24..0000000 --- a/src/main/java/Data/812c6e62-e855-424b-8ec1-78fb424a94b5.json +++ /dev/null @@ -1 +0,0 @@ -[{"sensorId":"812c6e62-e855-424b-8ec1-78fb424a94b5","datetimeMeasure":"2022-02-07T14:02:22.219Z","value":36.1,"groupId":null,"metadata":null}]soilMoisture,e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0 \ No newline at end of file diff --git a/src/main/java/Data/88c8442f-62b9-4952-b28c-73790a555060.json b/src/main/java/Data/88c8442f-62b9-4952-b28c-73790a555060.json deleted file mode 100644 index 2ce9d7f..0000000 --- a/src/main/java/Data/88c8442f-62b9-4952-b28c-73790a555060.json +++ /dev/null @@ -1 +0,0 @@ -[{"sensorId":"88c8442f-62b9-4952-b28c-73790a555060","datetimeMeasure":"2022-02-07T14:06:26.275Z","value":5.154,"groupId":null,"metadata":null}]battery,f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632 \ No newline at end of file diff --git a/src/main/java/Data/Germes.txt b/src/main/java/Data/Germes.txt deleted file mode 100644 index a28950b..0000000 --- a/src/main/java/Data/Germes.txt +++ /dev/null @@ -1 +0,0 @@ -70B3D57050004223,70B3D570500042D7,70B3D57050004EF4,70B3D57050006223,70B3D5705000623C diff --git a/src/main/java/Data/Heufs.txt b/src/main/java/Data/Heufs.txt deleted file mode 100644 index f98c5dc..0000000 --- a/src/main/java/Data/Heufs.txt +++ /dev/null @@ -1 +0,0 @@ -70B3D57050004682,70B3D57050004D14 \ No newline at end of file diff --git a/src/main/java/Data/Jacobs.txt b/src/main/java/Data/Jacobs.txt deleted file mode 100644 index c92747c..0000000 --- a/src/main/java/Data/Jacobs.txt +++ /dev/null @@ -1 +0,0 @@ -0004A30B00227D68,70B3D5705000E019 \ No newline at end of file diff --git a/src/main/java/Data/Nica.txt b/src/main/java/Data/Nica.txt deleted file mode 100644 index 2e0441e..0000000 --- a/src/main/java/Data/Nica.txt +++ /dev/null @@ -1 +0,0 @@ -70B3D5705000E030,70B3D5705000E05E,70B3D5705000E386 \ No newline at end of file diff --git a/src/main/java/Data/a0d80d32-303a-460b-954a-2e4f7bd76b68.json b/src/main/java/Data/a0d80d32-303a-460b-954a-2e4f7bd76b68.json deleted file mode 100644 index 3ecca3e..0000000 --- a/src/main/java/Data/a0d80d32-303a-460b-954a-2e4f7bd76b68.json +++ /dev/null @@ -1 +0,0 @@ -{"error":{"statusCode":403,"name":"AccessDeniedError","message":"Access denied","status":403,"code":"ACCESS_DENIED","stack":"AccessDeniedError: Access denied\n at Sensor.read (/usr/src/app/server/models/device/sensor.js:37:60)"}}dielectricPermittivity,b04821c6-ea7c-4e2e-9575-7c8e8ba9191a \ No newline at end of file diff --git a/src/main/java/Data/adba09f9-ab84-4252-bf1a-ac49b1b6bdd3.json b/src/main/java/Data/adba09f9-ab84-4252-bf1a-ac49b1b6bdd3.json deleted file mode 100644 index a7b64fc..0000000 --- a/src/main/java/Data/adba09f9-ab84-4252-bf1a-ac49b1b6bdd3.json +++ /dev/null @@ -1 +0,0 @@ -[{"sensorId":"adba09f9-ab84-4252-bf1a-ac49b1b6bdd3","datetimeMeasure":"2022-02-07T14:02:38.272Z","value":5.734,"groupId":null,"metadata":null}]battery,fd694041-581e-4c2c-9810-505e62b762e6 \ No newline at end of file diff --git a/src/main/java/Data/bc08edce-d214-40db-ba51-a0802243c235.json b/src/main/java/Data/bc08edce-d214-40db-ba51-a0802243c235.json deleted file mode 100644 index 6b20f3d..0000000 --- a/src/main/java/Data/bc08edce-d214-40db-ba51-a0802243c235.json +++ /dev/null @@ -1 +0,0 @@ -[{"sensorId":"bc08edce-d214-40db-ba51-a0802243c235","datetimeMeasure":"2022-02-07T14:06:26.275Z","value":38.9,"groupId":null,"metadata":null}]soilMoisture,f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632 \ No newline at end of file diff --git a/src/main/java/Data/bdd1d27b-b2fb-4d9f-915f-ddc5a79be8b4.json b/src/main/java/Data/bdd1d27b-b2fb-4d9f-915f-ddc5a79be8b4.json deleted file mode 100644 index 6588931..0000000 --- a/src/main/java/Data/bdd1d27b-b2fb-4d9f-915f-ddc5a79be8b4.json +++ /dev/null @@ -1 +0,0 @@ -{"error":{"statusCode":403,"name":"AccessDeniedError","message":"Access denied","status":403,"code":"ACCESS_DENIED","stack":"AccessDeniedError: Access denied\n at Sensor.read (/usr/src/app/server/models/device/sensor.js:37:60)"}}soilConductivity,b04821c6-ea7c-4e2e-9575-7c8e8ba9191a \ No newline at end of file diff --git a/src/main/java/Data/cd2e9ec6-ad80-477a-a510-6697b2953d19.json b/src/main/java/Data/cd2e9ec6-ad80-477a-a510-6697b2953d19.json deleted file mode 100644 index ecd69a2..0000000 --- a/src/main/java/Data/cd2e9ec6-ad80-477a-a510-6697b2953d19.json +++ /dev/null @@ -1 +0,0 @@ -[]coordinates,6c9efd4a-db04-453d-8ab8-d480ec97dd26 \ No newline at end of file diff --git a/src/main/java/Data/d7c4c7a5-7010-489e-9526-999216fcf492.json b/src/main/java/Data/d7c4c7a5-7010-489e-9526-999216fcf492.json deleted file mode 100644 index 1f43655..0000000 --- a/src/main/java/Data/d7c4c7a5-7010-489e-9526-999216fcf492.json +++ /dev/null @@ -1 +0,0 @@ -{"error":{"statusCode":403,"name":"AccessDeniedError","message":"Access denied","status":403,"code":"ACCESS_DENIED","stack":"AccessDeniedError: Access denied\n at Sensor.read (/usr/src/app/server/models/device/sensor.js:37:60)"}}soilMoisture,b04821c6-ea7c-4e2e-9575-7c8e8ba9191a \ No newline at end of file diff --git a/src/main/java/Data/da62ffa0-56ad-44ee-a846-907357d0be8d.json b/src/main/java/Data/da62ffa0-56ad-44ee-a846-907357d0be8d.json deleted file mode 100644 index 89f8244..0000000 --- a/src/main/java/Data/da62ffa0-56ad-44ee-a846-907357d0be8d.json +++ /dev/null @@ -1 +0,0 @@ -{"error":{"statusCode":403,"name":"AccessDeniedError","message":"Access denied","status":403,"code":"ACCESS_DENIED","stack":"AccessDeniedError: Access denied\n at Sensor.read (/usr/src/app/server/models/device/sensor.js:37:60)"}}battery,b04821c6-ea7c-4e2e-9575-7c8e8ba9191a \ No newline at end of file diff --git a/src/main/java/Data/devicesOutput.json b/src/main/java/Data/devicesOutput.json deleted file mode 100644 index 62e7acc..0000000 --- a/src/main/java/Data/devicesOutput.json +++ /dev/null @@ -1,266 +0,0 @@ -[ - { - "id": "087c830b-1173-4b5b-bdbc-c139856cf6aa", - "externalDomain": ["kpn-lora", "modelapi"], - "externalId": "70B3D57050004C5A", - "name": "70B3D57050004C5A", - "description": "6kg sensor", - "additionalInfo": { - "location": { "latitude": 51.289406, "longitude": 6.042 } - }, - "deviceTemplateId": "7be8a213-65e9-4084-b73b-9d5cfcc46cc0", - "organizationId": "46224b7f-bf6e-4a14-8844-c8d9258a58bf" - }, - { - "id": "09d69136-7bdb-420e-83eb-8185d39b06c3", - "externalDomain": ["kpn-lora", "modelapi"], - "externalId": "70B3D570500046AA", - "name": "70B3D570500046AA", - "description": "6kg sensor", - "additionalInfo": {}, - "deviceTemplateId": "7be8a213-65e9-4084-b73b-9d5cfcc46cc0", - "organizationId": "46224b7f-bf6e-4a14-8844-c8d9258a58bf" - }, - { - "id": "142ad259-c570-49cc-bf58-99105231c051", - "externalDomain": ["kpn-lora", "modelapi"], - "externalId": "70B3D57050004657", - "name": "70B3D57050004657", - "description": "6kg sensor", - "additionalInfo": {}, - "deviceTemplateId": "7be8a213-65e9-4084-b73b-9d5cfcc46cc0", - "organizationId": "46224b7f-bf6e-4a14-8844-c8d9258a58bf" - }, - { - "id": "1f6184e2-3cfb-43e7-83a4-ea175c8590f4", - "externalDomain": ["kpn-lora", "modelapi"], - "externalId": "70B3D5705000473D", - "name": "70B3D5705000473D", - "description": "", - "additionalInfo": {}, - "deviceTemplateId": "7be8a213-65e9-4084-b73b-9d5cfcc46cc0", - "organizationId": "46224b7f-bf6e-4a14-8844-c8d9258a58bf" - }, - { - "id": "21c94566-202d-4c12-af0d-035b8db19d32", - "externalDomain": ["kpn-lora", "modelapi"], - "externalId": "70B3D57050004A7B", - "name": "70B3D57050004A7B", - "description": "", - "additionalInfo": {}, - "deviceTemplateId": "7be8a213-65e9-4084-b73b-9d5cfcc46cc0", - "organizationId": "46224b7f-bf6e-4a14-8844-c8d9258a58bf" - }, - { - "id": "388e035d-1c04-433e-bd87-de8cbf582dd3", - "externalDomain": "default", - "externalId": "8bdbe6ae-eafb-4e99-bb01-db8784dd9633", - "name": "Greenhouse 1", - "description": "", - "additionalInfo": {}, - "deviceTemplateId": "cb64266d-77d2-44a6-8626-1fc7f3dd5818", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - }, - { - "id": "4d86fbf3-5343-4856-9bc1-07c164fa0021", - "externalDomain": "default", - "externalId": "germes-greenhouse-status", - "name": "Greenhouse 3", - "description": "", - "additionalInfo": { "location": {} }, - "deviceTemplateId": "cb64266d-77d2-44a6-8626-1fc7f3dd5818", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - }, - { - "id": "5449f7d1-938c-4731-893e-40e3ddc67329", - "externalDomain": "default", - "externalId": "70B3D5705000623C-status", - "name": "Device 4", - "description": "", - "additionalInfo": {}, - "deviceTemplateId": "cb64266d-77d2-44a6-8626-1fc7f3dd5818", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - }, - { - "id": "6285c35e-9495-4017-809e-7e91a83e3bb1", - "externalDomain": "default", - "externalId": "be4a38d7-34cf-497e-9565-1396a8020293", - "name": "Aris - Plant Surface Area - 1", - "description": "", - "additionalInfo": {}, - "deviceTemplateId": "7b806473-417c-467b-a4c8-5caa5615704f", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - }, - { - "id": "6c9efd4a-db04-453d-8ab8-d480ec97dd26", - "externalDomain": "ttn", - "externalId": "70B3D5705000623C", - "name": "70B3D5705000623C", - "description": "", - "additionalInfo": { "location": {} }, - "deviceTemplateId": "e9cdbf8c-17f7-4546-a555-61bacea9ef44", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - }, - { - "id": "744bdb18-8387-4b6a-9e46-05e5a823b713", - "externalDomain": "default", - "externalId": "bb0a993f-1c2d-43fa-8f5c-60c948a77fa3", - "name": "Aris - Plant Surface Area - 3", - "description": "", - "additionalInfo": {}, - "deviceTemplateId": "7b806473-417c-467b-a4c8-5caa5615704f", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - }, - { - "id": "7ef4761c-53eb-4f6b-85e5-8c5c8fac3ca9", - "externalDomain": "default", - "externalId": "70B3D570500042D7-status", - "name": "Device 1", - "description": "", - "additionalInfo": { "location": {} }, - "deviceTemplateId": "cb64266d-77d2-44a6-8626-1fc7f3dd5818", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - }, - { - "id": "88ca2728-7a4b-4f90-a28c-1f5ba387e890", - "externalDomain": "default", - "externalId": "e5ec9f15-f214-455d-9f02-3c134c770dc1", - "name": "Greenhouse 2", - "description": "", - "additionalInfo": {}, - "deviceTemplateId": "cb64266d-77d2-44a6-8626-1fc7f3dd5818", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - }, - { - "id": "98e242b8-e49d-4eb5-a56e-a5665c05b3a3", - "externalDomain": ["kpn-lora", "modelapi"], - "externalId": "70B3D57050004619", - "name": "70B3D57050004619", - "description": "", - "additionalInfo": {}, - "deviceTemplateId": "7be8a213-65e9-4084-b73b-9d5cfcc46cc0", - "organizationId": "46224b7f-bf6e-4a14-8844-c8d9258a58bf" - }, - { - "id": "9aeac8c4-998b-4175-8908-946da0d6e76b", - "externalDomain": "default", - "externalId": "f438e5fe-e819-4c4f-a662-9df0bd632af4", - "name": "Aris - Plant Surface Area - 2", - "description": "", - "additionalInfo": {}, - "deviceTemplateId": "7b806473-417c-467b-a4c8-5caa5615704f", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - }, - { - "id": "abc0ed83-cc2d-4aec-b86c-84b22d8556be", - "externalDomain": "default", - "externalId": "70B3D57050006223-status", - "name": "Device 3", - "description": "", - "additionalInfo": {}, - "deviceTemplateId": "cb64266d-77d2-44a6-8626-1fc7f3dd5818", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - }, - { - "id": "b1334e25-22db-40be-8b17-61e6037e9d8e", - "externalDomain": "darksky", - "externalId": "51.43222,6.76111-edcd704b", - "name": "Duisburg, Noordrijn-Westfalen, Duitsland", - "description": "", - "additionalInfo": {}, - "deviceTemplateId": "a9c12700-3394-4cee-80ad-696173ceb250", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - }, - { - "id": "b4f3ca19-1648-4df1-a83d-089c8064a6ff", - "externalDomain": ["kpn-lora", "modelapi"], - "externalId": "70B3D57050004636", - "name": "70B3D57050004636", - "description": "6kg sensor", - "additionalInfo": {}, - "deviceTemplateId": "7be8a213-65e9-4084-b73b-9d5cfcc46cc0", - "organizationId": "46224b7f-bf6e-4a14-8844-c8d9258a58bf" - }, - { - "id": "b61c30d1-9281-4fc7-ab70-a43861fe0264", - "externalDomain": ["kpn-lora", "modelapi"], - "externalId": "70B3D5705000471F", - "name": "70B3D5705000471F", - "description": "", - "additionalInfo": {}, - "deviceTemplateId": "7be8a213-65e9-4084-b73b-9d5cfcc46cc0", - "organizationId": "46224b7f-bf6e-4a14-8844-c8d9258a58bf" - }, - { - "id": "c97e36da-8274-43aa-a226-7e1bf8b943b0", - "externalDomain": ["kpn-lora", "modelapi"], - "externalId": "70B3D5705000473C", - "name": "70B3D5705000473C", - "description": "", - "additionalInfo": {}, - "deviceTemplateId": "7be8a213-65e9-4084-b73b-9d5cfcc46cc0", - "organizationId": "46224b7f-bf6e-4a14-8844-c8d9258a58bf" - }, - { - "id": "e359048e-8877-478c-bcb7-a9908a750301", - "externalDomain": "default", - "externalId": "afc6ece6-20fb-493d-8220-ade23d29c3b9", - "name": "Aris - Plant Surface Area - 4", - "description": "", - "additionalInfo": {}, - "deviceTemplateId": "7b806473-417c-467b-a4c8-5caa5615704f", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - }, - { - "id": "e5728985-f4f5-4b9a-ae32-9d6ae40f9f53", - "externalDomain": ["kpn-lora", "modelapi"], - "externalId": "70B3D5705000461C", - "name": "70B3D5705000461C", - "description": "6kg sensor", - "additionalInfo": { - "location": { "latitude": 51.28905, "longitude": 6.042781 } - }, - "deviceTemplateId": "7be8a213-65e9-4084-b73b-9d5cfcc46cc0", - "organizationId": "46224b7f-bf6e-4a14-8844-c8d9258a58bf" - }, - { - "id": "e5951137-6b18-472c-944b-fc45a2b58b0f", - "externalDomain": "default", - "externalId": "70B3D57050004EF4-status", - "name": "Device 2", - "description": "", - "additionalInfo": {}, - "deviceTemplateId": "cb64266d-77d2-44a6-8626-1fc7f3dd5818", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - }, - { - "id": "e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0", - "externalDomain": "ttn", - "externalId": "70B3D57050004EF4", - "name": "70B3D57050004EF4 (replaces 70B3D57050004EEF)", - "description": "", - "additionalInfo": { "location": {} }, - "deviceTemplateId": "84435db4-2eeb-4141-b09e-302e67e94a60", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - }, - { - "id": "f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632", - "externalDomain": "ttn", - "externalId": "70B3D57050006223", - "name": "70B3D57050006223", - "description": "", - "additionalInfo": { "location": {} }, - "deviceTemplateId": "3c6fa253-4eb5-4345-812f-180b349d935b", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - }, - { - "id": "fd694041-581e-4c2c-9810-505e62b762e6", - "externalDomain": "ttn", - "externalId": "70B3D570500042D7", - "name": "042D7 - EC, bodemvocht en bodemtemperatuur", - "description": "", - "additionalInfo": { "location": {} }, - "deviceTemplateId": "ddafe2db-404f-487f-bfd9-b060254daa15", - "organizationId": "fca1ed1a-ce91-4e83-b438-7dd09530d5a2" - } -] diff --git a/src/main/java/Data/f75934dc-af98-4206-a5bd-22d23dd5f268.json b/src/main/java/Data/f75934dc-af98-4206-a5bd-22d23dd5f268.json deleted file mode 100644 index 7d8c66f..0000000 --- a/src/main/java/Data/f75934dc-af98-4206-a5bd-22d23dd5f268.json +++ /dev/null @@ -1 +0,0 @@ -[{"sensorId":"f75934dc-af98-4206-a5bd-22d23dd5f268","datetimeMeasure":"2022-02-07T14:03:11.380Z","value":10.87,"groupId":null,"metadata":null}]temperature,6c9efd4a-db04-453d-8ab8-d480ec97dd26 \ No newline at end of file diff --git a/src/main/java/Data/ff6f11e0-c969-4cbb-829c-f44a13683918.json b/src/main/java/Data/ff6f11e0-c969-4cbb-829c-f44a13683918.json deleted file mode 100644 index 3ae4761..0000000 --- a/src/main/java/Data/ff6f11e0-c969-4cbb-829c-f44a13683918.json +++ /dev/null @@ -1 +0,0 @@ -[{"sensorId":"ff6f11e0-c969-4cbb-829c-f44a13683918","datetimeMeasure":"2022-02-07T14:03:11.380Z","value":104.5,"groupId":null,"metadata":null}]precipitation,6c9efd4a-db04-453d-8ab8-d480ec97dd26 \ No newline at end of file diff --git a/src/main/java/Data/ffca826c-d1b5-4ac8-869a-ec0da15d9076.json b/src/main/java/Data/ffca826c-d1b5-4ac8-869a-ec0da15d9076.json deleted file mode 100644 index e69319d..0000000 --- a/src/main/java/Data/ffca826c-d1b5-4ac8-869a-ec0da15d9076.json +++ /dev/null @@ -1 +0,0 @@ -[{"sensorId":"ffca826c-d1b5-4ac8-869a-ec0da15d9076","datetimeMeasure":"2022-02-07T14:02:22.219Z","value":5.137,"groupId":null,"metadata":null}]battery,e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0 \ No newline at end of file diff --git a/src/main/java/Data/securityToken.txt b/src/main/java/Data/securityToken.txt deleted file mode 100644 index 2f55a71..0000000 --- a/src/main/java/Data/securityToken.txt +++ /dev/null @@ -1 +0,0 @@ -7xbfDipaUsbuq6FRsmKSqaGhQdaWHJ3cwG0XGwjNG0ta84Mpf3QQP2abqo5f8G68 \ No newline at end of file diff --git a/src/main/java/Files/ReadFile.java b/src/main/java/Files/ReadFile.java deleted file mode 100644 index a9730bf..0000000 --- a/src/main/java/Files/ReadFile.java +++ /dev/null @@ -1,26 +0,0 @@ -package Files; - -import java.io.File; // Import the File class -import java.io.FileNotFoundException; // Import this class to handle errors -import java.util.Scanner; // Import the Scanner class to read text files - -public class ReadFile { - - public String data; - - public String ReadFromFile(String path) { - try { - File myObj = new File(path); - Scanner myReader = new Scanner(myObj); - while (myReader.hasNextLine()) { - data = myReader.nextLine(); - System.out.println(data); - } - myReader.close(); - } catch (FileNotFoundException e) { - System.out.println("An error occurred."); - e.printStackTrace(); - } - return data; - } -} diff --git a/src/main/java/Files/WriteFile.java b/src/main/java/Files/WriteFile.java deleted file mode 100644 index 4f3b4d8..0000000 --- a/src/main/java/Files/WriteFile.java +++ /dev/null @@ -1,34 +0,0 @@ -package Files; - -import java.io.*; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeoutException; - -public class WriteFile { - - BufferedWriter buffer = null; - - public void WriteFile(String path, String input) throws Exception { - try { - File file = new File(path); - if (!file.exists()) { - file.createNewFile(); - } - - FileWriter fileWriter = new FileWriter(path); - buffer = new BufferedWriter(fileWriter); - buffer.write(input); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - try { - if (buffer != null) buffer.flush(); - // buffer.close(); - } catch (Exception ex) { - System.out.println("Error in closing the BufferedWriter" + ex); - } - } - } -} diff --git a/src/main/java/HttpCall/HttpGet.java b/src/main/java/HttpCall/HttpGet.java deleted file mode 100644 index fd75262..0000000 --- a/src/main/java/HttpCall/HttpGet.java +++ /dev/null @@ -1,46 +0,0 @@ -package HttpCall; - -import java.net.URI; -import java.net.URISyntaxException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -public class HttpGet { - - public String HttpGetCall(String baseURL, String token) - throws InterruptedException, ExecutionException, TimeoutException { - var client = HttpClient - .newBuilder() - .version(HttpClient.Version.HTTP_1_1) - .followRedirects(HttpClient.Redirect.ALWAYS) - .build(); - HttpRequest request = null; - try { - request = - HttpRequest - .newBuilder(new URI(baseURL)) - .setHeader("Authorization", token) - // .setHeader("access_token", token) - .setHeader("Content-Type", "application/json") - .setHeader("Accept", "application/json") - .header("Authority", "https://api.dev.whysor.com/") - .build(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } - CompletableFuture> response = client.sendAsync( - request, - HttpResponse.BodyHandlers.ofString() - ); - String result = response - .thenApply(HttpResponse::body) - .get(5, TimeUnit.SECONDS); - - return result; - } -} diff --git a/src/main/java/HttpCall/HttpPost.java b/src/main/java/HttpCall/HttpPost.java deleted file mode 100644 index 3b71411..0000000 --- a/src/main/java/HttpCall/HttpPost.java +++ /dev/null @@ -1,41 +0,0 @@ -package HttpCall; - -import java.net.URI; -import java.net.URISyntaxException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.TimeUnit; - -public class HttpPost { - - public String HttpCallPost(String baseUrl, String body) throws Exception { - var client = HttpClient - .newBuilder() - .version(HttpClient.Version.HTTP_1_1) - .followRedirects(HttpClient.Redirect.ALWAYS) - .build(); - HttpRequest request = null; - try { - request = - HttpRequest - .newBuilder(new URI(baseUrl)) - .POST(HttpRequest.BodyPublishers.ofString(body)) - .setHeader("Content-Type", "application/json") - .setHeader("Accept", "application/json") - .build(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } - - CompletableFuture> response = client.sendAsync( - request, - HttpResponse.BodyHandlers.ofString() - ); - String result = response - .thenApply(HttpResponse::body) - .get(5, TimeUnit.SECONDS); - return result; - } -} diff --git a/src/main/java/JSON2RDF/JSON2RDF.java b/src/main/java/JSON2RDF/JSON2RDF.java deleted file mode 100644 index 387c9d5..0000000 --- a/src/main/java/JSON2RDF/JSON2RDF.java +++ /dev/null @@ -1,77 +0,0 @@ -//package JSON2RDF; -// -//import java.io.*; -//import java.net.URI; -//import java.net.URISyntaxException; -//import java.nio.charset.Charset; -//import java.nio.charset.StandardCharsets; -// -// -//import org.json.simple.JSONArray; -//import org.json.simple.parser.JSONParser; -//import org.json.simple.parser.ParseException; -// -//import org.apache.jena.riot.system.StreamRDF; -//import org.apache.jena.riot.system.StreamRDFLib; -//import picocli.CommandLine; -// -//@CommandLine.Command(name = "json2rdf") -//public class JSON2RDF { -// private final InputStream jsonIn; -// private final OutputStream rdfOut; -// -// -// @CommandLine.Parameters(paramLabel = "https://localhost/" , index = "0", description = "Base URI of the RDF output data") -// private URI baseURI; -// -// { -// try { -// baseURI = new URI("https://localhost/"); -// } catch (URISyntaxException e) { -// e.printStackTrace(); -// } -// } -// -//// @CommandLine.Parameters(paramLabel = "D:\\WORK\\GGD\\src\\eu.hsrw.ias.ggd.MainExe\\java\\Data", description = "json file") -// @CommandLine.Option(names = { "--input-charset" }, description = "Input charset (default: ${DEFAULT-VALUE})") -// private final Charset inputCharset = StandardCharsets.UTF_8; -// -// @CommandLine.Option(names = { "--output-charset" }, description = "Output charset (default: ${DEFAULT-VALUE})") -// private final Charset outputCharset = StandardCharsets.UTF_8; -// -// public static void main(String[] args) throws IOException -// { -// JSON2RDF json2rdf = new JSON2RDF(System.in, System.out); -// -// try -// { -// CommandLine.ParseResult parseResult = new CommandLine(json2rdf).parseArgs(args); -// if (!CommandLine.printHelpIfRequested(parseResult)) json2rdf.convert(); -// } -// catch (CommandLine.ParameterException ex) -// { // command line arguments could not be parsed -// System.err.println(ex.getMessage()); -// ex.getCommandLine().usage(System.err); -// } -// } -// -// public JSON2RDF(InputStream csvIn, OutputStream rdfOut) { -// -// -// this.jsonIn = csvIn; -// this.rdfOut = rdfOut; -// } -// -// -// public void convert() throws IOException { -// if (jsonIn.available() == 0) throw new IllegalStateException("JSON input not provided"); -// -// try (Reader reader = new BufferedReader(new InputStreamReader(jsonIn, inputCharset))) -// { -// StreamRDF rdfStream = StreamRDFLib.writer(new BufferedWriter(new OutputStreamWriter(rdfOut, outputCharset))); -// new JsonStreamRDFWriter(reader, rdfStream, baseURI.toString()).convert(); -// } -// } -// -//} -// diff --git a/src/main/java/JSON2RDF/JsonStreamRDFWriter.java b/src/main/java/JSON2RDF/JsonStreamRDFWriter.java deleted file mode 100644 index a87ed8a..0000000 --- a/src/main/java/JSON2RDF/JsonStreamRDFWriter.java +++ /dev/null @@ -1,124 +0,0 @@ -//package JSON2RDF; -// -//import java.io.InputStream; -//import java.io.Reader; -//import java.util.ArrayDeque; -//import java.util.Deque; -//import java.util.HashMap; -//import java.util.Map; -//import javax.json.Json; -//import javax.json.stream.JsonParser; -//import org.apache.jena.datatypes.xsd.XSDDatatype; -//import org.apache.jena.graph.Node; -//import org.apache.jena.graph.NodeFactory; -//import org.apache.jena.graph.Triple; -//import org.apache.jena.riot.system.IRIResolver; -//import org.apache.jena.riot.system.StreamRDF; -// -// -//public class JsonStreamRDFWriter -//{ -// -// private final JsonParser parser; -// private final StreamRDF rdfStream; -// private final IRIResolver iriResolver; -// -// public JsonStreamRDFWriter(Reader reader, StreamRDF rdfStream, String baseURI) -// { -// this(Json.createParser(reader), rdfStream, baseURI); -// } -// -// public JsonStreamRDFWriter(InputStream is, StreamRDF rdfStream, String baseURI) -// { -// this(Json.createParser(is), rdfStream, baseURI); -// } -// -// public JsonStreamRDFWriter(JsonParser parser, StreamRDF rdfStream, String baseURI) -// { -// this.parser = parser; -// this.rdfStream = rdfStream; -// this.iriResolver = IRIResolver.create(baseURI); -// } -// -// public void convert() -// { -// getStreamRDF().start(); -// -// write(getParser(), getStreamRDF(), getIRIResolver()); -// -// getStreamRDF().finish(); -// } -// -// public static void write(JsonParser parser, StreamRDF rdfStream, IRIResolver iriResolver) -// { -// Deque subjectStack = new ArrayDeque<>(); -// Map arrayProperties = new HashMap<>(); -// -// Node property = null; -// while (parser.hasNext()) -// { -// JsonParser.Event event = parser.next(); -// -// switch (event) -// { -// case START_ARRAY: -// if (!subjectStack.isEmpty() && property != null) arrayProperties.put(subjectStack.getLast(), property); -// break; -// case END_ARRAY: -// if (!subjectStack.isEmpty()) arrayProperties.remove(subjectStack.getLast()); -// break; -// case START_OBJECT: -// Node subject = NodeFactory.createBlankNode(); -// // add triple with current array property, if any -// if (property != null && !subjectStack.isEmpty()) rdfStream.triple(new Triple(subjectStack.getLast(), property, subject)); -// subjectStack.addLast(subject); -// break; -// case END_OBJECT: -// subjectStack.removeLast(); -// // restore previous array property, if there was any -// if (!subjectStack.isEmpty() && arrayProperties.containsKey(subjectStack.getLast())) property = arrayProperties.get(subjectStack.getLast()); -// break; -// case VALUE_FALSE: -// rdfStream.triple(new Triple(subjectStack.getLast(), property, NodeFactory.createLiteralByValue(Boolean.FALSE, XSDDatatype.XSDboolean))); -// break; -// case VALUE_TRUE: -// rdfStream.triple(new Triple(subjectStack.getLast(), property, NodeFactory.createLiteralByValue(Boolean.TRUE, XSDDatatype.XSDboolean))); -// break; -// case KEY_NAME: -// property = NodeFactory.createURI(iriResolver.resolveToString("#" + parser.getString())); -// break; -// case VALUE_STRING: -// if (property != null) rdfStream.triple(new Triple(subjectStack.getLast(), property, NodeFactory.createLiteral(parser.getString()))); -// break; -// case VALUE_NUMBER: -// try -// { -// rdfStream.triple(new Triple(subjectStack.getLast(), property,NodeFactory.createLiteralByValue(Integer.valueOf(parser.getString()), XSDDatatype.XSDint))); -// } -// catch (NumberFormatException ex) -// { -// rdfStream.triple(new Triple(subjectStack.getLast(), property,NodeFactory.createLiteralByValue(Float.valueOf(parser.getString()), XSDDatatype.XSDfloat))); -// } -// break; -// case VALUE_NULL: -// break; -// } -// } -// } -// -// protected JsonParser getParser() -// { -// return parser; -// } -// -// protected StreamRDF getStreamRDF() -// { -// return rdfStream; -// } -// -// protected IRIResolver getIRIResolver() -// { -// return iriResolver; -// } -// -//} diff --git a/src/main/java/JSON_Unpack/GeneralCall4AllDevices.java b/src/main/java/JSON_Unpack/GeneralCall4AllDevices.java deleted file mode 100644 index b498bf3..0000000 --- a/src/main/java/JSON_Unpack/GeneralCall4AllDevices.java +++ /dev/null @@ -1,29 +0,0 @@ -package JSON_Unpack; - -import Credentials.UserCredentials; -import Files.WriteFile; -import HttpCall.HttpGet; -import org.json.JSONArray; - -//Get a list of all devices -public class GeneralCall4AllDevices { - - public static String FetchAll(String token) throws Exception { - String extension = "devices"; - UserCredentials userCredentials = new UserCredentials(); - WriteFile writingIntoFile = new WriteFile(); - - String baseURL = userCredentials.getBaseURL(); - String homeRoot = UserCredentials.getHomeRoot(); - String devUrl = userCredentials.getDevUrl(); - HttpGet httpCall = new HttpGet(); - - String fetchAll = httpCall.HttpGetCall( - devUrl + extension + "?access_token=" + token, - token - ); - writingIntoFile.WriteFile(homeRoot + extension + "Output.json", fetchAll); - - return fetchAll; - } -} diff --git a/src/main/java/JSON_Unpack/ReadSensors4Partner.java b/src/main/java/JSON_Unpack/ReadSensors4Partner.java deleted file mode 100644 index aa4302a..0000000 --- a/src/main/java/JSON_Unpack/ReadSensors4Partner.java +++ /dev/null @@ -1,87 +0,0 @@ -package JSON_Unpack; - -import Credentials.UserCredentials; -import Files.WriteFile; -import HttpCall.HttpGet; -import java.util.ArrayList; -import org.json.JSONArray; -import org.json.JSONObject; - -///url/sensors/id/read - -public class ReadSensors4Partner { - - public ArrayList FetchSensor4Box(String companyName, String token) - throws Exception { - switch (companyName) { - case "Germes": - return SensorRead("Germes", token); - case "Heufs": - return SensorRead("Heufs", token); - case "Jacobs": - return SensorRead("Jacobs", token); - case "Nica": - return SensorRead("Nica", token); - } - return null; - } - - protected ArrayList SensorRead(String cName, String token) - throws Exception { - UserCredentials userCredentials = new UserCredentials(); - HttpGet httpCall = new HttpGet(); - WriteFile writingIntoFile = new WriteFile(); - - String baseURL = userCredentials.getBaseURL(); - String devUrl = userCredentials.getDevUrl(); - String homeRoot = UserCredentials.getHomeRoot(); - - ArrayList list = new ArrayList(); - char par = '"'; - - BoxCall4Partner boxCall4Partner = new BoxCall4Partner(); - ArrayList outputBox = boxCall4Partner.FetchBox(cName, token); - for (int i = 0; i < outputBox.size(); i++) { - JSONArray jsonArray = new JSONArray(outputBox.get(i)); - for (int j = 0; j < jsonArray.length(); j++) { - JSONObject jsonobject = jsonArray.getJSONObject(j); - String jsonID = jsonobject.getString("id"); - String jsonTag = jsonobject.getString("tag"); - String deviceID = jsonobject.getString("deviceId"); - String finalTag = - "," + - par + - "deviceId" + - par + - ":" + - deviceID + - "," + - par + - "sensorTag" + - par + - ":" + - jsonTag + - "}]"; - - String sensorOutput = httpCall.HttpGetCall( - devUrl + "sensors/" + jsonID + "/read" + "?access_token=" + token, - token - ); - if (sensorOutput.contains("error")) { - System.out.println(sensorOutput); - } else { - String modification = sensorOutput.replace("}]", ""); - String finalSensorOutput = modification + finalTag; - list.add(finalSensorOutput); - - writingIntoFile.WriteFile( - homeRoot + jsonID + ".json", - sensorOutput + jsonTag + "," + deviceID - ); - } - } - } - - return list; - } -} diff --git a/src/main/java/Knowledgebase/DroolsTest.java b/src/main/java/Knowledgebase/DroolsTest.java deleted file mode 100644 index 19e7732..0000000 --- a/src/main/java/Knowledgebase/DroolsTest.java +++ /dev/null @@ -1,53 +0,0 @@ -//package Knowledgebase; -// -//import org.json.JSONArray; -//import org.kie.api.KieServices; -//import org.kie.api.KieServices.Factory; -//import org.kie.api.runtime.KieContainer; -//import org.kie.api.runtime.KieSession; -//import org.kie.api.runtime.rule.FactHandle; -// -//import java.util.ArrayList; -//import java.util.HashMap; -//import java.util.Map; -// -//public class DroolsTest { -// private Map currMap= new HashMap<>(); -// -// public static final void main(String[] args) { -// try { -// KieServices ks = KieServices.Factory.get(); -// KieContainer kContainer = ks.getKieClasspathContainer(); -////Get the session named kseesion-rule that we defined in kmodule.xml above. -////Also by default the session returned is always stateful. -// KieSession kSession = kContainer.newKieSession("ksession-rule"); -// -// currMap.put("asd",12.2); -// setCurrMap("soilMoisture",10.1); -// currMap.put("soilConductivity",0.14); -// setCurrMap set= new SetCurrMap(); -// se -// -// -// FactHandle fact1; -// -// fact1 = kSession.insert(currMap); -// System.out.println(fact1); -// kSession.fireAllRules(); -// -//// System.out.println("The discount for the jewellery product " -//// + sensorReadings.getSensorTag() + " is " + sensorReadings.getValue()); -// -// } catch (Throwable t) { -// t.printStackTrace(); -// } -// } -// public Map getCurrMap() { -// return currMap; -// } -// -// public void setCurrMap(Map currMap) { -// this.currMap = currMap; -// } -// -//} diff --git a/src/main/java/eu/hsrw/ias/ggd/ApiCall.java b/src/main/java/eu/hsrw/ias/ggd/ApiCall.java deleted file mode 100644 index 2129529..0000000 --- a/src/main/java/eu/hsrw/ias/ggd/ApiCall.java +++ /dev/null @@ -1,78 +0,0 @@ -package eu.hsrw.ias.ggd; - -import Credentials.UserCredentials; -import Files.WriteFile; -import JSON_Unpack.ReadSensors4Partner; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import org.json.JSONArray; -import org.json.JSONObject; - -public class ApiCall { - - private static String token = "0"; - private static String oldId = "1"; - - public static Greenhouse FetchDataFromApi() throws Exception { - UserCredentials userCredentials = new UserCredentials(); - final String username = userCredentials.getUsername(); - final String password = userCredentials.getPassword(); - final String homeRoot = UserCredentials.getHomeRoot(); - String outputToken; - WriteFile writingIntoFile = new WriteFile(); - Date now; // to display current time - now = new Date(); - HashMap devices = new HashMap(); - - if (token.equals(oldId)) { - //do nothing - } else { - try { - outputToken = SecurityToken.OnCallMethod(username, password); - JSONObject obj = new JSONObject(outputToken); - token = obj.getString("id"); - - writingIntoFile.WriteFile(homeRoot + "securityToken.txt", token); - oldId = token; - } catch (Exception e) { - e.printStackTrace(); - } - } - - ReadSensors4Partner readSensors4Partner = new ReadSensors4Partner(); - ArrayList outputValue = - (readSensors4Partner.FetchSensor4Box("Germes", token)); - - for (int i = 0; i < outputValue.size(); i++) { - Device device; - JSONArray sensorDatas = new JSONArray(outputValue.get(i)); - - for (int j = 0; j < sensorDatas.length(); j++) { //15 - JSONObject sensorData = sensorDatas.getJSONObject(j); - - String deviceId = sensorData.getString("deviceId"); - - double value = sensorData.getDouble("value"); - String sensorTag = sensorData.getString("sensorTag"); - String sensorId = sensorData.getString("sensorId"); - - SensorData sd = new SensorData(sensorId, value, sensorTag); - - if (devices.containsKey(deviceId)) { - device = devices.get(deviceId); - device.addSensorData(sd); - } else { - device = new Device(deviceId); - device.addSensorData(sd); - devices.put(deviceId, device); - } - } - } - Greenhouse greenhouse = new Greenhouse(); - for (Device device : devices.values()) { - greenhouse.addDevice(device); - } - return greenhouse; - } -} diff --git a/src/main/java/eu/hsrw/ias/ggd/Device.java b/src/main/java/eu/hsrw/ias/ggd/Device.java deleted file mode 100644 index 5eba3a6..0000000 --- a/src/main/java/eu/hsrw/ias/ggd/Device.java +++ /dev/null @@ -1,105 +0,0 @@ -package eu.hsrw.ias.ggd; - -import java.util.LinkedList; -import java.util.List; - -public class Device { - - private String id; - private String externalID; - private List data; - private Severity state = Severity.Unknown; - - public Device(String identifier) { - this.id = identifier; - this.data = new LinkedList(); - } - - public void addSensorData(SensorData d) { - this.data.add(d); - } - - public List getSensorData() { - return data; - } - - public String getId() { - return id; - } - - public String setId(String id) { - this.id = id; - return id; - } - - public void setExternalID(String externalID) { - this.externalID = externalID; - } - - public String getExternalID() { - return externalID; - } - - public String IdMapper(String id) { - switch (id) { - case "fd694041-581e-4c2c-9810-505e62b762e6": - return setId("70B3D570500042D7"); - case "e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0": - return setId("70B3D57050004EF4"); - case "f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632": - return setId("70B3D57050006223"); - case "6c9efd4a-db04-453d-8ab8-d480ec97dd26": - return setId("70B3D5705000623C"); - default: - return "NO Working id was found"; - } - } - - public Boolean hasTag(String tag) { - for (SensorData sensorData : data) { - if (sensorData.getTag() == tag) return true; - } - return false; - } - - public SensorData getSensorDataByTag(String tag) { - for (SensorData sd : data) { - if (sd.getTag() == tag) return sd; - } - return null; - } - - public SensorData getSensorDataById(String id) { - for (SensorData sd : data) { - if (sd.getSensorId() == id) return sd; - } - return null; - } - - public String toString() { - String str = "Device: '" + id + "', data: ["; - - for (SensorData sd : data) { - str += "SensorData(id: '" + sd.getSensorId() + "',"; - str += " tag: '" + sd.getTag() + "',"; - str += " value: " + sd.getValue() + ")"; - } - - return str + "]"; - } - - public Device(String id, List data) { - this.id = id; - this.data = data; - } - - public void setState(Severity state) { - if (this.state != Severity.Critical) { - this.state = state; - } - } - - public Severity getState() { - return state; - } -} diff --git a/src/main/java/eu/hsrw/ias/ggd/Greenhouse.java b/src/main/java/eu/hsrw/ias/ggd/Greenhouse.java deleted file mode 100644 index 107144b..0000000 --- a/src/main/java/eu/hsrw/ias/ggd/Greenhouse.java +++ /dev/null @@ -1,50 +0,0 @@ -package eu.hsrw.ias.ggd; - -import java.util.ArrayList; -import java.util.List; - -public class Greenhouse { - - private String id = "8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - private Severity state = Severity.Unknown; - - public Greenhouse() { - this.devices = new ArrayList<>(); - } - - public Greenhouse(List devices) { - this.devices = devices; - } - - public void addDevice(Device device) { - this.devices.add(device); - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Severity getState() { - return state; - } - - public void setState(Severity state) { - if (this.state != Severity.Critical) { - this.state = state; - } - } - - public List getDevices() { - return devices; - } - - public void setDevices(List devices) { - this.devices = devices; - } - - private List devices; -} diff --git a/src/main/java/eu/hsrw/ias/ggd/Isis.java b/src/main/java/eu/hsrw/ias/ggd/Isis.java deleted file mode 100644 index ce8a1bf..0000000 --- a/src/main/java/eu/hsrw/ias/ggd/Isis.java +++ /dev/null @@ -1,32 +0,0 @@ -package eu.hsrw.ias.ggd; - -import HttpCall.HttpPost; - -public class Isis { - - public static String OnCallMethod(String deviceName, String sensorName) - throws Exception { - //CONFIG PARAMETERS: - //BEGIN------------CONFIG PARAMETERS BELOW TO YOUR ENVIRONMENT--------------------------------------- - String baseURL = - "https://api.dev.whysor.com/devices/readValueFromSpeech?access_token=2MreqC9fqXxFHJBEcrCL38LKhEaVcEHmEi6o45CwTV9SSgTAuZ93oiMfY3HVc2fj"; - final String body = String.format( - "{\"deviceName\": \"%s\", \"sensorName\": \"%s\", \"domain\": \"my.yookr.org\"}", - deviceName, - sensorName - ); - HttpPost httpMethodPost = new HttpPost(); - httpMethodPost.HttpCallPost(baseURL, body); - - return httpMethodPost.HttpCallPost(baseURL, body); - } - - public static void main(String[] args) { - try { - String output = OnCallMethod("Greenhouse 1", "status"); - System.out.println(output); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/src/main/java/eu/hsrw/ias/ggd/MainExe.java b/src/main/java/eu/hsrw/ias/ggd/MainExe.java deleted file mode 100644 index dddcded..0000000 --- a/src/main/java/eu/hsrw/ias/ggd/MainExe.java +++ /dev/null @@ -1,12 +0,0 @@ -package eu.hsrw.ias.ggd; - -import java.util.Timer; -//Before pushing files to the git run : npx prettier --write "**/*.java" -public class MainExe { - - public static void main(String[] args) { - Timer time = new Timer(); // Instantiate Timer Object - ScheduledTask scheduledTask = new ScheduledTask(); // Instantiate SheduledTask class - time.schedule(scheduledTask, 0, 1000 * 60 * 1); // Create Repetitively task for every 2 min - } -} diff --git a/src/main/java/eu/hsrw/ias/ggd/Notification.java b/src/main/java/eu/hsrw/ias/ggd/Notification.java deleted file mode 100644 index e0a364a..0000000 --- a/src/main/java/eu/hsrw/ias/ggd/Notification.java +++ /dev/null @@ -1,38 +0,0 @@ -package eu.hsrw.ias.ggd; - -public class Notification { - - private Severity severity = Severity.Optimal; - private String type; - private SensorData cause; - - public Notification(String t, SensorData d, Severity s) { - this.type = t; - this.cause = d; - this.severity = s; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public SensorData getCause() { - return cause; - } - - public void setCause(SensorData cause) { - this.cause = cause; - } - - public Severity getSeverity() { - return this.severity; - } - - public void setSeverity(Severity severity) { - this.severity = severity; - } -} diff --git a/src/main/java/eu/hsrw/ias/ggd/ScheduledTask.java b/src/main/java/eu/hsrw/ias/ggd/ScheduledTask.java deleted file mode 100644 index 4585344..0000000 --- a/src/main/java/eu/hsrw/ias/ggd/ScheduledTask.java +++ /dev/null @@ -1,54 +0,0 @@ -package eu.hsrw.ias.ggd; - -import org.kie.api.KieServices; -import org.kie.api.runtime.KieContainer; -import org.kie.api.runtime.KieSession; -import org.kie.api.runtime.rule.FactHandle; - -import java.util.HashMap; -import java.util.TimerTask; -import java.util.Date; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeoutException; - -// Create a class extends with TimerTask -public class ScheduledTask extends TimerTask { - - Date now; // to display current time - HashMap outputDevices ; - - // Add your task here - public void run() { - // Display current time - now = new Date(); // initialize date - System.out.println("Time is :" + now); - - try { - outputDevices = ApiCall.FetchDataFromApi(); - System.out.println("Final Size"+outputDevices.size()+outputDevices); - KieServices ks = KieServices.Factory.get(); - KieContainer kContainer = ks.getKieClasspathContainer(); - //Get the session named kseesion-rule that we defined in kmodule.xml above. - //Also by default the session returned is always stateful. - KieSession kSession = kContainer.newKieSession("ksession-rule"); - FactHandle fact1; - fact1 = kSession.insert(outputDevices); -// System.out.println(fact1); -// kSession.insert(fact1); - kSession.fireAllRules(); - - - } catch (InterruptedException e) { - e.printStackTrace(); - } catch (ExecutionException e) { - e.printStackTrace(); - } catch (TimeoutException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - - - } - -} \ No newline at end of file diff --git a/src/main/java/eu/hsrw/ias/ggd/SecurityToken.java b/src/main/java/eu/hsrw/ias/ggd/SecurityToken.java deleted file mode 100644 index ba4ce1f..0000000 --- a/src/main/java/eu/hsrw/ias/ggd/SecurityToken.java +++ /dev/null @@ -1,23 +0,0 @@ -package eu.hsrw.ias.ggd; - -import HttpCall.HttpPost; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeoutException; - -public class SecurityToken { - - public static String OnCallMethod(String username, String password) - throws Exception { - //CONFIG PARAMETERS: - //BEGIN------------CONFIG PARAMETERS BELOW TO YOUR ENVIRONMENT--------------------------------------- - String baseURL = "https://api.whysor.com/users/login"; - String devURL = "https://api.dev.whysor.com/users/login"; - final String body = String.format( - "{\"email\": \"%s\", \"password\": \"%s\", \"domain\": \"my.dev.yookr.org\"}", - username, - password - ); - HttpPost httpMethodPost = new HttpPost(); - return httpMethodPost.HttpCallPost(devURL, body); - } -} diff --git a/src/main/java/eu/hsrw/ias/ggd/SensorMap.java b/src/main/java/eu/hsrw/ias/ggd/SensorMap.java deleted file mode 100644 index ca6d516..0000000 --- a/src/main/java/eu/hsrw/ias/ggd/SensorMap.java +++ /dev/null @@ -1,16 +0,0 @@ -package eu.hsrw.ias.ggd; - -import java.util.HashMap; - -public class SensorMap { - - private HashMap sensors = new HashMap(); - - public HashMap getSensors() { - return sensors; - } - - public void setSensors(HashMap sensors) { - this.sensors = sensors; - } -} diff --git a/src/main/java/eu/hsrw/ias/ggd/Severity.java b/src/main/java/eu/hsrw/ias/ggd/Severity.java deleted file mode 100644 index db5b982..0000000 --- a/src/main/java/eu/hsrw/ias/ggd/Severity.java +++ /dev/null @@ -1,10 +0,0 @@ -package eu.hsrw.ias.ggd; - -public enum Severity { - Optimal, - Info, - Warning, - Error, - Critical, - Unknown, -} diff --git a/src/main/resources/META-INF/kmodule.xml b/src/main/resources/META-INF/kmodule.xml deleted file mode 100644 index 6d1c326..0000000 --- a/src/main/resources/META-INF/kmodule.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/main/resources/maven/pom.properties b/src/main/resources/maven/pom.properties deleted file mode 100644 index 8ac1e8b..0000000 --- a/src/main/resources/maven/pom.properties +++ /dev/null @@ -1,3 +0,0 @@ -groupId=com.javainuse -artifactId=drools-hello-world -version=0.0.1-SNAPSHOT \ No newline at end of file diff --git a/src/main/resources/rules/CriticalBattery.drl b/src/main/resources/rules/CriticalBattery.drl deleted file mode 100644 index 0310a6e..0000000 --- a/src/main/resources/rules/CriticalBattery.drl +++ /dev/null @@ -1,126 +0,0 @@ -import java.util.HashMap; -import java.util.Map; -import eu.hsrw.ias.ggd.SensorData -import javax.swing.JOptionPane -import HttpCall.HttpPost -import eu.hsrw.ias.ggd.Notification -import eu.hsrw.ias.ggd.Severity; -import eu.hsrw.ias.ggd.Device; - - -rule "CriticalBattery" - when - device: Device(sensorDatas: sensorData) - sensorData: SensorData(tag == "battery", value < 4.0) from sensorDatas - - then - - String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - final String criticalBatteryOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Battery %s in the following sensor %s \", \"battery\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalBatteryOutput); - insert(new Notification("battery", sensorData, Severity.Critical)); - -// modify(sensorData){ -// setState(Severity.Critical) -// } - -end - -rule "OptimalBattery" - when - device: Device(sensorDatas: sensorData) - sensorData: SensorData(tag == "battery", value > 4.0) from sensorDatas - - then - - String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - final String optimalBatteryOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal Battery %s in the following sensor %s \", \"battery\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",optimalBatteryOutput); - insert(new Notification("battery", sensorData, Severity.Optimal)); - -// modify(sensorData){ -// setState(Severity.Optimal) -// } - -end - - - - - - -// System.out.println(sensorData.getTag()+" "+sensorData.getValue()); -// System.out.println(device); - - /*String fixedIdG1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); -// System.out.println("Tag: '"+tag+"' has low battery with value: '"+level+"'"); - final String battery = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical! Low Battery %s \", \"battery\": %s}]}}", fixedIdG1,level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",battery); - System.out.println("Low Battery"+level+"in the following sensor"+tag); - */ - /*HttpPost httpPost = new HttpPost(); - - final String finalOutput; - boolean critical = false; - HashMap test = new HashMap<>(); - if (tag.equals("fd694041-581e-4c2c-9810-505e62b762e6")){ // This matches 70B3D570500042D7 - if (level < 7.2 && k.equals("battery") ) { - JOptionPane.showMessageDialog(null,"Low Battery : "+level+"! Please swap the battery soon of the following sensor:"+tag,"Low Battery Level",JOptionPane.INFORMATION_MESSAGE); - final String battery = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical! Low Battery %s \", \"battery\": %s}]}}", fixedIdG1,level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",battery); - System.out.println("Low Battery"+level+"in the following sensor"+tag); - critical = true; - test.put("battery",level); - } - if (level > 80 && k.equals("temperature") ) { - JOptionPane.showMessageDialog(null,"High Temperature : "+level+" in the following sensor: "+tag+"in the following device id: "+id,"Temperature",JOptionPane.INFORMATION_MESSAGE); - final String temperature = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical!High Temperature %s \", \"temperature\": %s}]}}", fixedIdG1,level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",temperature); - System.out.println("High Temp"); - critical = true; - } - if (level > 14.5 && k.equals("precipitation") ) { - JOptionPane.showMessageDialog(null,"High water level : "+level+" in the following sensor"+tag,"Precipitation",JOptionPane.INFORMATION_MESSAGE); - final String precipitation = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"High water level %s\", \"precipitation\": %s}]}}", fixedIdG1, level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",precipitation); - System.out.println("High water level"+level +" in the following sensor:"+tag); - critical = true; - } - if (level < 22 && k.equals("soilTemperature") ) { - JOptionPane.showMessageDialog(null,"Low soil temperature : "+level+" in the following sensor: "+tag+"in the following device id: "+id,"soil Temperature",JOptionPane.INFORMATION_MESSAGE); - final String soilTemperature = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Low soil temperature %s in the following sensor: %s \", \"soilTemperature\": %s}]}}", fixedIdG1,level, tag,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",soilTemperature); - System.out.println("Low soil Temperature"+level+" in the following sensor "+tag); - critical = true; - test.put("soilTemperature",level); - } - if (level <= 30 && k.equals("soilMoisture") ) { - JOptionPane.showMessageDialog(null,"Be Careful the soil is dry : "+level+" in the following sensor :"+tag +"in the device:"+id,"Soil Moisture",JOptionPane.INFORMATION_MESSAGE); - final String soilMoisture = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Be Careful the soil sensor %s is dry: %s \", \"soilMoisture\": %s}]}}", fixedIdG1,tag,level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",soilMoisture); - System.out.println("Soil is dry"+level+" in the following sensor"+tag); - critical = true; - } - if (level <= 0.57 && level >= 0.11 && k.equals("soilConductivity") ) { - JOptionPane.showMessageDialog(null,"Optimal EC levels in the soil : "+level+" in the following sensor"+tag,"Soil Conductivity",JOptionPane.INFORMATION_MESSAGE); - final String soilConductivity = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal EC levels in the soil %s\", \"soilConductivity\": %s}]}}", fixedIdG1, level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",soilConductivity); - System.out.println("Optimal EC levels in the soil"+level +" in the following sensor:"+tag); - critical = true; - } - if (level > 20 && k.equals("dielectricPermittivity") ) { - JOptionPane.showMessageDialog(null,"High dielectricPermittivity : "+level+" in the following sensor"+tag,"dielectricPermittivity",JOptionPane.INFORMATION_MESSAGE); - final String dielectricPermittivity = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"High dielectricPermittivity %s\", \"dielectricPermittivity\": %s}]}}", fixedIdG1, level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",dielectricPermittivity); - System.out.println("High dielectricPermittivity"+level +" in the following sensor:"+tag); - critical = true; - } -// if(critical == true){ -// finalOutput -// } - finalOutput = String.format("{\"id\":\"70B3D570500042D7-status\",\"data\":{\"measured\":[{ \"status\": \"The status of the device 1 is critical\",}]}}"); - System.out.println(finalOutput); - }*/ \ No newline at end of file diff --git a/src/main/resources/rules/CriticalPrecipitation.drl b/src/main/resources/rules/CriticalPrecipitation.drl deleted file mode 100644 index 1d32305..0000000 --- a/src/main/resources/rules/CriticalPrecipitation.drl +++ /dev/null @@ -1,24 +0,0 @@ -import java.util.HashMap; -import java.util.Map; -import eu.hsrw.ias.ggd.SensorData -import javax.swing.JOptionPane -import HttpCall.HttpPost -import eu.hsrw.ias.ggd.Notification -import eu.hsrw.ias.ggd.Severity; -import eu.hsrw.ias.ggd.Device; - -rule "CriticalPrecipitation" - when - device: Device(sensorDatas: sensorData) - sensorData: SensorData(tag == "precipitation", value > 15.5) from sensorDatas - then - String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - final String criticalPrecipitationOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Precipitation %s in the following sensor %s \", \"precipitation\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalPrecipitationOutput); - insert(new Notification("precipitation", sensorData, Severity.Warning)); - -// modify(sensorData){ -// setState(Severity.Critical) -// } -end diff --git a/src/main/resources/rules/CriticalSoilConductivity.drl b/src/main/resources/rules/CriticalSoilConductivity.drl deleted file mode 100644 index c42a0f9..0000000 --- a/src/main/resources/rules/CriticalSoilConductivity.drl +++ /dev/null @@ -1,7 +0,0 @@ -package rules; -dialect "mvel" - -rule "CriticalSoilConductivity" - when - then -end diff --git a/src/main/resources/rules/CriticalSoilTemperature.drl b/src/main/resources/rules/CriticalSoilTemperature.drl deleted file mode 100644 index d143850..0000000 --- a/src/main/resources/rules/CriticalSoilTemperature.drl +++ /dev/null @@ -1,7 +0,0 @@ -package rules; -dialect "mvel" - -rule "CriticalSoilTemperature" - when - then -end diff --git a/src/main/resources/rules/CriticalTemperature.drl b/src/main/resources/rules/CriticalTemperature.drl deleted file mode 100644 index 918f533..0000000 --- a/src/main/resources/rules/CriticalTemperature.drl +++ /dev/null @@ -1,42 +0,0 @@ -import java.util.HashMap; -import java.util.Map; -import eu.hsrw.ias.ggd.SensorData -import javax.swing.JOptionPane -import HttpCall.HttpPost -import eu.hsrw.ias.ggd.Notification -import eu.hsrw.ias.ggd.Severity; -import eu.hsrw.ias.ggd.Device; - -rule "CriticalTemperature" - when - device: Device(sensorDatas: sensorData) - sensorData: SensorData(tag == "temperature", value < 10.0 || value > 30.0) from sensorDatas - then - String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - final String criticalTemperatureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Temperature %s in the following device %s \", \"temperature\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalTemperatureOutput); - final String deviceCritical = String.format("{\"id\":\"%s-status\",\"data\":{\"measured\":[{ \"criticalStatus\": \"The status of %s device is critical\"}]}}",device.IdMapper(device.getId()),device.getId()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",deviceCritical); - System.out.println(deviceCritical); - insert(new Notification("temperature", sensorData, Severity.Critical)); - end - -rule "OptimalTemperature" - when - device: Device(sensorDatas: sensorData) - sensorData: SensorData(tag == "temperature", value > 10.0 && value < 30.0) from sensorDatas - then - String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - final String optimalTemperatureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal Temperature %s in the following device %s \", \"temperature\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",optimalTemperatureOutput); - insert(new Notification("temperature", sensorData, Severity.Optimal)); - System.out.println("Optimal"); - -// modify(sensorData){ -// setState(Severity.Optimal) -// } - - end - diff --git a/src/main/resources/rules/DielectricPermittivity.drl b/src/main/resources/rules/DielectricPermittivity.drl deleted file mode 100644 index 80e781f..0000000 --- a/src/main/resources/rules/DielectricPermittivity.drl +++ /dev/null @@ -1,20 +0,0 @@ -import java.util.HashMap; -import java.util.Map; -import eu.hsrw.ias.ggd.SensorData -import javax.swing.JOptionPane -import HttpCall.HttpPost -import eu.hsrw.ias.ggd.Notification -import eu.hsrw.ias.ggd.Severity; -import eu.hsrw.ias.ggd.Device; - -rule "DielectricPermittivity" - when - device: Device(sensorDatas: sensorData) - sensorData: SensorData(tag == "dielectricPermittivity", value > 20.0) from sensorDatas - then - String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - final String dielectricPermittivityOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical dielectricPermittivity %s in the following sensor %s \", \"dielectricPermittivityOutput\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",dielectricPermittivityOutput); - insert(new Notification("dielectricPermittivity", sensorData, Severity.Warning)); -end diff --git a/src/main/resources/rules/device-sensor-critical.drl b/src/main/resources/rules/device-sensor-critical.drl deleted file mode 100644 index 66cbf0d..0000000 --- a/src/main/resources/rules/device-sensor-critical.drl +++ /dev/null @@ -1,31 +0,0 @@ -import eu.hsrw.ias.ggd.Device; -import eu.hsrw.ias.ggd.Severity; -import eu.hsrw.ias.ggd.SensorData; - -rule "Sensor of device gone critical" -when - sensorData: SensorData(state == Severity.Critical) - device: Device(sensorData contains(sensorData)) -then - modify(device){ - setState(Severity.Critical) - } - System.out.println("Device: \n" + - "\tID: '" + device.getId() + "'" + - "\tState: '" + device.getState().toString() + "'" - ); - // Do something the info that a device is gone critical -end - -rule "Sensor of device gone optimal" -when - sensorData: SensorData(state == Severity.Optimal) - device: Device(sensorData contains(sensorData)) -then - modify(device){ - setState(Severity.Optimal) - } - - // Device is gone optimal -end - diff --git a/src/main/resources/rules/greenhouse_critical.drl b/src/main/resources/rules/greenhouse_critical.drl deleted file mode 100644 index 45ac9c2..0000000 --- a/src/main/resources/rules/greenhouse_critical.drl +++ /dev/null @@ -1,25 +0,0 @@ -import eu.hsrw.ias.ggd.Greenhouse; -import eu.hsrw.ias.ggd.Device; -import eu.hsrw.ias.ggd.Severity; - -rule "Device of greenhouse gone critical" -when - device: Device(state == Severity.Critical) - greenhouse: Greenhouse(devices contains(device)) - //greenhouse: Greenhouse(devices contains(Device(state == Severity.Critical))) -then - modify(greenhouse){ - setState(Severity.Critical) - } - System.out.println("Greenhouse: '" + greenhouse.getId() + "' is '" + greenhouse.getState().toString() + "'"); -end - -rule "Device of greenhouse has gone optimal" -when - device: Device(state == Severity.Optimal) - greenhouse: Greenhouse(devices contains(device)) -then - modify(greenhouse){ - setState(Severity.Optimal) - } -end diff --git a/src/main/resources/rules/optimal.drl b/src/main/resources/rules/optimal.drl deleted file mode 100644 index 950bda3..0000000 --- a/src/main/resources/rules/optimal.drl +++ /dev/null @@ -1,15 +0,0 @@ -import eu.hsrw.ias.ggd.Notification; -import eu.hsrw.ias.ggd.Severity -import HttpCall.HttpPost; -import eu.hsrw.ias.ggd.Device; - -rule "Green House Optimal" -when - warning: Notification(severity == Severity.Optimal) - -then - HttpPost httpPost = new HttpPost(); - final String optimalGreenhouse = String.format("{\"id\":\"germes-greenhouse-status\",\"data\":{\"measured\":[{ \"status\": \"The status of the greenhouse is optimal\"}]}}"); -// httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",optimalGreenhouse); - System.out.println("Green House optimal, because of: '"+warning.getType()+"'"); -end diff --git a/src/main/resources/rules/warnings.drl b/src/main/resources/rules/warnings.drl deleted file mode 100644 index bb4b855..0000000 --- a/src/main/resources/rules/warnings.drl +++ /dev/null @@ -1,15 +0,0 @@ -import eu.hsrw.ias.ggd.Notification; -import eu.hsrw.ias.ggd.Severity -import HttpCall.HttpPost; - -//rule "Green House Critical" -//when -// warning: Notification(severity > Severity.Warning) -//then -// HttpPost httpPost = new HttpPost(); -// final String criticalGreenhouse = String.format("{\"id\":\"germes-greenhouse-status\",\"data\":{\"measured\":[{ \"status\": \"The status of the greenhouse is critical\"}]}}"); -// httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalGreenhouse); -// System.out.println(criticalGreenhouse); -// System.out.println("Green House critical, because of: '"+warning.getType()+"'"); -// -//end \ No newline at end of file diff --git a/target/classes/META-INF/kmodule.xml b/target/classes/META-INF/kmodule.xml deleted file mode 100644 index 6d1c326..0000000 --- a/target/classes/META-INF/kmodule.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/target/classes/maven/pom.properties b/target/classes/maven/pom.properties deleted file mode 100644 index 8ac1e8b..0000000 --- a/target/classes/maven/pom.properties +++ /dev/null @@ -1,3 +0,0 @@ -groupId=com.javainuse -artifactId=drools-hello-world -version=0.0.1-SNAPSHOT \ No newline at end of file diff --git a/target/classes/rules/CriticalBattery.drl b/target/classes/rules/CriticalBattery.drl deleted file mode 100644 index 0310a6e..0000000 --- a/target/classes/rules/CriticalBattery.drl +++ /dev/null @@ -1,126 +0,0 @@ -import java.util.HashMap; -import java.util.Map; -import eu.hsrw.ias.ggd.SensorData -import javax.swing.JOptionPane -import HttpCall.HttpPost -import eu.hsrw.ias.ggd.Notification -import eu.hsrw.ias.ggd.Severity; -import eu.hsrw.ias.ggd.Device; - - -rule "CriticalBattery" - when - device: Device(sensorDatas: sensorData) - sensorData: SensorData(tag == "battery", value < 4.0) from sensorDatas - - then - - String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - final String criticalBatteryOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Battery %s in the following sensor %s \", \"battery\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalBatteryOutput); - insert(new Notification("battery", sensorData, Severity.Critical)); - -// modify(sensorData){ -// setState(Severity.Critical) -// } - -end - -rule "OptimalBattery" - when - device: Device(sensorDatas: sensorData) - sensorData: SensorData(tag == "battery", value > 4.0) from sensorDatas - - then - - String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - final String optimalBatteryOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal Battery %s in the following sensor %s \", \"battery\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",optimalBatteryOutput); - insert(new Notification("battery", sensorData, Severity.Optimal)); - -// modify(sensorData){ -// setState(Severity.Optimal) -// } - -end - - - - - - -// System.out.println(sensorData.getTag()+" "+sensorData.getValue()); -// System.out.println(device); - - /*String fixedIdG1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); -// System.out.println("Tag: '"+tag+"' has low battery with value: '"+level+"'"); - final String battery = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical! Low Battery %s \", \"battery\": %s}]}}", fixedIdG1,level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",battery); - System.out.println("Low Battery"+level+"in the following sensor"+tag); - */ - /*HttpPost httpPost = new HttpPost(); - - final String finalOutput; - boolean critical = false; - HashMap test = new HashMap<>(); - if (tag.equals("fd694041-581e-4c2c-9810-505e62b762e6")){ // This matches 70B3D570500042D7 - if (level < 7.2 && k.equals("battery") ) { - JOptionPane.showMessageDialog(null,"Low Battery : "+level+"! Please swap the battery soon of the following sensor:"+tag,"Low Battery Level",JOptionPane.INFORMATION_MESSAGE); - final String battery = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical! Low Battery %s \", \"battery\": %s}]}}", fixedIdG1,level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",battery); - System.out.println("Low Battery"+level+"in the following sensor"+tag); - critical = true; - test.put("battery",level); - } - if (level > 80 && k.equals("temperature") ) { - JOptionPane.showMessageDialog(null,"High Temperature : "+level+" in the following sensor: "+tag+"in the following device id: "+id,"Temperature",JOptionPane.INFORMATION_MESSAGE); - final String temperature = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical!High Temperature %s \", \"temperature\": %s}]}}", fixedIdG1,level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",temperature); - System.out.println("High Temp"); - critical = true; - } - if (level > 14.5 && k.equals("precipitation") ) { - JOptionPane.showMessageDialog(null,"High water level : "+level+" in the following sensor"+tag,"Precipitation",JOptionPane.INFORMATION_MESSAGE); - final String precipitation = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"High water level %s\", \"precipitation\": %s}]}}", fixedIdG1, level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",precipitation); - System.out.println("High water level"+level +" in the following sensor:"+tag); - critical = true; - } - if (level < 22 && k.equals("soilTemperature") ) { - JOptionPane.showMessageDialog(null,"Low soil temperature : "+level+" in the following sensor: "+tag+"in the following device id: "+id,"soil Temperature",JOptionPane.INFORMATION_MESSAGE); - final String soilTemperature = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Low soil temperature %s in the following sensor: %s \", \"soilTemperature\": %s}]}}", fixedIdG1,level, tag,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",soilTemperature); - System.out.println("Low soil Temperature"+level+" in the following sensor "+tag); - critical = true; - test.put("soilTemperature",level); - } - if (level <= 30 && k.equals("soilMoisture") ) { - JOptionPane.showMessageDialog(null,"Be Careful the soil is dry : "+level+" in the following sensor :"+tag +"in the device:"+id,"Soil Moisture",JOptionPane.INFORMATION_MESSAGE); - final String soilMoisture = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Be Careful the soil sensor %s is dry: %s \", \"soilMoisture\": %s}]}}", fixedIdG1,tag,level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",soilMoisture); - System.out.println("Soil is dry"+level+" in the following sensor"+tag); - critical = true; - } - if (level <= 0.57 && level >= 0.11 && k.equals("soilConductivity") ) { - JOptionPane.showMessageDialog(null,"Optimal EC levels in the soil : "+level+" in the following sensor"+tag,"Soil Conductivity",JOptionPane.INFORMATION_MESSAGE); - final String soilConductivity = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal EC levels in the soil %s\", \"soilConductivity\": %s}]}}", fixedIdG1, level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",soilConductivity); - System.out.println("Optimal EC levels in the soil"+level +" in the following sensor:"+tag); - critical = true; - } - if (level > 20 && k.equals("dielectricPermittivity") ) { - JOptionPane.showMessageDialog(null,"High dielectricPermittivity : "+level+" in the following sensor"+tag,"dielectricPermittivity",JOptionPane.INFORMATION_MESSAGE); - final String dielectricPermittivity = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"High dielectricPermittivity %s\", \"dielectricPermittivity\": %s}]}}", fixedIdG1, level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",dielectricPermittivity); - System.out.println("High dielectricPermittivity"+level +" in the following sensor:"+tag); - critical = true; - } -// if(critical == true){ -// finalOutput -// } - finalOutput = String.format("{\"id\":\"70B3D570500042D7-status\",\"data\":{\"measured\":[{ \"status\": \"The status of the device 1 is critical\",}]}}"); - System.out.println(finalOutput); - }*/ \ No newline at end of file diff --git a/target/classes/rules/CriticalPrecipitation.drl b/target/classes/rules/CriticalPrecipitation.drl deleted file mode 100644 index 1d32305..0000000 --- a/target/classes/rules/CriticalPrecipitation.drl +++ /dev/null @@ -1,24 +0,0 @@ -import java.util.HashMap; -import java.util.Map; -import eu.hsrw.ias.ggd.SensorData -import javax.swing.JOptionPane -import HttpCall.HttpPost -import eu.hsrw.ias.ggd.Notification -import eu.hsrw.ias.ggd.Severity; -import eu.hsrw.ias.ggd.Device; - -rule "CriticalPrecipitation" - when - device: Device(sensorDatas: sensorData) - sensorData: SensorData(tag == "precipitation", value > 15.5) from sensorDatas - then - String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - final String criticalPrecipitationOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Precipitation %s in the following sensor %s \", \"precipitation\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalPrecipitationOutput); - insert(new Notification("precipitation", sensorData, Severity.Warning)); - -// modify(sensorData){ -// setState(Severity.Critical) -// } -end diff --git a/target/classes/rules/CriticalSoilConductivity.drl b/target/classes/rules/CriticalSoilConductivity.drl deleted file mode 100644 index c42a0f9..0000000 --- a/target/classes/rules/CriticalSoilConductivity.drl +++ /dev/null @@ -1,7 +0,0 @@ -package rules; -dialect "mvel" - -rule "CriticalSoilConductivity" - when - then -end diff --git a/target/classes/rules/CriticalSoilMoisture.drl b/target/classes/rules/CriticalSoilMoisture.drl deleted file mode 100644 index 8340986..0000000 --- a/target/classes/rules/CriticalSoilMoisture.drl +++ /dev/null @@ -1,44 +0,0 @@ -import java.util.HashMap; -import java.util.Map; -import eu.hsrw.ias.ggd.SensorData -import javax.swing.JOptionPane -import HttpCall.HttpPost -import eu.hsrw.ias.ggd.Notification -import eu.hsrw.ias.ggd.Severity; -import eu.hsrw.ias.ggd.Device; - -rule "CriticalSoilMoisture" - when - device: Device(sensorDatas: sensorData) - sensorData: SensorData(tag == "soilMoisture", value < 28.0) from sensorDatas - then - String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - final String criticalSoilMoistureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Soil Moisture %s in the following device %s \", \"soilMoisture\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalSoilMoistureOutput); - final String deviceCritical = String.format("{\"id\":\"%s-status\",\"data\":{\"measured\":[{ \"criticalStatus\": \"The status of %s device is critical\"}]}}",device.IdMapper(device.getId()),device.getId()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",deviceCritical); - insert(new Notification("soilMoisture", sensorData, Severity.Critical)); - -// modify(device){ -// setState(Severity.Critical) -// } - -end - -rule "OptimalSoilMoisture" - when - device: Device(sensorDatas: sensorData) - sensorData: SensorData(tag == "soilMoisture", value > 28.0) from sensorDatas - then - String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - final String optimalSoilMoistureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal Soil Moisture %s in the following device %s \", \"soilMoisture\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",optimalSoilMoistureOutput); - insert(new Notification("soilMoisture", sensorData, Severity.Optimal)); - //device.setState(Severity.Optimal); - -// modify(device){ -// setState(Severity.Optimal) -// } -end \ No newline at end of file diff --git a/target/classes/rules/CriticalSoilTemperature.drl b/target/classes/rules/CriticalSoilTemperature.drl deleted file mode 100644 index d143850..0000000 --- a/target/classes/rules/CriticalSoilTemperature.drl +++ /dev/null @@ -1,7 +0,0 @@ -package rules; -dialect "mvel" - -rule "CriticalSoilTemperature" - when - then -end diff --git a/target/classes/rules/CriticalTemperature.drl b/target/classes/rules/CriticalTemperature.drl deleted file mode 100644 index 5472b34..0000000 --- a/target/classes/rules/CriticalTemperature.drl +++ /dev/null @@ -1,47 +0,0 @@ -import java.util.HashMap; -import java.util.Map; -import eu.hsrw.ias.ggd.SensorData -import javax.swing.JOptionPane -import HttpCall.HttpPost -import eu.hsrw.ias.ggd.Notification -import eu.hsrw.ias.ggd.Severity; -import eu.hsrw.ias.ggd.Device; - -rule "CriticalTemperature" - when - device: Device(sensorDatas: sensorData) - sensorData: SensorData(tag == "temperature", value < 10.0 || value > 30.0) from sensorDatas - then - String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - final String criticalTemperatureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Temperature %s in the following device %s \", \"temperature\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalTemperatureOutput); - final String deviceCritical = String.format("{\"id\":\"%s-status\",\"data\":{\"measured\":[{ \"criticalStatus\": \"The status of %s device is critical\"}]}}",device.IdMapper(device.getId()),device.getId()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",deviceCritical); - System.out.println(deviceCritical); - insert(new Notification("temperature", sensorData, Severity.Critical)); - -// modify(device){ -// setState(Severity.Critical) -// } - - end - -rule "OptimalTemperature" - when - device: Device(sensorDatas: sensorData) - sensorData: SensorData(tag == "temperature", value > 10.0 && value < 30.0) from sensorDatas - then - String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - final String optimalTemperatureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal Temperature %s in the following device %s \", \"temperature\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",optimalTemperatureOutput); - insert(new Notification("temperature", sensorData, Severity.Optimal)); - System.out.println("Optimal"); - -// modify(sensorData){ -// setState(Severity.Optimal) -// } - - end - diff --git a/target/classes/rules/DielectricPermittivity.drl b/target/classes/rules/DielectricPermittivity.drl deleted file mode 100644 index 80e781f..0000000 --- a/target/classes/rules/DielectricPermittivity.drl +++ /dev/null @@ -1,20 +0,0 @@ -import java.util.HashMap; -import java.util.Map; -import eu.hsrw.ias.ggd.SensorData -import javax.swing.JOptionPane -import HttpCall.HttpPost -import eu.hsrw.ias.ggd.Notification -import eu.hsrw.ias.ggd.Severity; -import eu.hsrw.ias.ggd.Device; - -rule "DielectricPermittivity" - when - device: Device(sensorDatas: sensorData) - sensorData: SensorData(tag == "dielectricPermittivity", value > 20.0) from sensorDatas - then - String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - final String dielectricPermittivityOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical dielectricPermittivity %s in the following sensor %s \", \"dielectricPermittivityOutput\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue()); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",dielectricPermittivityOutput); - insert(new Notification("dielectricPermittivity", sensorData, Severity.Warning)); -end diff --git a/target/classes/rules/device-sensor-critical.drl b/target/classes/rules/device-sensor-critical.drl deleted file mode 100644 index 66cbf0d..0000000 --- a/target/classes/rules/device-sensor-critical.drl +++ /dev/null @@ -1,31 +0,0 @@ -import eu.hsrw.ias.ggd.Device; -import eu.hsrw.ias.ggd.Severity; -import eu.hsrw.ias.ggd.SensorData; - -rule "Sensor of device gone critical" -when - sensorData: SensorData(state == Severity.Critical) - device: Device(sensorData contains(sensorData)) -then - modify(device){ - setState(Severity.Critical) - } - System.out.println("Device: \n" + - "\tID: '" + device.getId() + "'" + - "\tState: '" + device.getState().toString() + "'" - ); - // Do something the info that a device is gone critical -end - -rule "Sensor of device gone optimal" -when - sensorData: SensorData(state == Severity.Optimal) - device: Device(sensorData contains(sensorData)) -then - modify(device){ - setState(Severity.Optimal) - } - - // Device is gone optimal -end - diff --git a/target/classes/rules/greenhouse_critical.drl b/target/classes/rules/greenhouse_critical.drl deleted file mode 100644 index 45ac9c2..0000000 --- a/target/classes/rules/greenhouse_critical.drl +++ /dev/null @@ -1,25 +0,0 @@ -import eu.hsrw.ias.ggd.Greenhouse; -import eu.hsrw.ias.ggd.Device; -import eu.hsrw.ias.ggd.Severity; - -rule "Device of greenhouse gone critical" -when - device: Device(state == Severity.Critical) - greenhouse: Greenhouse(devices contains(device)) - //greenhouse: Greenhouse(devices contains(Device(state == Severity.Critical))) -then - modify(greenhouse){ - setState(Severity.Critical) - } - System.out.println("Greenhouse: '" + greenhouse.getId() + "' is '" + greenhouse.getState().toString() + "'"); -end - -rule "Device of greenhouse has gone optimal" -when - device: Device(state == Severity.Optimal) - greenhouse: Greenhouse(devices contains(device)) -then - modify(greenhouse){ - setState(Severity.Optimal) - } -end diff --git a/target/classes/rules/optimal.drl b/target/classes/rules/optimal.drl deleted file mode 100644 index 950bda3..0000000 --- a/target/classes/rules/optimal.drl +++ /dev/null @@ -1,15 +0,0 @@ -import eu.hsrw.ias.ggd.Notification; -import eu.hsrw.ias.ggd.Severity -import HttpCall.HttpPost; -import eu.hsrw.ias.ggd.Device; - -rule "Green House Optimal" -when - warning: Notification(severity == Severity.Optimal) - -then - HttpPost httpPost = new HttpPost(); - final String optimalGreenhouse = String.format("{\"id\":\"germes-greenhouse-status\",\"data\":{\"measured\":[{ \"status\": \"The status of the greenhouse is optimal\"}]}}"); -// httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",optimalGreenhouse); - System.out.println("Green House optimal, because of: '"+warning.getType()+"'"); -end diff --git a/target/classes/rules/warnings.drl b/target/classes/rules/warnings.drl deleted file mode 100644 index bb4b855..0000000 --- a/target/classes/rules/warnings.drl +++ /dev/null @@ -1,15 +0,0 @@ -import eu.hsrw.ias.ggd.Notification; -import eu.hsrw.ias.ggd.Severity -import HttpCall.HttpPost; - -//rule "Green House Critical" -//when -// warning: Notification(severity > Severity.Warning) -//then -// HttpPost httpPost = new HttpPost(); -// final String criticalGreenhouse = String.format("{\"id\":\"germes-greenhouse-status\",\"data\":{\"measured\":[{ \"status\": \"The status of the greenhouse is critical\"}]}}"); -// httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalGreenhouse); -// System.out.println(criticalGreenhouse); -// System.out.println("Green House critical, because of: '"+warning.getType()+"'"); -// -//end \ No newline at end of file