Skip to content

Commit

Permalink
DPO-2301review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
teijosol committed Jun 19, 2024
1 parent bbbb2a8 commit 91ce25a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,6 @@ public Optional<WazeFeedIncidentDto> convertToWazeFeedAnnouncementDto(final Waze
new WazeFeedIncidentDto(situationId, street, description, direction, polyline, type, starttime, endtime))));
}

private Optional<WazeFeedIncidentDto.Type> convertToWazeType(final TrafficAnnouncementType trafficAnnouncementType) {
if (trafficAnnouncementType == null) {
return Optional.empty();
}

switch (trafficAnnouncementType) {
case ACCIDENT_REPORT:
case PRELIMINARY_ACCIDENT_REPORT:
return Optional.of(WazeFeedIncidentDto.Type.ACCIDENT);
case GENERAL:
return Optional.of(WazeFeedIncidentDto.Type.HAZARD);
default:
return Optional.empty();
}
}

private Optional<WazeFeedLocationDto.Direction> convertDirection(final RoadAddressLocation.Direction direction, final Geometry<?> geometry) {
if (direction == null || geometry == null || geometry instanceof Point) {
return Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@
import static fi.livi.digitraffic.tie.datex2.WeatherRelatedRoadConditionTypeEnum.SURFACE_WATER;
import static fi.livi.digitraffic.tie.datex2.WeatherRelatedRoadConditionTypeEnum.WET_AND_ICY_ROAD;
import static fi.livi.digitraffic.tie.datex2.WeatherRelatedRoadConditionTypeEnum.WET_ICY_PAVEMENT;
import static io.netty.util.internal.StringUtil.EMPTY_STRING;

import java.util.Collection;
import java.util.HashMap;
Expand Down Expand Up @@ -261,7 +260,7 @@ public class WazeDatex2MessageConverter {
private static final Logger logger = LoggerFactory.getLogger(WazeDatex2MessageConverter.class);

// use this string, when you want to skip some type-enum without error
private static final String SKIP_SUBTYPE = "";
private static final String SKIP_SUBTYPE = "SKIP_SUBTYPE-5O7jh8ytZjQLKCurmFwYowFBaghhMk3U-SKIP_SUBTYPE";

private final Datex2XmlStringToObjectMarshaller datex2XmlStringToObjectMarshaller;

Expand Down Expand Up @@ -891,12 +890,8 @@ private Optional<String> accept(final String situationId, final SituationRecord
logger.error("method=accept unknown {} record in situation {}", situationRecordType, situationId);
}

// EMPTY_STRING means, that we want to skip this event subtype, but it's ok and no need to log error
// SKIP_SUBTYPE means, that we want to skip this event subtype, but it's ok and no need to log error
// (for example OTHER subtype for MaintenanceWorks)
if (result.get() == SKIP_SUBTYPE) {
return Optional.empty();
}

return result;
return result.filter(v -> v != SKIP_SUBTYPE);
}
}

0 comments on commit 91ce25a

Please sign in to comment.