From c3619268c4d012d6460d0c2a57643f4e0b268937 Mon Sep 17 00:00:00 2001 From: Clemens Zagler Date: Fri, 27 Dec 2024 15:42:43 +0100 Subject: [PATCH] traffic-event-bz: fix endpoint url to https, add UUID generation logging --- .../MainTrafficEventRoadworkBZ.java | 14 ++++++++++++++ .../TrafficEventRoadworkBZConnector.java | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/data-collectors/traffic-event-roadworks-bz/src/main/java/it/bz/noi/trafficeventroadworkbz/MainTrafficEventRoadworkBZ.java b/data-collectors/traffic-event-roadworks-bz/src/main/java/it/bz/noi/trafficeventroadworkbz/MainTrafficEventRoadworkBZ.java index d1520543..2201ecf5 100644 --- a/data-collectors/traffic-event-roadworks-bz/src/main/java/it/bz/noi/trafficeventroadworkbz/MainTrafficEventRoadworkBZ.java +++ b/data-collectors/traffic-event-roadworks-bz/src/main/java/it/bz/noi/trafficeventroadworkbz/MainTrafficEventRoadworkBZ.java @@ -4,6 +4,8 @@ package it.bz.noi.trafficeventroadworkbz; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.uuid.Generators; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.Point; @@ -46,6 +48,18 @@ public void execute() { EventDto eventDto = new EventDto(); Map uuidFields = getUuidFields(trafficEventRoadwork); + + if (LOG.isDebugEnabled()) { + // This happens inside the bdp client library when setting UUID + ObjectMapper mapper = new ObjectMapper(); + String uuidNameJson = mapper.writer().writeValueAsString(uuidFields); + String uuid = Generators.nameBasedGenerator(null).generate(uuidNameJson).toString(); + LOG.debug("Dumping UUID generation:"); + LOG.debug("fields: {}", uuidFields); + LOG.debug("json: {}", uuidNameJson); + LOG.debug("uuid: {}", uuid); + } + eventDto.setUuid(uuidFields); eventDto.setEventSeriesUuid(uuidFields); eventDto.setCategory(String.format("%s_%s | %s_%s", trafficEventRoadwork.getTycodeIt(), diff --git a/data-collectors/traffic-event-roadworks-bz/src/main/java/it/bz/noi/trafficeventroadworkbz/TrafficEventRoadworkBZConnector.java b/data-collectors/traffic-event-roadworks-bz/src/main/java/it/bz/noi/trafficeventroadworkbz/TrafficEventRoadworkBZConnector.java index 3c696868..591a06bb 100644 --- a/data-collectors/traffic-event-roadworks-bz/src/main/java/it/bz/noi/trafficeventroadworkbz/TrafficEventRoadworkBZConnector.java +++ b/data-collectors/traffic-event-roadworks-bz/src/main/java/it/bz/noi/trafficeventroadworkbz/TrafficEventRoadworkBZConnector.java @@ -27,7 +27,7 @@ public class TrafficEventRoadworkBZConnector { private static final Logger LOG = LoggerFactory.getLogger(TrafficEventRoadworkBZConnector.class); - private static final String END_POINT_URL = "http://www.provinz.bz.it/vmz/traffic.json"; + private static final String END_POINT_URL = "https://www.provinz.bz.it/vmz/traffic.json"; public List getTrafficEventRoadworksModelList() throws IOException {