-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add validation of route to centroid StopPlace ids
- Loading branch information
1 parent
345b2a9
commit 7d77b4c
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/org/opentripplanner/netex/validation/RouteToCentroidStationIdValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.opentripplanner.netex.validation; | ||
|
||
import java.util.Set; | ||
import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; | ||
import org.opentripplanner.netex.index.NetexEntityIndex; | ||
|
||
public class RouteToCentroidStationIdValidator { | ||
public static void validate( | ||
DataImportIssueStore issueStore, | ||
Set<String> routeToCentroidStationIds, | ||
NetexEntityIndex index | ||
) { | ||
routeToCentroidStationIds | ||
.stream() | ||
.filter(id -> !index.stopPlaceById.containsKey(id)) | ||
.forEach(id -> | ||
issueStore.add( | ||
"UnknownStopPlaceId", | ||
"routeToCentroidStationIds specified a stopPlace that does not exist: " + id | ||
) | ||
); | ||
} | ||
} |