Search in sources :

Example 1 with Agency

use of org.opentripplanner.model.Agency in project OpenTripPlanner by opentripplanner.

the class SiriTimetableSnapshotSource method handleAddedTrip.

private boolean handleAddedTrip(Graph graph, String feedId, EstimatedVehicleJourney estimatedVehicleJourney) {
    // Verifying values required in SIRI Profile
    // Added ServiceJourneyId
    String newServiceJourneyRef = estimatedVehicleJourney.getEstimatedVehicleJourneyCode();
    Preconditions.checkNotNull(newServiceJourneyRef, "EstimatedVehicleJourneyCode is required");
    // Replaced/duplicated ServiceJourneyId
    // VehicleJourneyRef existingServiceJourneyRef = estimatedVehicleJourney.getVehicleJourneyRef();
    // Preconditions.checkNotNull(existingServiceJourneyRef, "VehicleJourneyRef is required");
    // LineRef of added trip
    Preconditions.checkNotNull(estimatedVehicleJourney.getLineRef(), "LineRef is required");
    String lineRef = estimatedVehicleJourney.getLineRef().getValue();
    // OperatorRef of added trip
    Preconditions.checkNotNull(estimatedVehicleJourney.getOperatorRef(), "OperatorRef is required");
    String operatorRef = estimatedVehicleJourney.getOperatorRef().getValue();
    // Required in SIRI, but currently not in use by OTP
    // Preconditions.checkNotNull(estimatedVehicleJourney.getRouteRef(), "RouteRef is required");
    // String routeRef = estimatedVehicleJourney.getRouteRef().getValue();
    // Preconditions.checkNotNull(estimatedVehicleJourney.getGroupOfLinesRef(), "GroupOfLinesRef is required");
    // String groupOfLines = estimatedVehicleJourney.getGroupOfLinesRef().getValue();
    // Preconditions.checkNotNull(estimatedVehicleJourney.getExternalLineRef(), "ExternalLineRef is required");
    String externalLineRef = estimatedVehicleJourney.getExternalLineRef().getValue();
    // TODO - SIRI: Where is the Operator?
    // Operator operator = graphIndex.operatorForId.get(new FeedScopedId(feedId, operatorRef));
    // Preconditions.checkNotNull(operator, "Operator " + operatorRef + " is unknown");
    FeedScopedId tripId = new FeedScopedId(feedId, newServiceJourneyRef);
    FeedScopedId serviceId = new FeedScopedId(feedId, newServiceJourneyRef);
    Route replacedRoute = null;
    if (externalLineRef != null) {
        replacedRoute = graph.index.getRouteForId(new FeedScopedId(feedId, externalLineRef));
    }
    FeedScopedId routeId = new FeedScopedId(feedId, lineRef);
    Route route = graph.index.getRouteForId(routeId);
    if (route == null) {
        // Route is unknown - create new
        route = new Route();
        route.setId(routeId);
        route.setType(getRouteType(estimatedVehicleJourney.getVehicleModes()));
        // route.setOperator(operator);
        // TODO - SIRI: Is there a better way to find authority/Agency?
        // Finding first Route with same Operator, and using same Authority
        Agency agency = graph.index.getAllRoutes().stream().findFirst().get().getAgency();
        route.setAgency(agency);
        if (estimatedVehicleJourney.getPublishedLineNames() != null && !estimatedVehicleJourney.getPublishedLineNames().isEmpty()) {
            route.setShortName("" + estimatedVehicleJourney.getPublishedLineNames().get(0).getValue());
        }
        LOG.info("Adding route {} to graph.", routeId);
        graph.index.addRoutes(route);
    }
    Trip trip = new Trip();
    trip.setId(tripId);
    trip.setRoute(route);
    // TODO - SIRI: Set transport-submode based on replaced- and replacement-route
    if (replacedRoute != null) {
        if (replacedRoute.getType() >= 100 && replacedRoute.getType() < 200) {
            // Replaced-route is RAIL
            if (route.getType() == 100) {
            // Replacement-route is also RAIL
            // trip.setTransportSubmode(TransmodelTransportSubmode.REPLACEMENT_RAIL_SERVICE);
            } else if (route.getType() == 700) {
            // Replacement-route is BUS
            // trip.setTransportSubmode(TransmodelTransportSubmode.RAIL_REPLACEMENT_BUS);
            }
        }
    }
    trip.setServiceId(serviceId);
    // TODO - SIRI: PublishedLineName not defined in SIRI-profile
    if (estimatedVehicleJourney.getPublishedLineNames() != null && !estimatedVehicleJourney.getPublishedLineNames().isEmpty()) {
        trip.setRouteShortName("" + estimatedVehicleJourney.getPublishedLineNames().get(0).getValue());
    }
    // trip.setTripOperator(operator);
    // TODO - SIRI: Populate these?
    // Replacement-trip has different shape
    trip.setShapeId(null);
    // trip.setTripPrivateCode(null);
    // trip.setTripPublicCode(null);
    trip.setBlockId(null);
    trip.setTripShortName(null);
    trip.setTripHeadsign(null);
    // trip.setKeyValues(null);
    List<Stop> addedStops = new ArrayList<>();
    List<StopTime> aimedStopTimes = new ArrayList<>();
    List<EstimatedCall> estimatedCalls = estimatedVehicleJourney.getEstimatedCalls().getEstimatedCalls();
    for (int i = 0; i < estimatedCalls.size(); i++) {
        EstimatedCall estimatedCall = estimatedCalls.get(i);
        Stop stop = getStopForStopId(feedId, estimatedCall.getStopPointRef().getValue());
        StopTime stopTime = new StopTime();
        stopTime.setStop(stop);
        stopTime.setStopSequence(i);
        stopTime.setTrip(trip);
        ZonedDateTime aimedArrivalTime = estimatedCall.getAimedArrivalTime();
        ZonedDateTime aimedDepartureTime = estimatedCall.getAimedDepartureTime();
        if (aimedArrivalTime != null) {
            stopTime.setArrivalTime(calculateSecondsSinceMidnight(aimedArrivalTime));
        }
        if (aimedDepartureTime != null) {
            stopTime.setDepartureTime(calculateSecondsSinceMidnight(aimedDepartureTime));
        }
        if (estimatedCall.getArrivalBoardingActivity() == ArrivalBoardingActivityEnumeration.ALIGHTING) {
            stopTime.setDropOffType(PICKDROP_SCHEDULED);
        } else {
            stopTime.setDropOffType(PICKDROP_NONE);
        }
        if (estimatedCall.getDepartureBoardingActivity() == DepartureBoardingActivityEnumeration.BOARDING) {
            stopTime.setPickupType(PICKDROP_SCHEDULED);
        } else {
            stopTime.setPickupType(PICKDROP_NONE);
        }
        if (estimatedCall.getDestinationDisplaies() != null && !estimatedCall.getDestinationDisplaies().isEmpty()) {
            NaturalLanguageStringStructure destinationDisplay = estimatedCall.getDestinationDisplaies().get(0);
            stopTime.setStopHeadsign(destinationDisplay.getValue());
        }
        if (i == 0) {
            // Fake arrival on first stop
            stopTime.setArrivalTime(stopTime.getDepartureTime());
        } else if (i == (estimatedCalls.size() - 1)) {
            // Fake departure from last stop
            stopTime.setDepartureTime(stopTime.getArrivalTime());
        }
        addedStops.add(stop);
        aimedStopTimes.add(stopTime);
    }
    StopPattern stopPattern = new StopPattern(aimedStopTimes);
    TripPattern pattern = new TripPattern(trip.getRoute(), stopPattern);
    TripTimes tripTimes = new TripTimes(trip, aimedStopTimes, graph.deduplicator);
    boolean isJourneyPredictionInaccurate = (estimatedVehicleJourney.isPredictionInaccurate() != null && estimatedVehicleJourney.isPredictionInaccurate());
    // If added trip is updated with realtime - loop through and add delays
    for (int i = 0; i < estimatedCalls.size(); i++) {
        EstimatedCall estimatedCall = estimatedCalls.get(i);
        ZonedDateTime expectedArrival = estimatedCall.getExpectedArrivalTime();
        ZonedDateTime expectedDeparture = estimatedCall.getExpectedDepartureTime();
        int aimedArrivalTime = aimedStopTimes.get(i).getArrivalTime();
        int aimedDepartureTime = aimedStopTimes.get(i).getDepartureTime();
        if (expectedArrival != null) {
            int expectedArrivalTime = calculateSecondsSinceMidnight(expectedArrival);
            tripTimes.updateArrivalDelay(i, expectedArrivalTime - aimedArrivalTime);
        }
        if (expectedDeparture != null) {
            int expectedDepartureTime = calculateSecondsSinceMidnight(expectedDeparture);
            tripTimes.updateDepartureDelay(i, expectedDepartureTime - aimedDepartureTime);
        }
        if (estimatedCall.isCancellation() != null) {
            tripTimes.setCancelledStop(i, estimatedCall.isCancellation());
        }
        boolean isCallPredictionInaccurate = estimatedCall.isPredictionInaccurate() != null && estimatedCall.isPredictionInaccurate();
        tripTimes.setPredictionInaccurate(i, (isJourneyPredictionInaccurate | isCallPredictionInaccurate));
        if (i == 0) {
            // Fake arrival on first stop
            tripTimes.updateArrivalTime(i, tripTimes.getDepartureTime(i));
        } else if (i == (estimatedCalls.size() - 1)) {
            // Fake departure from last stop
            tripTimes.updateDepartureTime(i, tripTimes.getArrivalTime(i));
        }
    }
    // Adding trip to index necessary to include values in graphql-queries
    // TODO - SIRI: should more data be added to index?
    graph.index.getTripForId().put(tripId, trip);
    graph.index.getPatternForTrip().put(trip, pattern);
    if (estimatedVehicleJourney.isCancellation() != null && estimatedVehicleJourney.isCancellation()) {
        tripTimes.cancel();
    } else {
        tripTimes.setRealTimeState(RealTimeState.ADDED);
    }
    if (!graph.getServiceCodes().containsKey(serviceId)) {
        graph.getServiceCodes().put(serviceId, graph.getServiceCodes().size());
    }
    tripTimes.serviceCode = graph.getServiceCodes().get(serviceId);
    pattern.add(tripTimes);
    Preconditions.checkState(tripTimes.timesIncreasing(), "Non-increasing triptimes for added trip");
    ServiceDate serviceDate = getServiceDateForEstimatedVehicleJourney(estimatedVehicleJourney);
    if (graph.getCalendarService().getServiceDatesForServiceId(serviceId) == null || graph.getCalendarService().getServiceDatesForServiceId(serviceId).isEmpty()) {
        LOG.info("Adding serviceId {} to CalendarService", serviceId);
    // TODO - SIRI: Need to add the ExtraJourney as a Trip - alerts may be attached to it
    // graph.getCalendarService().addServiceIdAndServiceDates(serviceId, Arrays.asList(serviceDate));
    }
    return addTripToGraphAndBuffer(feedId, graph, trip, aimedStopTimes, addedStops, tripTimes, serviceDate);
}
Also used : NaturalLanguageStringStructure(uk.org.siri.siri20.NaturalLanguageStringStructure) StopPattern(org.opentripplanner.model.StopPattern) Trip(org.opentripplanner.model.Trip) Agency(org.opentripplanner.model.Agency) Stop(org.opentripplanner.model.Stop) ArrayList(java.util.ArrayList) TripPattern(org.opentripplanner.model.TripPattern) ServiceDate(org.opentripplanner.model.calendar.ServiceDate) ZonedDateTime(java.time.ZonedDateTime) FeedScopedId(org.opentripplanner.model.FeedScopedId) TimetableHelper.createUpdatedTripTimes(org.opentripplanner.ext.siri.TimetableHelper.createUpdatedTripTimes) TripTimes(org.opentripplanner.routing.trippattern.TripTimes) EstimatedCall(uk.org.siri.siri20.EstimatedCall) Route(org.opentripplanner.model.Route) StopTime(org.opentripplanner.model.StopTime)

