From 5b21bd77d5c0f23261bc8966d9c892fbd4e702ce Mon Sep 17 00:00:00 2001 From: "kevin.shehu" Date: Wed, 23 Jun 2021 23:35:42 +0200 Subject: [PATCH] FINALIZED : FULLY WORKING TODO : DATA MANIPULATION --- .idea/misc.xml | 30 +++++++++++++++++- pom.xml | 24 ++++++++------ src/main/java/ApiCall.java | 25 +++++++++++++-- src/main/java/Data/Germes.txt | 2 +- src/main/java/Data/Heufs.txt | 2 +- src/main/java/Data/securityToken.txt | 2 +- .../java/JSON_Unpack/BoxCall4Partner.java | 7 +++-- .../java/JSON_Unpack/ReadSensors4Partner.java | 14 ++++----- .../java/JSON_Unpack/Reading4AllSensors.java | 4 --- src/main/java/Knowledgebase/DroolsTest.java | 3 ++ src/main/java/Knowledgebase/Plants.java | 31 ------------------- .../java/Knowledgebase/SensorReadings.java | 22 +++++++++++++ src/main/resources/maven/pom.properties | 3 ++ .../{RuleEngine => rules}/TestRule.drl | 2 +- target/classes/RuleEngine/TestRule.drl | 14 --------- 15 files changed, 110 insertions(+), 75 deletions(-) delete mode 100644 src/main/java/JSON_Unpack/Reading4AllSensors.java delete mode 100644 src/main/java/Knowledgebase/Plants.java create mode 100644 src/main/java/Knowledgebase/SensorReadings.java create mode 100644 src/main/resources/maven/pom.properties rename src/main/resources/{RuleEngine => rules}/TestRule.drl (87%) delete mode 100644 target/classes/RuleEngine/TestRule.drl diff --git a/.idea/misc.xml b/.idea/misc.xml index 3fe5f5c..67fa7ec 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -11,7 +11,35 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index e910fb5..80c8d23 100644 --- a/pom.xml +++ b/pom.xml @@ -3,10 +3,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - + + 7.48.0.Final + org.example GGD 1.0-SNAPSHOT + @@ -17,12 +20,13 @@ 11 + + - - 7.48.0.Final - + + info.picocli picocli @@ -50,25 +54,25 @@ org.drools drools-core - 7.48.0.Final + ${runtime.version} org.drools drools-compiler - 7.48.0.Final + ${runtime.version} org.drools drools-decisiontables - 7.48.0.Final + ${runtime.version} org.drools kiebase-inclusion - 7.48.0.Final + ${runtime.version} runtime @@ -76,14 +80,14 @@ org.kie kie-api - 7.48.0.Final + ${runtime.version} provided org.kie kie-ci - 7.48.0.Final + ${runtime.version} diff --git a/src/main/java/ApiCall.java b/src/main/java/ApiCall.java index bb11460..1504d8f 100644 --- a/src/main/java/ApiCall.java +++ b/src/main/java/ApiCall.java @@ -1,8 +1,11 @@ import Credentials.UserCredentials; import Files.WriteFile; import JSON_Unpack.ReadSensors4Partner; +import Knowledgebase.SensorReadings; +import org.json.JSONArray; import org.json.JSONObject; +import java.lang.reflect.Array; import java.util.ArrayList; public class ApiCall { @@ -33,11 +36,29 @@ public class ApiCall { } } ReadSensors4Partner readSensors4Partner = new ReadSensors4Partner(); - String y = (readSensors4Partner.FetchSensor4Box("Germes",token)); + SensorReadings sensorReadings = new SensorReadings(); + String outputValue = (readSensors4Partner.FetchSensor4Box("Germes",token)); + System.out.println(outputValue); + String outputValueFixed=outputValue.replace("[[","[") +outputValue.replace("[{","{")+outputValue.replace("}]","}")+ outputValue.replace("]]","]"); + System.out.println(outputValueFixed); + JSONArray jsonArray = new JSONArray(outputValueFixed); + System.out.println(jsonArray.length()); + for(int j=0; j list=new ArrayList(); int loopTerminator = 0; - + char par = '"'; for(int j=0; j