Skip to content

Commit

Permalink
mapper class, fix name check
Browse files Browse the repository at this point in the history
  • Loading branch information
sharhio committed Jun 20, 2024
1 parent d75c872 commit 85542c1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import org.opentripplanner.apis.gtfs.datafetchers.VehicleParkingImpl;
import org.opentripplanner.apis.gtfs.datafetchers.VehiclePositionImpl;
import org.opentripplanner.apis.gtfs.datafetchers.VehicleRentalStationImpl;
import org.opentripplanner.apis.gtfs.datafetchers.VehicleRentalSystemImpl;
import org.opentripplanner.apis.gtfs.datafetchers.debugOutputImpl;
import org.opentripplanner.apis.gtfs.datafetchers.elevationProfileComponentImpl;
import org.opentripplanner.apis.gtfs.datafetchers.placeAtDistanceImpl;
Expand Down Expand Up @@ -165,6 +166,7 @@ protected static GraphQLSchema buildSchema() {
.type(typeWiring.build(BookingTimeImpl.class))
.type(typeWiring.build(BookingInfoImpl.class))
.type(typeWiring.build(VehicleRentalStationImpl.class))
.type(typeWiring.build(VehicleRentalSystemImpl.class))
.type(typeWiring.build(RentalVehicleImpl.class))
.type(typeWiring.build(RentalVehicleTypeImpl.class))
.type(typeWiring.build(StopOnRouteImpl.class))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.opentripplanner.apis.gtfs.datafetchers;

import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.opentripplanner.apis.gtfs.generated.GraphQLDataFetchers;
import org.opentripplanner.service.vehiclerental.model.VehicleRentalSystem;

public class VehicleRentalSystemImpl implements GraphQLDataFetchers.GraphQLVehicleRentalSystem {

@Override
public DataFetcher<String> url() {
return environment -> getSource(environment).url;
}

private VehicleRentalSystem getSource(DataFetchingEnvironment environment) {
return environment.getSource();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,10 @@ public interface GraphQLVehicleRentalStation {
public DataFetcher<Integer> vehiclesAvailable();
}

public interface GraphQLVehicleRentalSystem {
public DataFetcher<String> url();
}

public interface GraphQLVehicleRentalUris {
public DataFetcher<String> android();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private GeofencingZone toInternalModel(GBFSFeature f) {
return null;
}
var name = Objects.requireNonNullElseGet(f.getProperties().getName(), () -> fallbackId(g));
if (StringUtils.hasValue(name)) {
if (!StringUtils.hasValue(name)) {
name = fallbackId(g);
}
var dropOffBanned = !f.getProperties().getRules().get(0).getRideAllowed();
Expand Down

0 comments on commit 85542c1

Please sign in to comment.