Example 2 with Agency

use of org.opentripplanner.model.Agency in project OpenTripPlanner by opentripplanner.

the class LegacyGraphQLQueryTypeImpl method node.

@Override
public DataFetcher<Object> node() {
    return environment -> {
        var args = new LegacyGraphQLTypes.LegacyGraphQLQueryTypeNodeArgs(environment.getArguments());
        String type = args.getLegacyGraphQLId().getType();
        String id = args.getLegacyGraphQLId().getId();
        RoutingService routingService = environment.<LegacyGraphQLRequestContext>getContext().getRoutingService();
        BikeRentalStationService bikerentalStationService = routingService.getBikerentalStationService();
        switch(type) {
            case "Agency":
                return routingService.getAgencyForId(FeedScopedId.parseId(id));
            case "Alert":
                // TODO
                return null;
            case "BikePark":
                return bikerentalStationService == null ? null : bikerentalStationService.getBikeParks().stream().filter(bikePark -> bikePark.id.equals(id)).findAny().orElse(null);
            case "BikeRentalStation":
                return bikerentalStationService == null ? null : bikerentalStationService.getBikeRentalStations().stream().filter(bikeRentalStation -> bikeRentalStation.id.equals(id)).findAny().orElse(null);
            case "CarPark":
                // TODO
                return null;
            case "Cluster":
                // TODO
                return null;
            case "DepartureRow":
                return PatternAtStop.fromId(routingService, id);
            case "Pattern":
                return routingService.getTripPatternForId(FeedScopedId.parseId(id));
            case "placeAtDistance":
                {
                    String[] parts = id.split(";");
                    Relay.ResolvedGlobalId internalId = new Relay().fromGlobalId(parts[1]);
                    Object place = node().get(DataFetchingEnvironmentImpl.newDataFetchingEnvironment(environment).source(new Object()).arguments(Map.of("id", internalId)).build());
                    return new PlaceAtDistance(place, Double.parseDouble(parts[0]));
                }
            case "Route":
                return routingService.getRouteForId(FeedScopedId.parseId(id));
            case "Stop":
                return routingService.getStopForId(FeedScopedId.parseId(id));
            case "Stoptime":
                // TODO
                return null;
            case "stopAtDistance":
                {
                    String[] parts = id.split(";");
                    Stop stop = routingService.getStopForId(FeedScopedId.parseId(parts[1]));
                    // TODO: Add geometry
                    return new StopAtDistance(stop, Integer.parseInt(parts[0]), null, null, null);
                }
            case "TicketType":
                // TODO
                return null;
            case "Trip":
                return routingService.getTripForId().get(FeedScopedId.parseId(id));
            default:
                return null;
        }
    };
}
Also used : DataFetchingEnvironment(graphql.schema.DataFetchingEnvironment) Arrays(java.util.Arrays) RoutingService(org.opentripplanner.routing.RoutingService) Trip(org.opentripplanner.model.Trip) Date(java.util.Date) TransitStopVertex(org.opentripplanner.routing.vertextype.TransitStopVertex) Coordinate(org.locationtech.jts.geom.Coordinate) ServiceDate(org.opentripplanner.model.calendar.ServiceDate) LegacyGraphQLRequestContext(org.opentripplanner.ext.legacygraphqlapi.LegacyGraphQLRequestContext) PlaceType(org.opentripplanner.routing.graphfinder.PlaceType) PatternAtStop(org.opentripplanner.routing.graphfinder.PatternAtStop) TripTimeShort(org.opentripplanner.model.TripTimeShort) Duration(java.time.Duration) Map(java.util.Map) BicycleOptimizeType(org.opentripplanner.routing.core.BicycleOptimizeType) TransitMode(org.opentripplanner.model.TransitMode) FeedScopedId(org.opentripplanner.model.FeedScopedId) Station(org.opentripplanner.model.Station) BikePark(org.opentripplanner.routing.bike_park.BikePark) GenericLocation(org.opentripplanner.model.GenericLocation) TripPattern(org.opentripplanner.model.TripPattern) Stop(org.opentripplanner.model.Stop) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) TransitAlert(org.opentripplanner.routing.alertpatch.TransitAlert) List(java.util.List) Stream(java.util.stream.Stream) BikeRentalStation(org.opentripplanner.routing.bike_rental.BikeRentalStation) ResourceBundleSingleton(org.opentripplanner.util.ResourceBundleSingleton) Relay(graphql.relay.Relay) PlaceAtDistance(org.opentripplanner.routing.graphfinder.PlaceAtDistance) StopAtDistance(org.opentripplanner.routing.graphfinder.StopAtDistance) LegacyGraphQLTypes(org.opentripplanner.ext.legacygraphqlapi.generated.LegacyGraphQLTypes) RoutingValidationException(org.opentripplanner.routing.error.RoutingValidationException) ArrayList(java.util.ArrayList) Lists(com.google.common.collect.Lists) Connection(graphql.relay.Connection) QualifiedModeSet(org.opentripplanner.api.parameter.QualifiedModeSet) QualifiedMode(org.opentripplanner.api.parameter.QualifiedMode) DataFetcher(graphql.schema.DataFetcher) ParameterException(org.opentripplanner.api.common.ParameterException) StreamSupport(java.util.stream.StreamSupport) GtfsRealtimeFuzzyTripMatcher(org.opentripplanner.updater.GtfsRealtimeFuzzyTripMatcher) SimpleListConnection(graphql.relay.SimpleListConnection) RoutingResponse(org.opentripplanner.routing.api.response.RoutingResponse) Agency(org.opentripplanner.model.Agency) DataFetchingEnvironmentImpl(graphql.schema.DataFetchingEnvironmentImpl) Consumer(java.util.function.Consumer) Route(org.opentripplanner.model.Route) BikeRentalStationService(org.opentripplanner.routing.bike_rental.BikeRentalStationService) LegacyGraphQLDataFetchers(org.opentripplanner.ext.legacygraphqlapi.generated.LegacyGraphQLDataFetchers) RoutingRequest(org.opentripplanner.routing.api.request.RoutingRequest) Envelope(org.locationtech.jts.geom.Envelope) Collections(java.util.Collections) FeedInfo(org.opentripplanner.model.FeedInfo) FareRuleSet(org.opentripplanner.routing.core.FareRuleSet) LegacyGraphQLRequestContext(org.opentripplanner.ext.legacygraphqlapi.LegacyGraphQLRequestContext) Relay(graphql.relay.Relay) PatternAtStop(org.opentripplanner.routing.graphfinder.PatternAtStop) Stop(org.opentripplanner.model.Stop) PlaceAtDistance(org.opentripplanner.routing.graphfinder.PlaceAtDistance) RoutingService(org.opentripplanner.routing.RoutingService) BikeRentalStationService(org.opentripplanner.routing.bike_rental.BikeRentalStationService) LegacyGraphQLTypes(org.opentripplanner.ext.legacygraphqlapi.generated.LegacyGraphQLTypes) StopAtDistance(org.opentripplanner.routing.graphfinder.StopAtDistance)

