From b3bda8226b8f74c9ac6eac04f7fbec245b0a6f2b Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 10 Oct 2010 19:56:19 +0200 Subject: [PATCH] added prototype backward compability --- backend/lib/Controller/DataController.php | 11 ++++++++++- backend/lib/Definition/EntityDefinition.json | 6 +++--- backend/lib/Definition/PropertyDefinition.json | 3 ++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/backend/lib/Controller/DataController.php b/backend/lib/Controller/DataController.php index f15c19f..6c76d45 100644 --- a/backend/lib/Controller/DataController.php +++ b/backend/lib/Controller/DataController.php @@ -70,7 +70,16 @@ class DataController extends Controller { public function run($operation, array $identifiers = array()) { $ec = new EntityController($this->view, $this->em); - $identifiers[0] = $ec->get($identifiers[0]); + + if (count($identifiers) == 2) { // prototype: backend/data/uuid/port.json + $identifiers[0] = $ec->filter(array( + 'cuuid' => $identifiers[0], + 'port' => $identifiers[1] + )); + } + elseif (count($identifiers) == 1) { // assume UUID + $identifiers[0] = $ec->get($identifiers[0]); + } return parent::run($operation, $identifiers); } diff --git a/backend/lib/Definition/EntityDefinition.json b/backend/lib/Definition/EntityDefinition.json index e3fb9ec..6c1e8ac 100644 --- a/backend/lib/Definition/EntityDefinition.json +++ b/backend/lib/Definition/EntityDefinition.json @@ -47,7 +47,7 @@ { "name" : "power", "required" : ["title", "resolution"], - "optional" : ["description", "details:", "owner:", "address:", "tolerance"], + "optional" : ["description", "details:", "owner:", "address:", "tolerance", "port", "cuuid"], "icon" : "", // TODO look for an icon "unit" : "kW/h", "interpreter" : "Volkszaehler\\Interpreter\\MeterInterpreter", @@ -57,7 +57,7 @@ { "name" : "gas", "required" : ["title", "resolution"], - "optional" : ["description", "details:", "owner:", "address:", "tolerance"], + "optional" : ["description", "details:", "owner:", "address:", "tolerance", "port", "cuuid"], "icon" : "", // TODO look for an icon "unit" : "m³/h", "interpreter" : "Volkszaehler\\Interpreter\\MeterInterpreter", @@ -67,7 +67,7 @@ { "name" : "water", "required" : ["title", "resolution"], - "optional" : ["description", "details:", "owner:", "address:", "tolerance"], + "optional" : ["description", "details:", "owner:", "address:", "tolerance", "port", "cuuid"], "icon" : "", // TODO look for an icon "unit" : "m³/h", "interpreter" : "Volkszaehler\\Interpreter\\MeterInterpreter", diff --git a/backend/lib/Definition/PropertyDefinition.json b/backend/lib/Definition/PropertyDefinition.json index e38240c..d6e3038 100644 --- a/backend/lib/Definition/PropertyDefinition.json +++ b/backend/lib/Definition/PropertyDefinition.json @@ -300,7 +300,8 @@ { "name" : "cuuid", "type" : "string", - "max" : 37, + "max" : 36, + "pattern" : "/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/", "translation" : { "de" : "Cotroller UUID" } }, {