diff --git a/pom.xml b/pom.xml
index 8cf62387..2348150b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,6 +74,9 @@
8.4.3
1.21.0
5.0.0.4389
+ 2.1.0
+ 0.22
+ write
0.8.12
@@ -285,6 +288,22 @@
false
+
+ com.hubspot.maven.plugins
+ prettier-maven-plugin
+ ${prettier-maven-plugin.version}
+
+ ${prettier-java.version}
+
+
+
+ validate
+
+ ${plugin.prettier.goal}
+
+
+
+
@@ -305,6 +324,14 @@
sonar-maven-plugin
${sonar-maven-plugin.version}
+
+ com.hubspot.maven.plugins
+ prettier-maven-plugin
+ ${prettier-maven-plugin.version}
+
+ true
+
+
@@ -386,5 +413,12 @@
+
+ prettierCheck
+
+
+ check
+
+
\ No newline at end of file
diff --git a/src/main/java/org/entur/netex/NetexParser.java b/src/main/java/org/entur/netex/NetexParser.java
index e2767e6f..71a177f0 100644
--- a/src/main/java/org/entur/netex/NetexParser.java
+++ b/src/main/java/org/entur/netex/NetexParser.java
@@ -1,92 +1,96 @@
package org.entur.netex;
-import org.entur.netex.index.api.NetexEntitiesIndex;
-import org.entur.netex.index.impl.NetexEntitiesIndexImpl;
-import org.entur.netex.loader.NetexXmlParser;
-import org.entur.netex.loader.parser.NetexDocumentParser;
-import org.rutebanken.netex.model.PublicationDeliveryStructure;
-
import jakarta.xml.bind.JAXBException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
+import org.entur.netex.index.api.NetexEntitiesIndex;
+import org.entur.netex.index.impl.NetexEntitiesIndexImpl;
+import org.entur.netex.loader.NetexXmlParser;
+import org.entur.netex.loader.parser.NetexDocumentParser;
+import org.rutebanken.netex.model.PublicationDeliveryStructure;
/**
* Main entry point to the library. Used to parse a NeTEx publication
* delivery into a queryable index.
*/
public class NetexParser {
- private final NetexXmlParser xmlParser = new NetexXmlParser();
- /**
- * Parse a NeTEx publication delivery from one or more files in
- * a zip archive
- *
- * @param pathToZip Path to zip file
- * @return A queryable index of NeTEx entities
- */
- public NetexEntitiesIndex parse(String pathToZip) throws IOException {
- NetexEntitiesIndex index = new NetexEntitiesIndexImpl();
- return parse(pathToZip, index);
- }
+ private final NetexXmlParser xmlParser = new NetexXmlParser();
- /**
- * Parse a NeTEx publication delivery from one or more files in
- * a zip archive into an existing index.
- *
- * Existing entities with same id will be overwritten.
- *
- * @param pathToZip Path to zip file
- * @param index An instance of NetexEntitiesIndex
- * @return The mutated index
- */
- public NetexEntitiesIndex parse(String pathToZip, NetexEntitiesIndex index) throws IOException {
- try(ZipFile zipFile = new ZipFile(pathToZip)) {
- Enumeration extends ZipEntry> entries = zipFile.entries();
- while(entries.hasMoreElements()){
- ZipEntry entry = entries.nextElement();
- InputStream stream = zipFile.getInputStream(entry);
- load(index, stream);
- }
- return index;
- }
- }
+ /**
+ * Parse a NeTEx publication delivery from one or more files in
+ * a zip archive
+ *
+ * @param pathToZip Path to zip file
+ * @return A queryable index of NeTEx entities
+ */
+ public NetexEntitiesIndex parse(String pathToZip) throws IOException {
+ NetexEntitiesIndex index = new NetexEntitiesIndexImpl();
+ return parse(pathToZip, index);
+ }
- /**
- * Parse an input stream of a single NeTEx public delivery
- *
- * @param inputStream
- * @return A queryable index of NeTEx entities
- */
- public NetexEntitiesIndex parse(InputStream inputStream) {
- NetexEntitiesIndex index = new NetexEntitiesIndexImpl();
- load(index, inputStream);
- return index;
+ /**
+ * Parse a NeTEx publication delivery from one or more files in
+ * a zip archive into an existing index.
+ *
+ * Existing entities with same id will be overwritten.
+ *
+ * @param pathToZip Path to zip file
+ * @param index An instance of NetexEntitiesIndex
+ * @return The mutated index
+ */
+ public NetexEntitiesIndex parse(String pathToZip, NetexEntitiesIndex index)
+ throws IOException {
+ try (ZipFile zipFile = new ZipFile(pathToZip)) {
+ Enumeration extends ZipEntry> entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ InputStream stream = zipFile.getInputStream(entry);
+ load(index, stream);
+ }
+ return index;
}
+ }
- /**
- * Parse an input stream of a single NeTEx publication delivery
- * into an existing index
- *
- * Existing entities with same id will be overwritten.
- *
- * @param inputStream An InputStream
- * @param index An instance of NetexEntitiesIndex
- * @return The mutated index
- */
- public NetexEntitiesIndex parse(InputStream inputStream, NetexEntitiesIndex index) {
- load(index, inputStream);
- return index;
- }
+ /**
+ * Parse an input stream of a single NeTEx public delivery
+ *
+ * @param inputStream
+ * @return A queryable index of NeTEx entities
+ */
+ public NetexEntitiesIndex parse(InputStream inputStream) {
+ NetexEntitiesIndex index = new NetexEntitiesIndexImpl();
+ load(index, inputStream);
+ return index;
+ }
+
+ /**
+ * Parse an input stream of a single NeTEx publication delivery
+ * into an existing index
+ *
+ * Existing entities with same id will be overwritten.
+ *
+ * @param inputStream An InputStream
+ * @param index An instance of NetexEntitiesIndex
+ * @return The mutated index
+ */
+ public NetexEntitiesIndex parse(
+ InputStream inputStream,
+ NetexEntitiesIndex index
+ ) {
+ load(index, inputStream);
+ return index;
+ }
- private void load(NetexEntitiesIndex index, InputStream inputStream) {
- try {
- PublicationDeliveryStructure doc = xmlParser.parseXmlDoc(inputStream);
- NetexDocumentParser.parseAndPopulateIndex(index, doc);
- } catch (JAXBException e) {
- throw new RuntimeException(e.getMessage(), e);
- }
+ private void load(NetexEntitiesIndex index, InputStream inputStream) {
+ try {
+ PublicationDeliveryStructure doc = xmlParser.parseXmlDoc(inputStream);
+ NetexDocumentParser.parseAndPopulateIndex(index, doc);
+ } catch (JAXBException e) {
+ throw new RuntimeException(e.getMessage(), e);
}
+ }
}
diff --git a/src/main/java/org/entur/netex/index/api/NetexEntitiesIndex.java b/src/main/java/org/entur/netex/index/api/NetexEntitiesIndex.java
index ae74d68e..d72b1331 100644
--- a/src/main/java/org/entur/netex/index/api/NetexEntitiesIndex.java
+++ b/src/main/java/org/entur/netex/index/api/NetexEntitiesIndex.java
@@ -1,5 +1,6 @@
package org.entur.netex.index.api;
+import com.google.common.collect.Multimap;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Map;
@@ -45,272 +46,266 @@
import org.rutebanken.netex.model.TopographicPlace;
import org.rutebanken.netex.model.VehicleScheduleFrame;
-import com.google.common.collect.Multimap;
-
/**
* Entrypoint to the NeTEx entities index
*/
public interface NetexEntitiesIndex {
-
- /**
- * Get an entity index of GroupOfLines
- * @return
- */
- NetexEntityIndex getGroupOfLinesIndex();
-
- /**
- * Get an entity index of Network
- * @return
- */
- NetexEntityIndex getNetworkIndex();
-
- /**
- * Get a map of Network id by GroupOfLine id
- * @return
- */
- Map getNetworkIdByGroupOfLineIdIndex();
-
- /**
- * Get an entity index of Authority
- * @return
- */
- NetexEntityIndex getAuthorityIndex();
-
- /**
- * Get an entity index of DayType
- * @return
- */
- NetexEntityIndex getDayTypeIndex();
-
- /**
- * Get a Multimap of DayTypeAssignment by DayType id
- * @return
- */
- Multimap getDayTypeAssignmentsByDayTypeIdIndex();
-
-
- /**
- * Get a Multimap of PassengerStopAssignment by StopPoint ref
- * * @return
- */
- Multimap getPassengerStopAssignmentsByStopPointRefIndex();
-
- /**
- * Get an entity index of DatedServiceJourney
- * @return
- */
- NetexEntityIndex getDatedServiceJourneyIndex();
-
- /**
- * Get an entity index of DeadRun
- * @return
- */
- NetexEntityIndex getDeadRunIndex();
-
-
- /**
- * Get a Multimap of DatedServiceJourney by ServiceJourney id
- * @return
- */
- Multimap getDatedServiceJourneyByServiceJourneyRefIndex();
-
-
- /**
- * Get an entity index of DestinationDisplay
- * @return
- */
- NetexEntityIndex getDestinationDisplayIndex();
-
- /**
- * Get an entity index of FlexibleStopPlace
- * @return
- */
- NetexEntityIndex getFlexibleStopPlaceIndex();
-
- /**
- * Get an entity index of GroupOfStopPlaces
- * @return
- */
- NetexEntityIndex getGroupOfStopPlacesIndex();
-
- /**
- * Get an entity index of JourneyPattern
- * @return
- */
- NetexEntityIndex getJourneyPatternIndex();
-
- /**
- * Get an entity index of FlexibleLine
- * @return
- */
- NetexEntityIndex getFlexibleLineIndex();
-
- /**
- * Get an entity index of Line
- * @return
- */
- NetexEntityIndex getLineIndex();
-
- /**
- * Get an entity index of Notice
- * @return
- */
- NetexEntityIndex getNoticeIndex();
-
- /**
- * Get an entity index of NoticeAssignment
- * @return
- */
- NetexEntityIndex getNoticeAssignmentIndex();
-
- /**
- * Get an entity index of OperatingDay
- * @return
- */
- NetexEntityIndex getOperatingDayIndex();
-
- /**
- * Get an entity index of OperatingPeriod
- * @return
- */
- NetexEntityIndex getOperatingPeriodIndex();
-
- /**
- * Get an entity index of Operator
- * @return
- */
- NetexEntityIndex getOperatorIndex();
-
- /**
- * Get an entity index of Branding
- * @return
- */
- NetexEntityIndex getBrandingIndex();
-
- /**
- * Get a versioned entity index of Quay
- * @return
- */
- VersionedNetexEntityIndex getQuayIndex();
-
- /**
- * Get a map of Quay id by StopPoint ref
- * @return
- */
- Map getQuayIdByStopPointRefIndex();
-
- /**
- * Get a map of StopPlace id by StopPoint ref
- * @return
- */
- Map getStopPlaceIdByStopPointRefIndex();
-
- /**
- * Get a map of StopPlace id by Quay id
- * @return
- */
- Map getStopPlaceIdByQuayIdIndex();
-
- /**
- * Get a map of FlexibleStopPlace id by StopPoint ref
- * @return
- */
- Map getFlexibleStopPlaceIdByStopPointRefIndex();
-
- /**
- * Get an entity index of Route
- * @return
- */
- NetexEntityIndex getRouteIndex();
-
- /**
- * Get an entity index of ServiceJourney
- * @return
- */
- NetexEntityIndex getServiceJourneyIndex();
-
- /**
- * Get an entity index of ServiceJourneyInterchange
- * @return
- */
- NetexEntityIndex getServiceJourneyInterchangeIndex();
-
- /**
- * Get a map of ServiceJourneyInterchange by feeder or consumer ServiceJourney
- * @return
- */
- Multimap getServiceJourneyInterchangeByServiceJourneyRefIndex();
-
- /**
- * Get an entity index of ServiceLink
- * @return
- */
- NetexEntityIndex getServiceLinkIndex();
-
- /**
- * Get a versioned entity index of StopPlace
- * @return
- */
- VersionedNetexEntityIndex getStopPlaceIndex();
-
- /**
- * Get an entity index of TariffZone
- * @return
- */
- VersionedNetexEntityIndex getTariffZoneIndex();
-
- /**
- * Get an entity index of TopographicPlace
- * @return
- */
- VersionedNetexEntityIndex getTopographicPlaceIndex();
-
- /**
- * Get an entity index of Parking
- * @return
- */
- VersionedNetexEntityIndex getParkingIndex();
-
- /**
- * Get an entity index of ScheduledStopPoint
- * @return
- */
- VersionedNetexEntityIndex getScheduledStopPointIndex();
-
- /**
- * Get an entity index of RoutePoint
- * @return
- */
- NetexEntityIndex getRoutePointIndex();
-
- /**
- * Get an entity index of Block
- * @return
- */
- NetexEntityIndex getBlockIndex();
-
- /**
- * Get a Multimap of parkings by ParentSite ref
- * @return
- */
- Multimap getParkingsByParentSiteRefIndex();
-
- /**
- * Get an entity index of FareZone
- * @return
- */
- VersionedNetexEntityIndex getFareZoneIndex();
-
- VersionedNetexEntityIndex getGroupOfTariffZonesIndex();
-
- Collection getCompositeFrames();
- Collection getResourceFrames();
- Collection getSiteFrames();
- Collection getServiceFrames();
- Collection getServiceCalendarFrames();
- Collection getVehicleScheduleFrames();
- Collection getTimetableFrames();
-
- LocalDateTime getPublicationTimestamp();
- void setPublicationTimestamp(LocalDateTime publicationTimestamp);
+ /**
+ * Get an entity index of GroupOfLines
+ * @return
+ */
+ NetexEntityIndex getGroupOfLinesIndex();
+
+ /**
+ * Get an entity index of Network
+ * @return
+ */
+ NetexEntityIndex getNetworkIndex();
+
+ /**
+ * Get a map of Network id by GroupOfLine id
+ * @return
+ */
+ Map getNetworkIdByGroupOfLineIdIndex();
+
+ /**
+ * Get an entity index of Authority
+ * @return
+ */
+ NetexEntityIndex getAuthorityIndex();
+
+ /**
+ * Get an entity index of DayType
+ * @return
+ */
+ NetexEntityIndex getDayTypeIndex();
+
+ /**
+ * Get a Multimap of DayTypeAssignment by DayType id
+ * @return
+ */
+ Multimap getDayTypeAssignmentsByDayTypeIdIndex();
+
+ /**
+ * Get a Multimap of PassengerStopAssignment by StopPoint ref
+ * * @return
+ */
+ Multimap getPassengerStopAssignmentsByStopPointRefIndex();
+
+ /**
+ * Get an entity index of DatedServiceJourney
+ * @return
+ */
+ NetexEntityIndex getDatedServiceJourneyIndex();
+
+ /**
+ * Get an entity index of DeadRun
+ * @return
+ */
+ NetexEntityIndex getDeadRunIndex();
+
+ /**
+ * Get a Multimap of DatedServiceJourney by ServiceJourney id
+ * @return
+ */
+ Multimap getDatedServiceJourneyByServiceJourneyRefIndex();
+
+ /**
+ * Get an entity index of DestinationDisplay
+ * @return
+ */
+ NetexEntityIndex getDestinationDisplayIndex();
+
+ /**
+ * Get an entity index of FlexibleStopPlace
+ * @return
+ */
+ NetexEntityIndex getFlexibleStopPlaceIndex();
+
+ /**
+ * Get an entity index of GroupOfStopPlaces
+ * @return
+ */
+ NetexEntityIndex getGroupOfStopPlacesIndex();
+
+ /**
+ * Get an entity index of JourneyPattern
+ * @return
+ */
+ NetexEntityIndex getJourneyPatternIndex();
+
+ /**
+ * Get an entity index of FlexibleLine
+ * @return
+ */
+ NetexEntityIndex getFlexibleLineIndex();
+
+ /**
+ * Get an entity index of Line
+ * @return
+ */
+ NetexEntityIndex getLineIndex();
+
+ /**
+ * Get an entity index of Notice
+ * @return
+ */
+ NetexEntityIndex getNoticeIndex();
+
+ /**
+ * Get an entity index of NoticeAssignment
+ * @return
+ */
+ NetexEntityIndex getNoticeAssignmentIndex();
+
+ /**
+ * Get an entity index of OperatingDay
+ * @return
+ */
+ NetexEntityIndex getOperatingDayIndex();
+
+ /**
+ * Get an entity index of OperatingPeriod
+ * @return
+ */
+ NetexEntityIndex getOperatingPeriodIndex();
+
+ /**
+ * Get an entity index of Operator
+ * @return
+ */
+ NetexEntityIndex getOperatorIndex();
+
+ /**
+ * Get an entity index of Branding
+ * @return
+ */
+ NetexEntityIndex getBrandingIndex();
+
+ /**
+ * Get a versioned entity index of Quay
+ * @return
+ */
+ VersionedNetexEntityIndex getQuayIndex();
+
+ /**
+ * Get a map of Quay id by StopPoint ref
+ * @return
+ */
+ Map getQuayIdByStopPointRefIndex();
+
+ /**
+ * Get a map of StopPlace id by StopPoint ref
+ * @return
+ */
+ Map getStopPlaceIdByStopPointRefIndex();
+
+ /**
+ * Get a map of StopPlace id by Quay id
+ * @return
+ */
+ Map getStopPlaceIdByQuayIdIndex();
+
+ /**
+ * Get a map of FlexibleStopPlace id by StopPoint ref
+ * @return
+ */
+ Map getFlexibleStopPlaceIdByStopPointRefIndex();
+
+ /**
+ * Get an entity index of Route
+ * @return
+ */
+ NetexEntityIndex getRouteIndex();
+
+ /**
+ * Get an entity index of ServiceJourney
+ * @return
+ */
+ NetexEntityIndex getServiceJourneyIndex();
+
+ /**
+ * Get an entity index of ServiceJourneyInterchange
+ * @return
+ */
+ NetexEntityIndex getServiceJourneyInterchangeIndex();
+
+ /**
+ * Get a map of ServiceJourneyInterchange by feeder or consumer ServiceJourney
+ * @return
+ */
+ Multimap getServiceJourneyInterchangeByServiceJourneyRefIndex();
+
+ /**
+ * Get an entity index of ServiceLink
+ * @return
+ */
+ NetexEntityIndex getServiceLinkIndex();
+
+ /**
+ * Get a versioned entity index of StopPlace
+ * @return
+ */
+ VersionedNetexEntityIndex getStopPlaceIndex();
+
+ /**
+ * Get an entity index of TariffZone
+ * @return
+ */
+ VersionedNetexEntityIndex getTariffZoneIndex();
+
+ /**
+ * Get an entity index of TopographicPlace
+ * @return
+ */
+ VersionedNetexEntityIndex getTopographicPlaceIndex();
+
+ /**
+ * Get an entity index of Parking
+ * @return
+ */
+ VersionedNetexEntityIndex getParkingIndex();
+
+ /**
+ * Get an entity index of ScheduledStopPoint
+ * @return
+ */
+ VersionedNetexEntityIndex getScheduledStopPointIndex();
+
+ /**
+ * Get an entity index of RoutePoint
+ * @return
+ */
+ NetexEntityIndex getRoutePointIndex();
+
+ /**
+ * Get an entity index of Block
+ * @return
+ */
+ NetexEntityIndex getBlockIndex();
+
+ /**
+ * Get a Multimap of parkings by ParentSite ref
+ * @return
+ */
+ Multimap getParkingsByParentSiteRefIndex();
+
+ /**
+ * Get an entity index of FareZone
+ * @return
+ */
+ VersionedNetexEntityIndex getFareZoneIndex();
+
+ VersionedNetexEntityIndex getGroupOfTariffZonesIndex();
+
+ Collection getCompositeFrames();
+ Collection getResourceFrames();
+ Collection getSiteFrames();
+ Collection getServiceFrames();
+ Collection getServiceCalendarFrames();
+ Collection getVehicleScheduleFrames();
+ Collection getTimetableFrames();
+
+ LocalDateTime getPublicationTimestamp();
+ void setPublicationTimestamp(LocalDateTime publicationTimestamp);
}
diff --git a/src/main/java/org/entur/netex/index/api/NetexEntityIndex.java b/src/main/java/org/entur/netex/index/api/NetexEntityIndex.java
index 5993d4cd..c81a9baa 100644
--- a/src/main/java/org/entur/netex/index/api/NetexEntityIndex.java
+++ b/src/main/java/org/entur/netex/index/api/NetexEntityIndex.java
@@ -1,48 +1,47 @@
package org.entur.netex.index.api;
-import org.rutebanken.netex.model.EntityStructure;
-
import java.util.Collection;
+import org.rutebanken.netex.model.EntityStructure;
/**
* A simple index of NeTEx entities of a specific type
* @param
*/
public interface NetexEntityIndex {
- /**
- * Get an entity by its id
- *
- * @param id
- * @return The entity
- */
- V get(String id);
+ /**
+ * Get an entity by its id
+ *
+ * @param id
+ * @return The entity
+ */
+ V get(String id);
- /**
- * Get all entities in the index
- *
- * @return A collection of the entity type
- */
- Collection getAll();
+ /**
+ * Get all entities in the index
+ *
+ * @return A collection of the entity type
+ */
+ Collection getAll();
- /**
- * Put an entity into the collection
- * If the entity already exists in the index, all versions
- * will be replaced.
- * @param entity
- */
- void put(String id, V entity);
+ /**
+ * Put an entity into the collection
+ * If the entity already exists in the index, all versions
+ * will be replaced.
+ * @param entity
+ */
+ void put(String id, V entity);
- /**
- * Put all entities into the collection
- * If an entity already exists in the index, all versions
- * will be replaced.
- * @param entities
- */
- void putAll(Collection entities);
+ /**
+ * Put all entities into the collection
+ * If an entity already exists in the index, all versions
+ * will be replaced.
+ * @param entities
+ */
+ void putAll(Collection entities);
- /**
- * Remove an entity from the index given its id
- * @param id
- */
- void remove(String id);
+ /**
+ * Remove an entity from the index given its id
+ * @param id
+ */
+ void remove(String id);
}
diff --git a/src/main/java/org/entur/netex/index/api/VersionedNetexEntityIndex.java b/src/main/java/org/entur/netex/index/api/VersionedNetexEntityIndex.java
index 78d6acec..41b3e1c7 100644
--- a/src/main/java/org/entur/netex/index/api/VersionedNetexEntityIndex.java
+++ b/src/main/java/org/entur/netex/index/api/VersionedNetexEntityIndex.java
@@ -1,71 +1,68 @@
package org.entur.netex.index.api;
-import org.rutebanken.netex.model.EntityStructure;
-
import java.util.Collection;
import java.util.Map;
+import org.rutebanken.netex.model.EntityStructure;
/**
* An index of versioned NeTEx entities
* @param
*/
public interface VersionedNetexEntityIndex {
+ /**
+ * Return the element with the latest version with the given {@code id}. Returns
+ * {@code null} if no element is found.
+ */
+ V getLatestVersion(String id);
- /**
- * Return the element with the latest version with the given {@code id}. Returns
- * {@code null} if no element is found.
- */
- V getLatestVersion(String id);
-
- /**
- * Return the element with the given {@code id} and {@code version}. Returns
- * {@code null} if no element is found
- * @param id
- * @param version
- * @return
- */
- V getVersion(String id, String version);
-
+ /**
+ * Return the element with the given {@code id} and {@code version}. Returns
+ * {@code null} if no element is found
+ * @param id
+ * @param version
+ * @return
+ */
+ V getVersion(String id, String version);
- /**
- * Return the latest version of all entities
- * @return
- */
- Collection getLatestVersions();
+ /**
+ * Return the latest version of all entities
+ * @return
+ */
+ Collection getLatestVersions();
- /**
- * Lookup all versions of element with the given {@code id}.
- *
- * @return an empty collection if no elements are found.
- */
- Collection getAllVersions(String id);
+ /**
+ * Lookup all versions of element with the given {@code id}.
+ *
+ * @return an empty collection if no elements are found.
+ */
+ Collection getAllVersions(String id);
- /**
- * Get all versions of all entities
- * @return
- */
- Map> getAllVersions();
+ /**
+ * Get all versions of all entities
+ * @return
+ */
+ Map> getAllVersions();
- /**
- * Put all versions of an entity into the index.
- * If the entity already exists in the index, all versions
- * will be replaced.
- *
- * @param id
- * @param entities
- */
- void put(String id, Collection entities);
+ /**
+ * Put all versions of an entity into the index.
+ * If the entity already exists in the index, all versions
+ * will be replaced.
+ *
+ * @param id
+ * @param entities
+ */
+ void put(String id, Collection entities);
- /**
- * Put all entities into the collection
- * If an entity already exists in the index, all versions
- * will be replaced.
- * @param entities
- */
- void putAll(Collection entities);
+ /**
+ * Put all entities into the collection
+ * If an entity already exists in the index, all versions
+ * will be replaced.
+ * @param entities
+ */
+ void putAll(Collection entities);
- /**
- * Remove all versions of an entity from the index given its id
- */
- void remove(String id);
+ /**
+ * Remove all versions of an entity from the index given its id
+ */
+ void remove(String id);
}
diff --git a/src/main/java/org/entur/netex/index/impl/NetexEntitiesIndexImpl.java b/src/main/java/org/entur/netex/index/impl/NetexEntitiesIndexImpl.java
index 395acaae..95ea42a9 100644
--- a/src/main/java/org/entur/netex/index/impl/NetexEntitiesIndexImpl.java
+++ b/src/main/java/org/entur/netex/index/impl/NetexEntitiesIndexImpl.java
@@ -1,5 +1,8 @@
package org.entur.netex.index.impl;
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Multimaps;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.HashSet;
@@ -50,382 +53,383 @@
import org.rutebanken.netex.model.TopographicPlace;
import org.rutebanken.netex.model.VehicleScheduleFrame;
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Multimaps;
-
/**
*
*/
public class NetexEntitiesIndexImpl implements NetexEntitiesIndex {
- // Indexes to entities
- public final NetexEntityIndex authoritiesById;
- public final NetexEntityIndex datedServiceJourneys;
- public final Multimap datedServiceJourneyByServiceJourneyRefIndex;
- private final NetexEntityIndex deadRuns;
- public final NetexEntityIndex dayTypeById;
- public final Multimap dayTypeAssignmentByDayTypeId;
- public final Multimap passengerStopAssignmentByStopPointRef;
- public final NetexEntityIndex destinationDisplayById;
- public final NetexEntityIndex flexibleStopPlaceById;
- public final NetexEntityIndex groupOfLinesById;
- public final NetexEntityIndex groupOfStopPlacesById;
- public final NetexEntityIndex journeyPatternsById;
- public final NetexEntityIndex flexibleLineByid;
- public final NetexEntityIndex lineById;
- public final NetexEntityIndex networkById;
- public final NetexEntityIndex noticeById;
- public final NetexEntityIndex noticeAssignmentById;
- public final NetexEntityIndex operatingDayById;
- public final NetexEntityIndex operatingPeriodById;
- public final NetexEntityIndex operatorsById;
- public final NetexEntityIndex brandingsById;
- public final VersionedNetexEntityIndex quayById;
- public final Map flexibleStopPlaceByStopPointRef;
- public final Map quayIdByStopPointRef;
- public final Map stopPlaceIdByStopPointRef;
- public final Map stopPlaceIdByQuayId;
- public final NetexEntityIndex routeById;
- public final NetexEntityIndex serviceJourneyById;
- public final NetexEntityIndex serviceJourneyInterchangeById;
- public final Multimap serviceJourneyInterchangeByServiceJourneyRef;
- public final NetexEntityIndex serviceLinkById;
- public final VersionedNetexEntityIndex stopPlaceById;
- public final VersionedNetexEntityIndex tariffZonesById;
- public final VersionedNetexEntityIndex topographicPlaceById;
- public final VersionedNetexEntityIndex parkingById;
- public final VersionedNetexEntityIndex scheduledStopPointById;
- public final NetexEntityIndex routePointById;
- public final NetexEntityIndex blockById;
- public final VersionedNetexEntityIndex fareZoneById;
- public final VersionedNetexEntityIndex groupOfTariffZonesById;
- public final Multimap parkingsByParentSiteRef;
-
- // Relations between entities - The Netex XML sometimes rely on the
- // nested structure of the XML document, rater than explicit references.
- // Since we throw away the document we need to keep track of these.
-
- public final Map networkIdByGroupOfLineId;
-
- // NeTEx Frames
- public final Collection compositeFrames;
- public final Collection resourceFrames;
- public final Collection siteFrames;
- public final Collection serviceFrames;
- public final Collection serviceCalendarFrames;
- public final Collection vehicleScheduleFrames;
- public final Collection timetableFrames;
-
- private LocalDateTime publicationTimestamp;
-
- /**
- * Create a root node.
- */
- public NetexEntitiesIndexImpl() {
- this.authoritiesById = new NetexEntityMapByIdImpl<>();
- this.dayTypeById = new NetexEntityMapByIdImpl<>();
- this.dayTypeAssignmentByDayTypeId = Multimaps.synchronizedListMultimap(ArrayListMultimap.create());
- this.passengerStopAssignmentByStopPointRef = Multimaps.synchronizedListMultimap(ArrayListMultimap.create());
- this.datedServiceJourneys = new NetexEntityMapByIdImpl<>();
- this.datedServiceJourneyByServiceJourneyRefIndex = Multimaps.synchronizedListMultimap(ArrayListMultimap.create());
- this.deadRuns = new NetexEntityMapByIdImpl<>();
- this.destinationDisplayById = new NetexEntityMapByIdImpl<>();
- this.flexibleStopPlaceById = new NetexEntityMapByIdImpl<>();
- this.groupOfLinesById = new NetexEntityMapByIdImpl<>();
- this.groupOfStopPlacesById = new NetexEntityMapByIdImpl<>();
- this.journeyPatternsById = new NetexEntityMapByIdImpl<>();
- this.flexibleLineByid = new NetexEntityMapByIdImpl<>();
- this.lineById = new NetexEntityMapByIdImpl<>();
- this.networkById = new NetexEntityMapByIdImpl<>();
- this.networkIdByGroupOfLineId = new ConcurrentHashMap<>();
- this.noticeById = new NetexEntityMapByIdImpl<>();
- this.noticeAssignmentById = new NetexEntityMapByIdImpl<>();
- this.operatingDayById = new NetexEntityMapByIdImpl<>();
- this.operatingPeriodById = new NetexEntityMapByIdImpl<>();
- this.operatorsById = new NetexEntityMapByIdImpl<>();
- this.brandingsById = new NetexEntityMapByIdImpl<>();
- this.quayById = new VersionedNetexEntityIndexImpl<>();
- this.flexibleStopPlaceByStopPointRef = new ConcurrentHashMap<>();
- this.quayIdByStopPointRef = new ConcurrentHashMap<>();
- this.stopPlaceIdByStopPointRef = new ConcurrentHashMap<>();
- this.stopPlaceIdByQuayId = new ConcurrentHashMap<>();
- this.routeById = new NetexEntityMapByIdImpl<>();
- this.serviceJourneyById = new NetexEntityMapByIdImpl<>();
- this.serviceJourneyInterchangeById = new NetexEntityMapByIdImpl<>();
- this.serviceJourneyInterchangeByServiceJourneyRef = Multimaps.synchronizedListMultimap(ArrayListMultimap.create());
- this.serviceLinkById = new NetexEntityMapByIdImpl<>();
- this.stopPlaceById = new VersionedNetexEntityIndexImpl<>();
- this.tariffZonesById = new VersionedNetexEntityIndexImpl<>();
- this.topographicPlaceById = new VersionedNetexEntityIndexImpl<>();
- this.parkingById = new VersionedNetexEntityIndexImpl<>();
- this.scheduledStopPointById = new VersionedNetexEntityIndexImpl<>();
- this.routePointById = new NetexEntityMapByIdImpl<>();
- this.blockById = new NetexEntityMapByIdImpl<>();
- this.fareZoneById = new VersionedNetexEntityIndexImpl<>();
- this.groupOfTariffZonesById = new VersionedNetexEntityIndexImpl<>();
- this.compositeFrames = new HashSet<>();
- this.siteFrames = new HashSet<>();
- this.resourceFrames = new HashSet<>();
- this.serviceFrames = new HashSet<>();
- this.serviceCalendarFrames = new HashSet<>();
- this.vehicleScheduleFrames = new HashSet<>();
- this.timetableFrames = new HashSet<>();
- this.parkingsByParentSiteRef = Multimaps.synchronizedListMultimap(ArrayListMultimap.create());
- }
-
- @Override
- public NetexEntityIndex getGroupOfLinesIndex() {
- return groupOfLinesById;
- }
-
- @Override
- public NetexEntityIndex getNetworkIndex() {
- return networkById;
- }
-
- @Override
- public Map getNetworkIdByGroupOfLineIdIndex() {
- return networkIdByGroupOfLineId;
- }
-
- @Override
- public NetexEntityIndex getAuthorityIndex() {
- return authoritiesById;
- }
-
- @Override
- public NetexEntityIndex getDayTypeIndex() {
- return dayTypeById;
- }
-
- @Override
- public Multimap getDayTypeAssignmentsByDayTypeIdIndex() {
- return dayTypeAssignmentByDayTypeId;
- }
-
- @Override
- public Multimap getPassengerStopAssignmentsByStopPointRefIndex() {
- return passengerStopAssignmentByStopPointRef;
- }
-
- @Override
- public NetexEntityIndex getDatedServiceJourneyIndex() {
- return datedServiceJourneys;
- }
-
- @Override
- public NetexEntityIndex getDeadRunIndex() {
- return deadRuns;
- }
-
- @Override
- public Multimap getDatedServiceJourneyByServiceJourneyRefIndex() {
- return datedServiceJourneyByServiceJourneyRefIndex;
- }
-
- @Override
- public NetexEntityIndex getDestinationDisplayIndex() {
- return destinationDisplayById;
- }
-
- @Override
- public NetexEntityIndex getFlexibleStopPlaceIndex() {
- return flexibleStopPlaceById;
- }
-
- @Override
- public NetexEntityIndex getGroupOfStopPlacesIndex() {
- return groupOfStopPlacesById;
- }
-
- @Override
- public NetexEntityIndex getJourneyPatternIndex() {
- return journeyPatternsById;
- }
-
- @Override
- public NetexEntityIndex getFlexibleLineIndex() {
- return flexibleLineByid;
- }
-
- @Override
- public NetexEntityIndex getLineIndex() {
- return lineById;
- }
-
- @Override
- public NetexEntityIndex getNoticeIndex() {
- return noticeById;
- }
-
- @Override
- public NetexEntityIndex getNoticeAssignmentIndex() {
- return noticeAssignmentById;
- }
-
- @Override
- public NetexEntityIndex getOperatingDayIndex() {
- return operatingDayById;
- }
-
- @Override
- public NetexEntityIndex getOperatingPeriodIndex() {
- return operatingPeriodById;
- }
-
- @Override
- public NetexEntityIndex getOperatorIndex() {
- return operatorsById;
- }
-
- @Override
- public NetexEntityIndex getBrandingIndex() {
- return brandingsById;
- }
-
- @Override
- public VersionedNetexEntityIndex getQuayIndex() {
- return quayById;
- }
-
- @Override
- public Map getFlexibleStopPlaceIdByStopPointRefIndex() {
- return flexibleStopPlaceByStopPointRef;
- }
-
- @Override
- public Map getQuayIdByStopPointRefIndex() {
- return quayIdByStopPointRef;
- }
-
- @Override
- public Map getStopPlaceIdByStopPointRefIndex() {
- return stopPlaceIdByStopPointRef;
- }
-
- @Override
- public Map getStopPlaceIdByQuayIdIndex() {
- return stopPlaceIdByQuayId;
- }
-
- @Override
- public NetexEntityIndex getRouteIndex() {
- return routeById;
- }
-
- @Override
- public NetexEntityIndex getServiceJourneyIndex() {
- return serviceJourneyById;
- }
-
- @Override
- public NetexEntityIndex getServiceJourneyInterchangeIndex() {
- return serviceJourneyInterchangeById;
- }
-
- @Override
- public Multimap getServiceJourneyInterchangeByServiceJourneyRefIndex() {
- return serviceJourneyInterchangeByServiceJourneyRef;
- }
-
- @Override
- public NetexEntityIndex getServiceLinkIndex() {
- return serviceLinkById;
- }
-
- @Override
- public VersionedNetexEntityIndex getStopPlaceIndex() {
- return stopPlaceById;
- }
-
- @Override
- public VersionedNetexEntityIndex getTariffZoneIndex() {
- return tariffZonesById;
- }
-
- @Override
- public VersionedNetexEntityIndex getTopographicPlaceIndex() {
- return topographicPlaceById;
- }
-
- @Override
- public VersionedNetexEntityIndex getParkingIndex() {
- return parkingById;
- }
-
- @Override
- public VersionedNetexEntityIndex getScheduledStopPointIndex() {
- return scheduledStopPointById;
- }
-
- @Override
- public NetexEntityIndex getRoutePointIndex() {
- return routePointById;
- }
-
- @Override
- public NetexEntityIndex getBlockIndex() {
- return blockById;
- }
-
- @Override
- public VersionedNetexEntityIndex getFareZoneIndex() {
- return fareZoneById;
- }
-
- @Override
- public VersionedNetexEntityIndex getGroupOfTariffZonesIndex() {
- return groupOfTariffZonesById;
- }
-
- @Override
- public Collection getCompositeFrames() {
- return compositeFrames;
- }
-
- @Override
- public Collection getResourceFrames() {
- return resourceFrames;
- }
-
- @Override
- public Collection getSiteFrames() {
- return siteFrames;
- }
-
- @Override
- public Collection getServiceFrames() {
- return serviceFrames;
- }
-
- @Override
- public Collection getServiceCalendarFrames() {
- return serviceCalendarFrames;
- }
-
- @Override
- public Collection getVehicleScheduleFrames() {
- return vehicleScheduleFrames;
- }
-
- @Override
- public Collection getTimetableFrames() {
- return timetableFrames;
- }
-
- @Override
- public LocalDateTime getPublicationTimestamp() {
- return publicationTimestamp;
- }
-
- @Override
- public void setPublicationTimestamp(LocalDateTime publicationTimestamp) {
- this.publicationTimestamp = publicationTimestamp;
- }
-
- @Override
- public Multimap getParkingsByParentSiteRefIndex() {
- return parkingsByParentSiteRef;
- }
+ // Indexes to entities
+ public final NetexEntityIndex authoritiesById;
+ public final NetexEntityIndex datedServiceJourneys;
+ public final Multimap datedServiceJourneyByServiceJourneyRefIndex;
+ private final NetexEntityIndex deadRuns;
+ public final NetexEntityIndex dayTypeById;
+ public final Multimap dayTypeAssignmentByDayTypeId;
+ public final Multimap passengerStopAssignmentByStopPointRef;
+ public final NetexEntityIndex destinationDisplayById;
+ public final NetexEntityIndex flexibleStopPlaceById;
+ public final NetexEntityIndex groupOfLinesById;
+ public final NetexEntityIndex groupOfStopPlacesById;
+ public final NetexEntityIndex journeyPatternsById;
+ public final NetexEntityIndex flexibleLineByid;
+ public final NetexEntityIndex lineById;
+ public final NetexEntityIndex networkById;
+ public final NetexEntityIndex noticeById;
+ public final NetexEntityIndex noticeAssignmentById;
+ public final NetexEntityIndex operatingDayById;
+ public final NetexEntityIndex operatingPeriodById;
+ public final NetexEntityIndex operatorsById;
+ public final NetexEntityIndex brandingsById;
+ public final VersionedNetexEntityIndex quayById;
+ public final Map flexibleStopPlaceByStopPointRef;
+ public final Map quayIdByStopPointRef;
+ public final Map stopPlaceIdByStopPointRef;
+ public final Map stopPlaceIdByQuayId;
+ public final NetexEntityIndex routeById;
+ public final NetexEntityIndex serviceJourneyById;
+ public final NetexEntityIndex serviceJourneyInterchangeById;
+ public final Multimap serviceJourneyInterchangeByServiceJourneyRef;
+ public final NetexEntityIndex serviceLinkById;
+ public final VersionedNetexEntityIndex stopPlaceById;
+ public final VersionedNetexEntityIndex tariffZonesById;
+ public final VersionedNetexEntityIndex topographicPlaceById;
+ public final VersionedNetexEntityIndex parkingById;
+ public final VersionedNetexEntityIndex scheduledStopPointById;
+ public final NetexEntityIndex routePointById;
+ public final NetexEntityIndex blockById;
+ public final VersionedNetexEntityIndex fareZoneById;
+ public final VersionedNetexEntityIndex groupOfTariffZonesById;
+ public final Multimap