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 7f0322a4..2c175e5c 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 @@ -37,22 +37,26 @@ public class MainTrafficEventRoadworkBZ { public void execute() { LOG.info("MainTrafficEventRoadworks execute"); try { - List trafficEventRoadworkList = trafficEventRoadworkBZConnector.getTrafficEventRoadworksModelList(); + List trafficEventRoadworkList = trafficEventRoadworkBZConnector + .getTrafficEventRoadworksModelList(); LOG.info("got {} traffic events", trafficEventRoadworkList.size()); List eventDtoList = new ArrayList<>(); for (TrafficEventRoadworkBZModel trafficEventRoadwork : trafficEventRoadworkList) { EventDto eventDto = new EventDto(); - Map uuidFields = getUuidFields(trafficEventRoadwork); + Map uuidFields = getUuidFields(trafficEventRoadwork); eventDto.setUuid(uuidFields); - eventDto.setEventSeriesUuid(uuidFields); - eventDto.setCategory(trafficEventRoadwork.getTycodeIt() + " | " + trafficEventRoadwork.getTycodeDe()); + eventDto.setEventSeriesUuid(uuidFields); + eventDto.setCategory(String.format("%s %s | %s %s", trafficEventRoadwork.getTycodeIt(), + trafficEventRoadwork.getSubTycodeIt(), trafficEventRoadwork.getTycodeDe(), + trafficEventRoadwork.getSubTycodeDe())); eventDto.setOrigin(configuration.getOrigin()); - eventDto.setName(Long.toString(trafficEventRoadwork.getMessageId())); - eventDto.setDescription(trafficEventRoadwork.getDescriptionIt() + " | " + trafficEventRoadwork.getDescriptionDe()); + eventDto.setName(Long.toString(trafficEventRoadwork.getMessageId())); + eventDto.setDescription( + trafficEventRoadwork.getDescriptionIt() + " | " + trafficEventRoadwork.getDescriptionDe()); - if(trafficEventRoadwork.getX() != null && trafficEventRoadwork.getY() != null) { + if (trafficEventRoadwork.getX() != null && trafficEventRoadwork.getY() != null) { GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(), 4326); Coordinate coordinate = new Coordinate(trafficEventRoadwork.getX(), trafficEventRoadwork.getY()); Point point = geometryFactory.createPoint(coordinate); @@ -60,8 +64,10 @@ public void execute() { } eventDto.setEventStart(trafficEventRoadwork.getBeginDateAsEpochMillis()); - if(trafficEventRoadwork.getEndDate() != null) - eventDto.setEventEnd(trafficEventRoadwork.getEndDateAsEpochMillis() + 1); // +1 because we exclude the upper bound --> [lower,upper) + if (trafficEventRoadwork.getEndDate() != null) + eventDto.setEventEnd(trafficEventRoadwork.getEndDateAsEpochMillis() + 1); // +1 because we exclude + // the upper bound --> + // [lower,upper) eventDto.getMetaData().put("json_featuretype", trafficEventRoadwork.getJson_featuretype()); eventDto.getMetaData().put("publisherDateTime", trafficEventRoadwork.getPublisherDateTime()); @@ -85,14 +91,21 @@ public void execute() { eventDto.getMetaData().put("messageStreetId", trafficEventRoadwork.getMessageStreetId()); eventDto.getMetaData().put("messageStreetWapDescDe", trafficEventRoadwork.getMessageStreetWapDescDe()); eventDto.getMetaData().put("messageStreetWapDescIt", trafficEventRoadwork.getMessageStreetWapDescIt()); - eventDto.getMetaData().put("messageStreetInternetDescDe", trafficEventRoadwork.getMessageStreetInternetDescDe()); - eventDto.getMetaData().put("messageStreetInternetDescIt", trafficEventRoadwork.getMessageStreetInternetDescIt()); + eventDto.getMetaData().put("messageStreetInternetDescDe", + trafficEventRoadwork.getMessageStreetInternetDescDe()); + eventDto.getMetaData().put("messageStreetInternetDescIt", + trafficEventRoadwork.getMessageStreetInternetDescIt()); eventDto.getMetaData().put("messageStreetNr", trafficEventRoadwork.getMessageStreetNr()); - eventDto.getMetaData().put("messageStreetHierarchie", trafficEventRoadwork.getMessageStreetHierarchie()); - // Don't save message type, because it causes duplicate entries. More info here https://github.com/noi-techpark/bdp-commons/issues/599 - // eventDto.getMetaData().put("messageTypeId", trafficEventRoadwork.getMessageTypeId()); - // eventDto.getMetaData().put("messageTypeDescDe", trafficEventRoadwork.getMessageTypeDescDe()); - // eventDto.getMetaData().put("messageTypeDescIt", trafficEventRoadwork.getMessageTypeDescIt()); + eventDto.getMetaData().put("messageStreetHierarchie", + trafficEventRoadwork.getMessageStreetHierarchie()); + // Don't save message type, because it causes duplicate entries. More info here + // https://github.com/noi-techpark/bdp-commons/issues/599 + // eventDto.getMetaData().put("messageTypeId", + // trafficEventRoadwork.getMessageTypeId()); + // eventDto.getMetaData().put("messageTypeDescDe", + // trafficEventRoadwork.getMessageTypeDescDe()); + // eventDto.getMetaData().put("messageTypeDescIt", + // trafficEventRoadwork.getMessageTypeDescIt()); eventDtoList.add(eventDto); } @@ -107,12 +120,13 @@ private Map getUuidFields(TrafficEventRoadworkBZModel trafficEve HashMap uuidMap = new HashMap<>(); uuidMap.put("beginDate", trafficEventRoadwork.getBeginDate()); uuidMap.put("endDate", trafficEventRoadwork.getEndDate()); - // Don't save message type, because it causes duplicate entries. More info here https://github.com/noi-techpark/bdp-commons/issues/599 + // Don't save message type, because it causes duplicate entries. More info here + // https://github.com/noi-techpark/bdp-commons/issues/599 // uuidMap.put("messageId", trafficEventRoadwork.getMessageId()); // uuidMap.put("messageTypeId", trafficEventRoadwork.getMessageTypeId()); uuidMap.put("X", trafficEventRoadwork.getX()); uuidMap.put("Y", trafficEventRoadwork.getY()); - return uuidMap; + return uuidMap; } }