diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 6c5945a82..e2875010e 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,2 +1,3 @@ - [cygnus-common][cygnus-ngsi] Upgrade mockito-core dep from 5.5.0 to 5.10.0 - [cygnus-common][cygnus-ngsi][cygnus-ngsi-ld] Upgrade Java version from 1.1 to 1.17 in Dockerfile (#2297,#2304) +- [cygnus-common] [Arcgis] All NGSI DateTime are translated to Millis from Epoch (esriFieldTypeDate) (#2339) \ No newline at end of file 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