Skip to content

Commit d7ed325

Browse files
authored
Merge pull request #72 from entur/versioned-tariff-zones-and-fare-zones
Fix versioned entities in site frame
2 parents 49388f9 + 80ba6f5 commit d7ed325

File tree

4 files changed

+31
-31
lines changed

4 files changed

+31
-31
lines changed

src/main/java/org/entur/netex/index/api/NetexEntitiesIndex.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,25 +246,25 @@ public interface NetexEntitiesIndex {
246246
* Get an entity index of TariffZone
247247
* @return
248248
*/
249-
NetexEntityIndex<TariffZone> getTariffZoneIndex();
249+
VersionedNetexEntityIndex<TariffZone> getTariffZoneIndex();
250250

251251
/**
252252
* Get an entity index of TopographicPlace
253253
* @return
254254
*/
255-
NetexEntityIndex<TopographicPlace> getTopographicPlaceIndex();
255+
VersionedNetexEntityIndex<TopographicPlace> getTopographicPlaceIndex();
256256

257257
/**
258258
* Get an entity index of Parking
259259
* @return
260260
*/
261-
NetexEntityIndex<Parking> getParkingIndex();
261+
VersionedNetexEntityIndex<Parking> getParkingIndex();
262262

263263
/**
264264
* Get an entity index of ScheduledStopPoint
265265
* @return
266266
*/
267-
NetexEntityIndex<ScheduledStopPoint> getScheduledStopPointIndex();
267+
VersionedNetexEntityIndex<ScheduledStopPoint> getScheduledStopPointIndex();
268268

269269
/**
270270
* Get an entity index of RoutePoint
@@ -282,9 +282,9 @@ public interface NetexEntitiesIndex {
282282
* Get an entity index of FareZone
283283
* @return
284284
*/
285-
NetexEntityIndex<FareZone> getFareZoneIndex();
285+
VersionedNetexEntityIndex<FareZone> getFareZoneIndex();
286286

287-
NetexEntityIndex<GroupOfTariffZones> getGroupOfTariffZonesIndex();
287+
VersionedNetexEntityIndex<GroupOfTariffZones> getGroupOfTariffZonesIndex();
288288

289289
Collection<CompositeFrame> getCompositeFrames();
290290
Collection<ResourceFrame> getResourceFrames();

src/main/java/org/entur/netex/index/impl/NetexEntitiesIndexImpl.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ public class NetexEntitiesIndexImpl implements NetexEntitiesIndex {
8787
public final Multimap<String, ServiceJourneyInterchange> serviceJourneyInterchangeByServiceJourneyRef;
8888
public final NetexEntityIndex<ServiceLink> serviceLinkById;
8989
public final VersionedNetexEntityIndex<StopPlace> stopPlaceById;
90-
public final NetexEntityIndex<TariffZone> tariffZonesById;
91-
public final NetexEntityIndex<TopographicPlace> topographicPlaceById;
92-
public final NetexEntityIndex<Parking> parkingById;
93-
public final NetexEntityIndex<ScheduledStopPoint> scheduledStopPointById;
90+
public final VersionedNetexEntityIndex<TariffZone> tariffZonesById;
91+
public final VersionedNetexEntityIndex<TopographicPlace> topographicPlaceById;
92+
public final VersionedNetexEntityIndex<Parking> parkingById;
93+
public final VersionedNetexEntityIndex<ScheduledStopPoint> scheduledStopPointById;
9494
public final NetexEntityIndex<RoutePoint> routePointById;
95-
public final NetexEntityIndex<FareZone> fareZoneById;
96-
public final NetexEntityIndex<GroupOfTariffZones> groupOfTariffZonesById;
95+
public final VersionedNetexEntityIndex<FareZone> fareZoneById;
96+
public final VersionedNetexEntityIndex<GroupOfTariffZones> groupOfTariffZonesById;
9797
public final Multimap<String, Parking> parkingsByParentSiteRef;
9898

9999
// Relations between entities - The Netex XML sometimes rely on the the
@@ -146,13 +146,13 @@ public NetexEntitiesIndexImpl() {
146146
this.serviceJourneyInterchangeByServiceJourneyRef = Multimaps.synchronizedListMultimap(ArrayListMultimap.create());
147147
this.serviceLinkById = new NetexEntityMapByIdImpl<>();
148148
this.stopPlaceById = new VersionedNetexEntityIndexImpl<>();
149-
this.tariffZonesById = new NetexEntityMapByIdImpl<>();
150-
this.topographicPlaceById = new NetexEntityMapByIdImpl<>();
151-
this.parkingById = new NetexEntityMapByIdImpl<>();
152-
this.scheduledStopPointById = new NetexEntityMapByIdImpl<>();
149+
this.tariffZonesById = new VersionedNetexEntityIndexImpl<>();
150+
this.topographicPlaceById = new VersionedNetexEntityIndexImpl<>();
151+
this.parkingById = new VersionedNetexEntityIndexImpl<>();
152+
this.scheduledStopPointById = new VersionedNetexEntityIndexImpl<>();
153153
this.routePointById = new NetexEntityMapByIdImpl<>();
154-
this.fareZoneById = new NetexEntityMapByIdImpl<>();
155-
this.groupOfTariffZonesById = new NetexEntityMapByIdImpl<>();
154+
this.fareZoneById = new VersionedNetexEntityIndexImpl<>();
155+
this.groupOfTariffZonesById = new VersionedNetexEntityIndexImpl<>();
156156
this.compositeFrames = new HashSet<>();
157157
this.siteFrames = new HashSet<>();
158158
this.resourceFrames = new HashSet<>();
@@ -323,22 +323,22 @@ public VersionedNetexEntityIndex<StopPlace> getStopPlaceIndex() {
323323
}
324324

325325
@Override
326-
public NetexEntityIndex<TariffZone> getTariffZoneIndex() {
326+
public VersionedNetexEntityIndex<TariffZone> getTariffZoneIndex() {
327327
return tariffZonesById;
328328
}
329329

330330
@Override
331-
public NetexEntityIndex<TopographicPlace> getTopographicPlaceIndex() {
331+
public VersionedNetexEntityIndex<TopographicPlace> getTopographicPlaceIndex() {
332332
return topographicPlaceById;
333333
}
334334

335335
@Override
336-
public NetexEntityIndex<Parking> getParkingIndex() {
336+
public VersionedNetexEntityIndex<Parking> getParkingIndex() {
337337
return parkingById;
338338
}
339339

340340
@Override
341-
public NetexEntityIndex<ScheduledStopPoint> getScheduledStopPointIndex() {
341+
public VersionedNetexEntityIndex<ScheduledStopPoint> getScheduledStopPointIndex() {
342342
return scheduledStopPointById;
343343
}
344344

@@ -348,12 +348,12 @@ public NetexEntityIndex<RoutePoint> getRoutePointIndex() {
348348
}
349349

350350
@Override
351-
public NetexEntityIndex<FareZone> getFareZoneIndex() {
351+
public VersionedNetexEntityIndex<FareZone> getFareZoneIndex() {
352352
return fareZoneById;
353353
}
354354

355355
@Override
356-
public NetexEntityIndex<GroupOfTariffZones> getGroupOfTariffZonesIndex() {
356+
public VersionedNetexEntityIndex<GroupOfTariffZones> getGroupOfTariffZonesIndex() {
357357
return groupOfTariffZonesById;
358358
}
359359

src/test/java/org/entur/netex/TestGroupOfTariffZones.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static void init() {
2626

2727
@Test
2828
void testGetAllGroupsOfTariffZones() {
29-
Collection<GroupOfTariffZones> groups = index.getGroupOfTariffZonesIndex().getAll();
29+
Collection<GroupOfTariffZones> groups = index.getGroupOfTariffZonesIndex().getLatestVersions();
3030
Assertions.assertFalse(groups.isEmpty());
3131
}
3232
}

src/test/java/org/entur/netex/TestStopPlacesExport.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,40 +56,40 @@ void testGetGroupOfStopPlaces() {
5656

5757
@Test
5858
void testGetTariffZone() {
59-
TariffZone tariffZone = index.getTariffZoneIndex().get("MOR:TariffZone:108");
59+
TariffZone tariffZone = index.getTariffZoneIndex().getLatestVersion("MOR:TariffZone:108");
6060
Assertions.assertEquals("Standal", tariffZone.getName().getValue());
6161
}
6262

6363
@Test
6464
void testGetTopographicPlace() {
65-
TopographicPlace topographicPlace = index.getTopographicPlaceIndex().get("KVE:TopographicPlace:50");
65+
TopographicPlace topographicPlace = index.getTopographicPlaceIndex().getLatestVersion("KVE:TopographicPlace:50");
6666
Assertions.assertEquals("Trøndelag", topographicPlace.getDescriptor().getName().getValue());
6767
Assertions.assertEquals("no", topographicPlace.getCountryRef().getRef().value());
6868
}
6969

7070
@Test
7171
void testGetParking() {
72-
Parking parking = index.getParkingIndex().get("NSR:Parking:1");
72+
Parking parking = index.getParkingIndex().getLatestVersion("NSR:Parking:1");
7373
Assertions.assertEquals("Drammen", parking.getName().getValue());
7474
}
7575

7676
@Test
7777
void testGetScheduledStopPoint() {
78-
ScheduledStopPoint scheduledStopPoint = index.getScheduledStopPointIndex().get("NSR:ScheduledStopPoint:S5");
78+
ScheduledStopPoint scheduledStopPoint = index.getScheduledStopPointIndex().getLatestVersion("NSR:ScheduledStopPoint:S5");
7979
Assertions.assertEquals("Gudå", scheduledStopPoint.getName().getValue());
8080
}
8181

8282
@Test
8383
void testGetPassengerStopAssignment() {
84-
ScheduledStopPoint scheduledStopPoint = index.getScheduledStopPointIndex().get("NSR:ScheduledStopPoint:S5");
84+
ScheduledStopPoint scheduledStopPoint = index.getScheduledStopPointIndex().getLatestVersion("NSR:ScheduledStopPoint:S5");
8585
Collection<PassengerStopAssignment> passengerStopAssignments = index.getPassengerStopAssignmentsByStopPointRefIndex().get(scheduledStopPoint.getId());
8686

8787
Assertions.assertEquals(1, passengerStopAssignments.size());
8888
}
8989

9090
@Test
9191
void testGetFareZone() {
92-
FareZone fareZone = index.getFareZoneIndex().get("AKT:FareZone:27");
92+
FareZone fareZone = index.getFareZoneIndex().getLatestVersion("AKT:FareZone:27");
9393
Assertions.assertEquals("Kviteseid", fareZone.getName().getValue());
9494
}
9595

0 commit comments

Comments
 (0)