Skip to content

Commit

Permalink
Merge pull request #4459 from entur/otp2_allowed_banned_networks
Browse files Browse the repository at this point in the history
Allow specifying allowed/banned rental networks in the Transmodel API
  • Loading branch information
t2gran authored Sep 22, 2022
2 parents 21cb59d + 94b5c7d commit 7d23cfb
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/sandbox/TransmodelApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
[#4232](https://github.com/opentripplanner/OpenTripPlanner/pull/4232)
- Fix issue when ServiceJourney is created by an updater and expose necessary information via DSJ
[#4365](https://github.com/opentripplanner/OpenTripPlanner/pull/4365)
- Allow specifying allowed/banned rental networks in trip query
[#4459](https://github.com/opentripplanner/OpenTripPlanner/pull/4459)

## Documentation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import org.opentripplanner.ext.transmodelapi.mapping.TransitIdMapper;
import org.opentripplanner.ext.transmodelapi.model.PlanResponse;
import org.opentripplanner.ext.transmodelapi.model.TransmodelTransportSubmode;
Expand Down Expand Up @@ -203,6 +204,16 @@ private RouteRequest createRequest(DataFetchingEnvironment environment) {
// callWith.argument("banned.quays", quays -> request.setBannedStops(mappingUtil.prepareListOfFeedScopedId((List<String>) quays)));
// callWith.argument("banned.quaysHard", quaysHard -> request.setBannedStopsHard(mappingUtil.prepareListOfFeedScopedId((List<String>) quaysHard)));

callWith.argument(
"whiteListed.rentalNetworks",
(List<String> networks) -> request.journey().rental().setAllowedNetworks(Set.copyOf(networks))
);

callWith.argument(
"banned.rentalNetworks",
(List<String> networks) -> request.journey().rental().setBannedNetworks(Set.copyOf(networks))
);

// callWith.argument("heuristicStepsPerMainStep", (Integer v) -> request.heuristicStepsPerMainStep = v);
// callWith.argument("compactLegsByReversedSearch", (Boolean v) -> { /* not used any more */ });
// callWith.argument("banFirstServiceJourneysFromReuseNo", (Integer v) -> request.banFirstTripsFromReuseNo = v);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,11 @@ public class BannedInputType {
"Set of ids of service journeys that should not be used."
)
)
.field(
GqlUtil.newIdListInputField(
"rentalNetworks",
"Set of ids of rental networks that should not be allowed for renting vehicles."
)
)
.build();
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Set;
import java.util.stream.Stream;
import org.opentripplanner.ext.transmodelapi.mapping.TransitIdMapper;
import org.opentripplanner.ext.transmodelapi.support.GqlUtil;
import org.opentripplanner.model.TripTimeOnDate;
import org.opentripplanner.transit.model.framework.FeedScopedId;
import org.opentripplanner.transit.model.network.Route;
Expand All @@ -28,6 +29,12 @@ public class JourneyWhiteListed {
)
.field(newIdListInputField("lines", "Set of ids for lines that should be used"))
.field(newIdListInputField("authorities", "Set of ids for authorities that should be used"))
.field(
GqlUtil.newIdListInputField(
"rentalNetworks",
"Set of ids of rental networks that should be used for renting vehicles."
)
)
.build();

public final Set<FeedScopedId> authorityIds;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ public static GraphQLFieldDefinition create(
GraphQLArgument
.newArgument()
.name("whiteListed")
.description("Whitelisted")
.description(
"Parameters for indicating the only authorities, lines or quays to be used in the trip patterns"
)
Expand Down

0 comments on commit 7d23cfb

Please sign in to comment.