Example 3 with Agency

use of org.opentripplanner.model.Agency in project OpenTripPlanner by opentripplanner.

the class LegacyGraphQLNodeTypeResolver method getType.

@Override
public GraphQLObjectType getType(TypeResolutionEnvironment environment) {
    Object o = environment.getObject();
    GraphQLSchema schema = environment.getSchema();
    if (o instanceof Agency)
        return schema.getObjectType("Agency");
    if (o instanceof TransitAlert)
        return schema.getObjectType("Alert");
    if (o instanceof BikePark)
        return schema.getObjectType("BikePark");
    if (o instanceof BikeRentalStation)
        return schema.getObjectType("BikeRentalStation");
    // if (o instanceof Cluster) return schema.getObjectType("Cluster");
    if (o instanceof PatternAtStop)
        return schema.getObjectType("DepartureRow");
    if (o instanceof TripPattern)
        return schema.getObjectType("Pattern");
    if (o instanceof PlaceAtDistance)
        return schema.getObjectType("placeAtDistance");
    if (o instanceof Route)
        return schema.getObjectType("Route");
    if (o instanceof Stop)
        return schema.getObjectType("Stop");
    if (o instanceof Station)
        return schema.getObjectType("Stop");
    if (o instanceof TripTimeShort)
        return schema.getObjectType("Stoptime");
    if (o instanceof StopAtDistance)
        return schema.getObjectType("stopAtDistance");
    if (o instanceof FareRuleSet)
        return schema.getObjectType("TicketType");
    if (o instanceof Trip)
        return schema.getObjectType("Trip");
    return null;
}
Also used : TransitAlert(org.opentripplanner.routing.alertpatch.TransitAlert) Trip(org.opentripplanner.model.Trip) Agency(org.opentripplanner.model.Agency) Stop(org.opentripplanner.model.Stop) PatternAtStop(org.opentripplanner.routing.graphfinder.PatternAtStop) PlaceAtDistance(org.opentripplanner.routing.graphfinder.PlaceAtDistance) FareRuleSet(org.opentripplanner.routing.core.FareRuleSet) BikePark(org.opentripplanner.routing.bike_park.BikePark) GraphQLSchema(graphql.schema.GraphQLSchema) BikeRentalStation(org.opentripplanner.routing.bike_rental.BikeRentalStation) TripPattern(org.opentripplanner.model.TripPattern) Station(org.opentripplanner.model.Station) BikeRentalStation(org.opentripplanner.routing.bike_rental.BikeRentalStation) TripTimeShort(org.opentripplanner.model.TripTimeShort) PatternAtStop(org.opentripplanner.routing.graphfinder.PatternAtStop) StopAtDistance(org.opentripplanner.routing.graphfinder.StopAtDistance) Route(org.opentripplanner.model.Route)

