-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Filter import of rental data by pickup type #6240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
3a1f3de
55e7913
985817a
e516350
993bed1
49a0f78
42c318f
39750a2
f148008
7735de7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package org.opentripplanner.updater.vehicle_rental.datasources.params; | ||
|
|
||
| import org.opentripplanner.framework.doc.DocumentedEnum; | ||
|
|
||
| /** | ||
| * This is temporary and will be removed in a future version of OTP. | ||
| * | ||
| * Enum to specify the type of rental data that is allowed to be read from the data source. | ||
| */ | ||
| public enum AllowedRentalType implements DocumentedEnum<AllowedRentalType> { | ||
|
||
| STATIONS("Only station data is allowed."), | ||
| VEHICLES("Only vehicle data is allowed."), | ||
| ALL("All types of rental data are allowed."); | ||
|
|
||
| private final String description; | ||
|
|
||
| AllowedRentalType(String description) { | ||
| this.description = description.stripIndent().trim(); | ||
| } | ||
|
|
||
| @Override | ||
| public String typeDescription() { | ||
| return ( | ||
| "Temporary parameter. Use this to specify the type of rental data that is allowed to be read from the data source." | ||
| ); | ||
| } | ||
|
|
||
| @Override | ||
| public String enumValueDescription() { | ||
| return description; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,6 @@ | ||||||||
| package org.opentripplanner.updater.vehicle_rental.datasources.params; | ||||||||
|
|
||||||||
| import java.util.Objects; | ||||||||
| import org.opentripplanner.updater.spi.HttpHeaders; | ||||||||
| import org.opentripplanner.updater.vehicle_rental.VehicleRentalSourceType; | ||||||||
|
|
||||||||
|
|
@@ -10,11 +11,24 @@ public record GbfsVehicleRentalDataSourceParameters( | |||||||
| HttpHeaders httpHeaders, | ||||||||
| String network, | ||||||||
| boolean geofencingZones, | ||||||||
| boolean overloadingAllowed | ||||||||
| boolean overloadingAllowed, | ||||||||
| AllowedRentalType allowedRentalType | ||||||||
|
||||||||
| public AlertUrl { | |
| Objects.requireNonNull(uri); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@optionsome / @leonardehrenfried What is the right name for this?
I would not include "Allowed" in the name, it restrict the type, so it can not be reused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the "type" (?) of the rental: either free-floating or station-based.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed that we want to use a Set of opt-in rental types. I've used the same pattern when filtering what to import from NeTEx:
OpenTripPlanner/application/src/main/java/org/opentripplanner/netex/loader/parser/NetexDocumentParser.java
Lines 82 to 84 in f4bfedf
In our case we probably want to use opt-in rather than opt-out as it's easier to reason about.