diff --git a/pom.xml b/pom.xml
index 76ca6191..cd1a6a30 100644
--- a/pom.xml
+++ b/pom.xml
@@ -203,17 +203,6 @@
gt-main
32.1
-
- org.mapstruct
- mapstruct
- 1.5.5.Final
-
-
- org.mapstruct
- mapstruct-processor
- 1.5.5.Final
- provided
-
diff --git a/src/main/java/org/entur/lamassu/leader/entityupdater/StationsUpdater.java b/src/main/java/org/entur/lamassu/leader/entityupdater/StationsUpdater.java
index 69184625..e4543e90 100644
--- a/src/main/java/org/entur/lamassu/leader/entityupdater/StationsUpdater.java
+++ b/src/main/java/org/entur/lamassu/leader/entityupdater/StationsUpdater.java
@@ -32,7 +32,6 @@
import org.entur.lamassu.delta.GBFSEntityDelta;
import org.entur.lamassu.delta.GBFSFileDelta;
import org.entur.lamassu.mapper.entitymapper.StationMapper;
-import org.entur.lamassu.mapper.entitymapper.StationMergeMapper;
import org.entur.lamassu.metrics.MetricsService;
import org.entur.lamassu.model.entities.Station;
import org.entur.lamassu.model.provider.FeedProvider;
@@ -71,7 +70,6 @@ public UpdateContext(
private final EntityCache stationCache;
private final StationSpatialIndex spatialIndex;
private final StationMapper stationMapper;
- private final StationMergeMapper stationMergeMapper;
private final MetricsService metricsService;
private final SpatialIndexIdGeneratorService spatialIndexService;
@@ -82,14 +80,12 @@ public StationsUpdater(
EntityCache stationCache,
StationSpatialIndex spatialIndex,
StationMapper stationMapper,
- StationMergeMapper stationMergeMapper,
MetricsService metricsService,
SpatialIndexIdGeneratorService spatialIndexService
) {
this.stationCache = stationCache;
this.spatialIndex = spatialIndex;
this.stationMapper = stationMapper;
- this.stationMergeMapper = stationMergeMapper;
this.metricsService = metricsService;
this.spatialIndexService = spatialIndexService;
}
@@ -236,6 +232,10 @@ private void processDeltaUpdate(
}
if (currentStation != null) {
+ context.spatialIndexIdsToRemove.add(
+ spatialIndexService.createStationIndexId(currentStation, context.feedProvider)
+ );
+
Station mappedStation = stationMapper.mapStation(
stationInformation,
entityDelta.entity(),
@@ -243,17 +243,11 @@ private void processDeltaUpdate(
context.feedProvider.getLanguage()
);
- context.spatialIndexIdsToRemove.add(
- spatialIndexService.createStationIndexId(currentStation, context.feedProvider)
- );
-
- // Merge the mapped station into the current station
- stationMergeMapper.updateStation(currentStation, mappedStation);
- context.addedAndUpdatedStations.put(currentStation.getId(), currentStation);
+ context.addedAndUpdatedStations.put(mappedStation.getId(), mappedStation);
context.spatialIndexUpdateMap.put(
- spatialIndexService.createStationIndexId(currentStation, context.feedProvider),
- currentStation
+ spatialIndexService.createStationIndexId(mappedStation, context.feedProvider),
+ mappedStation
);
} else {
logger.debug(
diff --git a/src/main/java/org/entur/lamassu/leader/entityupdater/VehiclesUpdater.java b/src/main/java/org/entur/lamassu/leader/entityupdater/VehiclesUpdater.java
index 82c1d569..60c9f17c 100644
--- a/src/main/java/org/entur/lamassu/leader/entityupdater/VehiclesUpdater.java
+++ b/src/main/java/org/entur/lamassu/leader/entityupdater/VehiclesUpdater.java
@@ -30,7 +30,6 @@
import org.entur.lamassu.delta.GBFSEntityDelta;
import org.entur.lamassu.delta.GBFSFileDelta;
import org.entur.lamassu.mapper.entitymapper.VehicleMapper;
-import org.entur.lamassu.mapper.entitymapper.VehicleMergeMapper;
import org.entur.lamassu.metrics.MetricsService;
import org.entur.lamassu.model.entities.Vehicle;
import org.entur.lamassu.model.provider.FeedProvider;
@@ -61,7 +60,6 @@ public UpdateContext(FeedProvider feedProvider) {
private final EntityCache vehicleCache;
private final VehicleSpatialIndex spatialIndex;
private final VehicleMapper vehicleMapper;
- private final VehicleMergeMapper vehicleMergeMapper;
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private final MetricsService metricsService;
private final SpatialIndexIdGeneratorService spatialIndexService;
@@ -72,7 +70,6 @@ public VehiclesUpdater(
EntityCache vehicleCache,
VehicleSpatialIndex spatialIndex,
VehicleMapper vehicleMapper,
- VehicleMergeMapper vehicleMergeMapper,
MetricsService metricsService,
SpatialIndexIdGeneratorService spatialIndexService,
VehicleFilter vehicleFilter
@@ -80,7 +77,6 @@ public VehiclesUpdater(
this.vehicleCache = vehicleCache;
this.spatialIndex = spatialIndex;
this.vehicleMapper = vehicleMapper;
- this.vehicleMergeMapper = vehicleMergeMapper;
this.metricsService = metricsService;
this.spatialIndexService = spatialIndexService;
this.vehicleFilter = vehicleFilter;
@@ -180,21 +176,20 @@ private void processDeltaUpdate(
Vehicle currentVehicle = vehicleCache.get(entityDelta.entityId());
if (currentVehicle != null) {
+ context.spatialIndexIdsToRemove.add(
+ spatialIndexService.createVehicleIndexId(currentVehicle, context.feedProvider)
+ );
+
Vehicle mappedVehicle = vehicleMapper.mapVehicle(
entityDelta.entity(),
context.feedProvider.getSystemId()
);
- context.spatialIndexIdsToRemove.add(
- spatialIndexService.createVehicleIndexId(currentVehicle, context.feedProvider)
- );
-
- vehicleMergeMapper.updateVehicle(currentVehicle, mappedVehicle);
- context.addedAndUpdatedVehicles.put(currentVehicle.getId(), currentVehicle);
+ context.addedAndUpdatedVehicles.put(mappedVehicle.getId(), mappedVehicle);
context.spatialIndexUpdateMap.put(
- spatialIndexService.createVehicleIndexId(currentVehicle, context.feedProvider),
- currentVehicle
+ spatialIndexService.createVehicleIndexId(mappedVehicle, context.feedProvider),
+ mappedVehicle
);
} else {
logger.debug(
diff --git a/src/main/java/org/entur/lamassu/mapper/entitymapper/StationMergeMapper.java b/src/main/java/org/entur/lamassu/mapper/entitymapper/StationMergeMapper.java
deleted file mode 100644
index c5007820..00000000
--- a/src/main/java/org/entur/lamassu/mapper/entitymapper/StationMergeMapper.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.entur.lamassu.mapper.entitymapper;
-
-import org.entur.lamassu.model.entities.Station;
-import org.mapstruct.CollectionMappingStrategy;
-import org.mapstruct.Mapper;
-import org.mapstruct.MappingTarget;
-import org.mapstruct.NullValuePropertyMappingStrategy;
-
-@Mapper(
- componentModel = "spring",
- nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.SET_TO_NULL,
- collectionMappingStrategy = CollectionMappingStrategy.TARGET_IMMUTABLE
-)
-public interface StationMergeMapper {
- /**
- * Updates an existing Station with values from the source Station.
- */
- void updateStation(@MappingTarget Station target, Station source);
-}
diff --git a/src/main/java/org/entur/lamassu/mapper/entitymapper/VehicleMergeMapper.java b/src/main/java/org/entur/lamassu/mapper/entitymapper/VehicleMergeMapper.java
deleted file mode 100644
index 97de42ee..00000000
--- a/src/main/java/org/entur/lamassu/mapper/entitymapper/VehicleMergeMapper.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.entur.lamassu.mapper.entitymapper;
-
-import org.entur.lamassu.model.entities.Vehicle;
-import org.mapstruct.CollectionMappingStrategy;
-import org.mapstruct.Mapper;
-import org.mapstruct.MappingTarget;
-import org.mapstruct.NullValuePropertyMappingStrategy;
-
-@Mapper(
- componentModel = "spring",
- nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.SET_TO_NULL,
- collectionMappingStrategy = CollectionMappingStrategy.TARGET_IMMUTABLE
-)
-public interface VehicleMergeMapper {
- /**
- * Updates an existing Vehicle with values from the source Vehicle.
- */
- void updateVehicle(@MappingTarget Vehicle target, Vehicle source);
-}
diff --git a/src/test/java/org/entur/lamassu/leader/entityupdater/StationsUpdaterTest.java b/src/test/java/org/entur/lamassu/leader/entityupdater/StationsUpdaterTest.java
index f6864e72..a57f6bc8 100644
--- a/src/test/java/org/entur/lamassu/leader/entityupdater/StationsUpdaterTest.java
+++ b/src/test/java/org/entur/lamassu/leader/entityupdater/StationsUpdaterTest.java
@@ -21,8 +21,6 @@
import org.entur.lamassu.delta.GBFSFileDelta;
import org.entur.lamassu.mapper.entitymapper.RentalUrisMapper;
import org.entur.lamassu.mapper.entitymapper.StationMapper;
-import org.entur.lamassu.mapper.entitymapper.StationMergeMapper;
-import org.entur.lamassu.mapper.entitymapper.StationMergeMapperImpl;
import org.entur.lamassu.mapper.entitymapper.TranslationMapper;
import org.entur.lamassu.metrics.MetricsService;
import org.entur.lamassu.model.entities.FormFactor;
@@ -60,7 +58,6 @@ class StationsUpdaterTest {
private EntityCache vehicleTypeCache;
private StationMapper stationMapper;
- private StationMergeMapper stationMergeMapper;
private SpatialIndexIdGeneratorService spatialIndexIdGeneratorService;
private StationsUpdater stationsUpdater;
@@ -70,7 +67,6 @@ void setUp() {
TranslationMapper translationMapper = new TranslationMapper();
RentalUrisMapper rentalUrisMapper = new RentalUrisMapper();
stationMapper = new StationMapper(translationMapper, rentalUrisMapper);
- stationMergeMapper = new StationMergeMapperImpl();
spatialIndexIdGeneratorService = new SpatialIndexIdGeneratorService(vehicleTypeCache);
stationsUpdater =
@@ -78,7 +74,6 @@ void setUp() {
stationCache,
spatialIndex,
stationMapper,
- stationMergeMapper,
metricsService,
spatialIndexIdGeneratorService
);
@@ -399,7 +394,6 @@ void shouldRemoveExistingStationsWhenBaseIsNull() {
stationCache,
spatialIndex,
stationMapper,
- stationMergeMapper,
metricsService,
spatialIndexIdGeneratorService
);
diff --git a/src/test/java/org/entur/lamassu/leader/entityupdater/VehiclesUpdaterTest.java b/src/test/java/org/entur/lamassu/leader/entityupdater/VehiclesUpdaterTest.java
index 84de1ef7..ebd1c78f 100644
--- a/src/test/java/org/entur/lamassu/leader/entityupdater/VehiclesUpdaterTest.java
+++ b/src/test/java/org/entur/lamassu/leader/entityupdater/VehiclesUpdaterTest.java
@@ -19,8 +19,6 @@
import org.entur.lamassu.delta.GBFSFileDelta;
import org.entur.lamassu.mapper.entitymapper.RentalUrisMapper;
import org.entur.lamassu.mapper.entitymapper.VehicleMapper;
-import org.entur.lamassu.mapper.entitymapper.VehicleMergeMapper;
-import org.entur.lamassu.mapper.entitymapper.VehicleMergeMapperImpl;
import org.entur.lamassu.metrics.MetricsService;
import org.entur.lamassu.model.entities.FormFactor;
import org.entur.lamassu.model.entities.PropulsionType;
@@ -54,7 +52,6 @@ class VehiclesUpdaterTest {
private VehicleFilter vehicleFilter;
private VehicleMapper vehicleMapper;
- private VehicleMergeMapper vehicleMergeMapper;
private SpatialIndexIdGeneratorService spatialIndexIdGeneratorService;
private VehiclesUpdater vehiclesUpdater;
@@ -63,7 +60,6 @@ void setUp() {
// Initialize real mappers
RentalUrisMapper rentalUrisMapper = new RentalUrisMapper();
vehicleMapper = new VehicleMapper(rentalUrisMapper);
- vehicleMergeMapper = new VehicleMergeMapperImpl();
// Initialize real services
spatialIndexIdGeneratorService = new SpatialIndexIdGeneratorService(vehicleTypeCache);
@@ -73,7 +69,6 @@ void setUp() {
vehicleCache,
spatialIndex,
vehicleMapper,
- vehicleMergeMapper,
metricsService,
spatialIndexIdGeneratorService,
vehicleFilter