Example 4 with Agency

use of org.opentripplanner.model.Agency in project OpenTripPlanner by opentripplanner.

the class IndexAPI method getAgencyRoutes.

/**
 * Return all routes for the specific agency.
 */
@GET
@Path("/agencies/{feedId}/{agencyId}/routes")
public Response getAgencyRoutes(@PathParam("feedId") String feedId, @PathParam("agencyId") String agencyId) {
    RoutingService routingService = createRoutingService();
    Agency agency = getAgency(routingService, feedId, agencyId);
    Collection<Route> routes = routingService.getAllRoutes().stream().filter(r -> r.getAgency() == agency).collect(Collectors.toList());
    if (detail) {
        return Response.status(Status.OK).entity(RouteMapper.mapToApi(routes)).build();
    } else {
        return Response.status(Status.OK).entity(RouteMapper.mapToApiShort(routes)).build();
    }
}
Also used : RoutingService(org.opentripplanner.routing.RoutingService) Trip(org.opentripplanner.model.Trip) Produces(javax.ws.rs.Produces) StopTimesInPattern(org.opentripplanner.model.StopTimesInPattern) Path(javax.ws.rs.Path) ApiTripShort(org.opentripplanner.api.model.ApiTripShort) StopMapper(org.opentripplanner.api.mapping.StopMapper) StopTimesInPatternMapper(org.opentripplanner.api.mapping.StopTimesInPatternMapper) ServiceDate(org.opentripplanner.model.calendar.ServiceDate) AgencyMapper(org.opentripplanner.api.mapping.AgencyMapper) MediaType(javax.ws.rs.core.MediaType) QueryParam(javax.ws.rs.QueryParam) TripTimeShort(org.opentripplanner.model.TripTimeShort) TripMapper(org.opentripplanner.api.mapping.TripMapper) DefaultValue(javax.ws.rs.DefaultValue) RouteMapper(org.opentripplanner.api.mapping.RouteMapper) BadRequestException(javax.ws.rs.BadRequestException) ApiStop(org.opentripplanner.api.model.ApiStop) ParseException(java.text.ParseException) FeedScopedId(org.opentripplanner.model.FeedScopedId) ApiRouteShort(org.opentripplanner.api.model.ApiRouteShort) Context(javax.ws.rs.core.Context) TripPatternMapper(org.opentripplanner.api.mapping.TripPatternMapper) TripPattern(org.opentripplanner.model.TripPattern) ApiTrip(org.opentripplanner.api.model.ApiTrip) Stop(org.opentripplanner.model.Stop) Collection(java.util.Collection) Set(java.util.Set) ApiStopShort(org.opentripplanner.api.model.ApiStopShort) Collectors(java.util.stream.Collectors) ApiFeedInfo(org.opentripplanner.api.model.ApiFeedInfo) ApiStopTimesInPattern(org.opentripplanner.api.model.ApiStopTimesInPattern) NotFoundException(javax.ws.rs.NotFoundException) ApiRoute(org.opentripplanner.api.model.ApiRoute) List(java.util.List) PolylineEncoder(org.opentripplanner.util.PolylineEncoder) EncodedPolylineBean(org.opentripplanner.util.model.EncodedPolylineBean) Response(javax.ws.rs.core.Response) WgsCoordinate(org.opentripplanner.model.WgsCoordinate) UriInfo(javax.ws.rs.core.UriInfo) FeedInfoMapper(org.opentripplanner.api.mapping.FeedInfoMapper) OTPServer(org.opentripplanner.standalone.server.OTPServer) TransferMapper(org.opentripplanner.api.mapping.TransferMapper) PathParam(javax.ws.rs.PathParam) GET(javax.ws.rs.GET) ApiAlert(org.opentripplanner.api.model.ApiAlert) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ApiTransfer(org.opentripplanner.api.model.ApiTransfer) AlertMapper(org.opentripplanner.api.mapping.AlertMapper) Status(javax.ws.rs.core.Response.Status) ApiAgency(org.opentripplanner.api.model.ApiAgency) Timetable(org.opentripplanner.model.Timetable) Agency(org.opentripplanner.model.Agency) ApiPatternShort(org.opentripplanner.api.model.ApiPatternShort) LineString(org.locationtech.jts.geom.LineString) Route(org.opentripplanner.model.Route) FeedScopedIdMapper(org.opentripplanner.api.mapping.FeedScopedIdMapper) ApiAgency(org.opentripplanner.api.model.ApiAgency) Agency(org.opentripplanner.model.Agency) RoutingService(org.opentripplanner.routing.RoutingService) ApiRoute(org.opentripplanner.api.model.ApiRoute) Route(org.opentripplanner.model.Route) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 5 with Agency

