Fixing a bug: error in string formatting to match field names.
authorrtrimana <rtrimana@uci.edu>
Fri, 2 Aug 2019 21:34:12 +0000 (14:34 -0700)
committerrtrimana <rtrimana@uci.edu>
Fri, 2 Aug 2019 21:34:12 +0000 (14:34 -0700)
Extractor/Extractor.groovy

index cd144b0..d2ef5c0 100644 (file)
@@ -351,8 +351,6 @@ def timeToday(String time, Object timeZone) {
 @Field boolVariable4
 @Field boolVariable5
 
-
-
 /////Input Methods/////
 //input "",""
 def input(String name, String type) {
@@ -386,12 +384,20 @@ def input(LinkedHashMap metaData) {
                println "Options: "+metaData['options']
        }
        def contains = 0
+       // Return if this capability has been instantiated
+       //if (metaData['type'].startsWith("device") || metaData['type'].startsWith("capability")) {
+       //      if (capabilitySet.contains(metaData['type'])) {
+       //              return
+       //      } else {
+       //              capabilitySet.add(metaData['type'])
+       //      }
+       //}
        switch(metaData['type']) {
                case "capability.lock":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"lockObject"')){
+                               if(line.contains("lockObject")){
                                        contains = 1
-                               }
+                           }
                        }
 
                        if (contains == 0) 
@@ -424,7 +430,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.alarm":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"alarmObject"')){
+                               if(line.contains("alarmObject")){
                                        contains = 1
                                }
                        }
@@ -459,7 +465,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.battery":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"batteryObject"')){
+                               if(line.contains("batteryObject")){
                                        contains = 1
                                }
                        }
@@ -494,7 +500,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.beacon":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"beaconSensorObject"')){
+                               if(line.contains("beaconSensorObject")){
                                        contains = 1
                                }
                        }
@@ -529,7 +535,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.carbonMonoxideDetector":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"carbonMonoxideDetectorObject"')){
+                               if(line.contains("carbonMonoxideDetectorObject")){
                                        contains = 1
                                }
                        }
@@ -564,7 +570,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.colorControl":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"colorControlObject"')){
+                               if(line.contains("colorControlObject")){
                                        contains = 1
                                }
                        }
@@ -599,7 +605,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.contactSensor":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"contactObject"')){
+                               if(line.contains("contactObject")){
                                        contains = 1
                                }
                        }
@@ -634,7 +640,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.doorControl":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"doorControlObject"')){
+                               if(line.contains("doorControlObject")){
                                        contains = 1
                                }
                        }
@@ -669,7 +675,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.energyMeter":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"energyMeterObject"')){
+                               if(line.contains("energyMeterObject")){
                                        contains = 1
                                }
                        }
@@ -704,7 +710,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.illuminanceMeasurement":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"illuminanceMeasurementObject"')){
+                               if(line.contains("illuminanceMeasurementObject")){
                                        contains = 1
                                }
                        }
@@ -739,7 +745,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.accelerationSensor":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"accelerationSensorObject"')){
+                               if(line.contains("accelerationSensorObject")){
                                        contains = 1
                                }
                        }
@@ -774,7 +780,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.motionSensor":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"motionSensorObject"')){
+                               if(line.contains("motionSensorObject")){
                                        contains = 1
                                }
                        }
@@ -809,7 +815,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.musicPlayer":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"musicPlayerObject"')){
+                               if(line.contains("musicPlayerObject")){
                                        contains = 1
                                }
                        }
@@ -844,7 +850,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.powerMeter":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"powerMeterObject"')){
+                               if(line.contains("powerMeterObject")){
                                        contains = 1
                                }
                        }
@@ -879,7 +885,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.presenceSensor":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"presenceSensorObject"')){
+                               if(line.contains("presenceSensorObject")){
                                        contains = 1
                                }
                        }
@@ -914,7 +920,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.relativeHumidityMeasurement":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"humidityMeasurementObject"')){
+                               if(line.contains("humidityMeasurementObject")){
                                        contains = 1
                                }
                        }
@@ -949,7 +955,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.relaySwitch":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"relaySwitchObject"')){
+                               if(line.contains("relaySwitchObject")){
                                        contains = 1
                                }
                        }
@@ -984,7 +990,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.sleepSensor":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"sleepSensorObject"')){
+                               if(line.contains("sleepSensorObject")){
                                        contains = 1
                                }
                        }
@@ -1019,7 +1025,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.smokeDetector":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"smokeDetectorObject"')){
+                               if(line.contains("smokeDetectorObject")){
                                        contains = 1
                                }
                        }
@@ -1054,7 +1060,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.stepSensor":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"stepSensorObject"')){
+                               if(line.contains("stepSensorObject")){
                                        contains = 1
                                }
                        }
@@ -1089,7 +1095,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.switch":               
                        globalObjects.eachLine { line ->
-                               if(line.contains('"switchObject"')){
+                               if(line.contains("switchObject")){
                                        contains = 1
                                }
                        }
@@ -1124,7 +1130,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.switchLevel":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"switchLevelObject"')){
+                               if(line.contains("switchLevelObject")){
                                        contains = 1
                                }
                        }
@@ -1159,7 +1165,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.temperatureMeasurement":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"temperatureMeasurementObject"')){
+                               if(line.contains("temperatureMeasurementObject")){
                                        contains = 1
                                }
                        }
@@ -1194,7 +1200,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.thermostat":
                        globalObjects.eachLine { line ->
-                               if(line.contains('thermostatObject')){
+                               if(line.contains("thermostatObject")){
                                        contains = 1
                                }
                        }
@@ -1229,7 +1235,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.valve":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"valveObject"')){
+                               if(line.contains("valveObject")){
                                        contains = 1
                                }
                        }
@@ -1264,7 +1270,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.speechSynthesis":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"speechSynthesisObject"')){
+                               if(line.contains("speechSynthesisObject")){
                                        contains = 1
                                }
                        }
@@ -1299,7 +1305,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.waterSensor":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"waterSensorObject"')){
+                               if(line.contains("waterSensorObject")){
                                        contains = 1
                                }
                        }
@@ -1334,7 +1340,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.touchSensor":
                        globalObjects.eachLine { line ->
-                               if(line.contains('"touchSensorObject"')){
+                               if(line.contains("touchSensorObject")){
                                        contains = 1
                                }
                        }
@@ -1369,7 +1375,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "capability.imageCapture":
                        contains = globalObjects.eachLine { line ->
-                               if(line.contains('"imageCaptureObject"')){
+                               if(line.contains("imageCaptureObject")){
                                        contains = 1
                                }
                        }
@@ -1404,7 +1410,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "device.mobilePresence":
                        contains = globalObjects.eachLine { line ->
-                               if(line.contains('"mobilePresenceObject"')){
+                               if(line.contains("mobilePresenceObject")){
                                        contains = 1
                                }
                        }
@@ -1439,7 +1445,7 @@ def input(LinkedHashMap metaData) {
                        break
                case "device.aeonKeyFob":
                        contains = globalObjects.eachLine { line ->
-                               if(line.contains('"aeonKeyFobObject"')){
+                               if(line.contains("aeonKeyFobObject")){
                                        contains = 1
                                }
                        }