From 6dcef639e2c37a631c4df626a41fc939310daa2d Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Tue, 6 Feb 2024 10:01:36 +0100 Subject: [PATCH 1/2] conver to millis from epoch all NGSI DateTIme --- .../cygnus/backends/arcgis/model/Feature.java | 5 ++-- .../ngsi_arcgis_featuretable_sink.md | 26 +++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/model/Feature.java b/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/model/Feature.java index 3d7afae07..44990d768 100644 --- a/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/model/Feature.java +++ b/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/model/Feature.java @@ -202,8 +202,9 @@ private void addProperty(JsonObject jsonObj, String name, Object property) { jsonObj.addProperty(name, (Boolean) property); break; case DATE_CLASSNAME: - simpleDateFormat = new SimpleDateFormat(DATE_PATTERN); - jsonObj.addProperty(name, simpleDateFormat.format((Date) property)); + // All NGSI DateTime are translated to Millis from Epoch (esriFieldTypeDate) + Date date = (Date) property; + jsonObj.addProperty(name, date.getTime()); break; case GREGORIAN_CALENDAR_CLASSNAME: simpleDateFormat = new SimpleDateFormat(DATE_PATTERN); diff --git a/doc/cygnus-ngsi/flume_extensions_catalogue/ngsi_arcgis_featuretable_sink.md b/doc/cygnus-ngsi/flume_extensions_catalogue/ngsi_arcgis_featuretable_sink.md index ba457594a..4549dd1b3 100644 --- a/doc/cygnus-ngsi/flume_extensions_catalogue/ngsi_arcgis_featuretable_sink.md +++ b/doc/cygnus-ngsi/flume_extensions_catalogue/ngsi_arcgis_featuretable_sink.md @@ -66,9 +66,9 @@ Let's see both configuration options: ###### Entity data in CB: - service = vehicles - service-path = /4wheels - entity-type = Car + service = vehicles + service-path = /4wheels + entity-type = Car If the Feature table for type "Car" is `https://arcgis.com/{hash}/arcgis/rest/services/vehicles/cars`, the subscription with custom notif would be: @@ -115,8 +115,8 @@ Note that to avoid using the name mappings to modify the unique field value of ` ###### result - Feature table url: https://arcgis.com/{hash}/arcgis/rest/services/vehicles/cars - Table's unique field: licensePlate + Feature table url: https://arcgis.com/{hash}/arcgis/rest/services/vehicles/cars + Table's unique field: licensePlate [Top](#top) @@ -124,13 +124,13 @@ Note that to avoid using the name mappings to modify the unique field value of ` ###### Agent.conf file: - agent.arcgis-sink.arcgis_service_url = https://arcgis.com/{hash}/arcgis/rest/services - agent.arcgis-sink.enable_name_mappings = true + agent.arcgis-sink.arcgis_service_url = https://arcgis.com/{hash}/arcgis/rest/services + agent.arcgis-sink.enable_name_mappings = true ###### Entity data: - service = vehicles - service-path = /4wheels - entity-type = Car + service = vehicles + service-path = /4wheels + entity-type = Car The name mappings configuration would be: @@ -156,8 +156,8 @@ The name mappings configuration would be: ###### result - Feature table url: https://arcgis.com/{hash}/arcgis/rest/services/vehicles/cars - Table's unique field: licensePlate + Feature table url: https://arcgis.com/{hash}/arcgis/rest/services/vehicles/cars + Table's unique field: licensePlate [Top](#top) @@ -297,7 +297,7 @@ Note that `speed` attribute is not required in the name mappings file as it matc From https://doc.arcgis.com/en/data-pipelines/latest/process/output-feature-layer.htm > ... Date fields are stored in feature layers using the format milliseconds from epoch and the coordinated universal time (UTC) time zone. The values will be displayed differently depending on where you are viewing the data. For example, querying the feature service REST end point will return values in milliseconds from epoch, such as 1667411518878.... -So, to persist a `esriFieldTypeDate` field in the Feature Layer, cygnus has to receive an attribute "Number" from the CB with the milliseconds from epoch. +So, all NGSI DateTime are persisted like a `esriFieldTypeDate` field in the Feature Layer, because arcgis sink transform NGSI DateTime into the milliseconds from epoch. ## Programmers guide ### `NGSIArcgisFeatureTableSink` class From 656c09801ac0709b9c0f02377149711be841f190 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Tue, 6 Feb 2024 10:03:04 +0100 Subject: [PATCH 2/2] update CNR --- CHANGES_NEXT_RELEASE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 8b1378917..7515174f5 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +1 @@ - +- [cygnus-common] [Arcgis] All NGSI DateTime are translated to Millis from Epoch (esriFieldTypeDate) (#2339)