use of org.opentripplanner.model.Agency in project OpenTripPlanner by opentripplanner.

the class AgencyMapper method doMap.

private Agency doMap(org.onebusaway.gtfs.model.Agency rhs) {
    Agency lhs = new Agency(new FeedScopedId(feedId, rhs.getId()), rhs.getName(), rhs.getTimezone());
    lhs.setUrl(rhs.getUrl());
    lhs.setLang(rhs.getLang());
    lhs.setPhone(rhs.getPhone());
    lhs.setFareUrl(rhs.getFareUrl());
    lhs.setBrandingUrl(rhs.getBrandingUrl());
    return lhs;
}
Also used : Agency(org.opentripplanner.model.Agency) FeedScopedId(org.opentripplanner.model.FeedScopedId)

Aggregations

Agency (org.opentripplanner.model.Agency)24 FeedScopedId (org.opentripplanner.model.FeedScopedId)8 Route (org.opentripplanner.model.Route)7 Stop (org.opentripplanner.model.Stop)5 Trip (org.opentripplanner.model.Trip)5 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 TripPattern (org.opentripplanner.model.TripPattern)4 ServiceDate (org.opentripplanner.model.calendar.ServiceDate)4 List (java.util.List)3 TimeZone (java.util.TimeZone)3 TripTimeShort (org.opentripplanner.model.TripTimeShort)3 Authority (org.rutebanken.netex.model.Authority)3 Collection (java.util.Collection)2 Collections (java.util.Collections)2 Date (java.util.Date)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2