Package org.onebusaway.transit_data.model.trips

Examples of org.onebusaway.transit_data.model.trips.TripBean


    bean.setLocation(vehicleStatus.getLocation());
    bean.setPhase(vehicleStatus.getPhase());
    bean.setStatus(vehicleStatus.getStatus());
    bean.setVehicleId(vehicleStatus.getVehicleId());

    TripBean trip = vehicleStatus.getTrip();
    if (trip != null) {
      bean.setTripId(trip.getId());
      addToReferences(trip);
    }

    TripStatusBean tripStatus = vehicleStatus.getTripStatus();
    if (tripStatus != null)
View Full Code Here


  }

  public ArrivalAndDepartureV2Bean getArrivalAndDeparture(
      ArrivalAndDepartureBean ad) {

    TripBean trip = ad.getTrip();
    RouteBean route = trip.getRoute();
    StopBean stop = ad.getStop();

    ArrivalAndDepartureV2Bean bean = new ArrivalAndDepartureV2Bean();

    bean.setTripId(trip.getId());
    addToReferences(trip);

    bean.setServiceDate(ad.getServiceDate());
    bean.setVehicleId(ad.getVehicleId());
    bean.setStopId(stop.getId());
    addToReferences(stop);
    bean.setStopSequence(ad.getStopSequence());
    bean.setBlockTripSequence(ad.getBlockTripSequence());

    bean.setRouteId(route.getId());
    addToReferences(route);

    String routeShortName = ad.getRouteShortName();
    if (routeShortName == null || routeShortName.isEmpty())
      routeShortName = trip.getRouteShortName();
    if (routeShortName == null || routeShortName.isEmpty())
      routeShortName = route.getShortName();
    bean.setRouteShortName(routeShortName);

    bean.setRouteLongName(route.getLongName());

    String tripHeadsign = ad.getTripHeadsign();
    if (tripHeadsign == null || tripHeadsign.isEmpty())
      tripHeadsign = trip.getTripHeadsign();
    bean.setTripHeadsign(tripHeadsign);

    bean.setArrivalEnabled(ad.isArrivalEnabled());
    bean.setDepartureEnabled(ad.isDepartureEnabled());
View Full Code Here

    return visitNumber;
  }

  public static MonitoredVehicleJourney getMonitoredVehicleJourney(
      TripDetailsBean trip, Date serviceDate, String vehicleId) {
    TripBean tripBean = trip.getTrip();

    MonitoredVehicleJourney monitoredVehicleJourney = new MonitoredVehicleJourney();

    monitoredVehicleJourney.CourseOfJourneyRef = getIdWithoutAgency(trip.getTripId());
    RouteBean route = tripBean.getRoute();
    monitoredVehicleJourney.LineRef = getIdWithoutAgency(route.getId());
    monitoredVehicleJourney.DirectionRef = tripBean.getDirectionId();
    monitoredVehicleJourney.PublishedLineName = tripBean.getTripHeadsign();

    monitoredVehicleJourney.FramedVehicleJourneyRef = new FramedVehicleJourneyRef();
    monitoredVehicleJourney.VehicleRef = vehicleId;

    monitoredVehicleJourney.FramedVehicleJourneyRef.DataFrameRef = String.format(
View Full Code Here

      entity.setId(Integer.toString(feed.getEntityCount()));
      VehiclePosition.Builder vehiclePosition = entity.getVehicleBuilder();

      TripStatusBean tripStatus = vehicle.getTripStatus();
      if (tripStatus != null) {
        TripBean activeTrip = tripStatus.getActiveTrip();
        RouteBean route = activeTrip.getRoute();

        TripDescriptor.Builder tripDesc = vehiclePosition.getTripBuilder();
        tripDesc.setTripId(normalizeId(activeTrip.getId()));
        tripDesc.setRouteId(normalizeId(route.getId()));
      }

      VehicleDescriptor.Builder vehicleDesc = vehiclePosition.getVehicleBuilder();
      vehicleDesc.setId(normalizeId(vehicle.getVehicleId()));
View Full Code Here

    String directionId = _request.getParameter("DirectionRef");

    // by trip (may be more than one trip)
    String tripId = _request.getParameter("VehicleJourneyRef");
    if (tripId != null) {
      TripBean tripBean = _transitDataService.getTrip(agencyId + "_" + tripId);
      if (tripBean == null) {
        throw new IllegalArgumentException("No such trip: " + tripId);
      }
      TripDetailsQueryBean query = new TripDetailsQueryBean();
      query.setTripId(tripId);
View Full Code Here

    Calendar time = Calendar.getInstance();
    time.setTime(new Date(vehicleStatus.getLastUpdateTime()));

    activity.RecordedAtTime = time;
    TripBean tripBean = vehicleStatus.getTrip();
    if (tripBean != null) {
      TripDetailsQueryBean query = new TripDetailsQueryBean();
      query.setTime(time.getTimeInMillis());
      query.setTripId(tripBean.getId());
      query.setVehicleId(vehicleStatus.getVehicleId());
      query.getInclusion().setIncludeTripStatus(true);
      TripStatusBean tripStatus = vehicleStatus.getTripStatus();
      query.setServiceDate(tripStatus.getServiceDate());
      TripDetailsBean tripDetails = _transitDataService.getSingleTripDetails(query);
View Full Code Here

    for (VehicleStatusBean vehicle : vehicles.getList()) {
      TripStatusBean tripStatus = vehicle.getTripStatus();
      if (tripStatus == null) {
        continue;
      }
      TripBean activeTrip = tripStatus.getActiveTrip();
      RouteBean route = activeTrip.getRoute();

      FeedEntity.Builder entity = feed.addEntityBuilder();
      entity.setId(Integer.toString(feed.getEntityCount()));
      TripUpdate.Builder tripUpdate = entity.getTripUpdateBuilder();

      TripDescriptor.Builder tripDesc = tripUpdate.getTripBuilder();
      tripDesc.setTripId(normalizeId(activeTrip.getId()));
      tripDesc.setRouteId(normalizeId(route.getId()));

      VehicleDescriptor.Builder vehicleDesc = tripUpdate.getVehicleBuilder();
      vehicleDesc.setId(normalizeId(vehicle.getVehicleId()));
View Full Code Here

      return setUnknownVersionResponse();

    if (hasErrors())
      return setValidationErrorsResponse();

    TripBean trip = _service.getTrip(_id);

    if (trip == null)
      return setResourceNotFoundResponse();

    BeanFactoryV2 factory = getBeanFactoryV2();
View Full Code Here

  private String getRouteKeyForArrivalAndDeparture(ArrivalAndDepartureBean bean) {
    String name = bean.getRouteShortName();
    if (name != null)
      return name;
    TripBean trip = bean.getTrip();
    name = trip.getRouteShortName();
    if (name != null)
      return name;
    RouteBean route = trip.getRoute();
    name = route.getShortName();
    if (name != null)
      return name;
    return route.getId();
  }
View Full Code Here

    long now = System.currentTimeMillis();

    for (ArrivalAndDepartureBean adb : arrivals) {

      TripBean trip = adb.getTrip();
      RouteBean route = trip.getRoute();

      addMessage(Messages.ROUTE);

      String routeNumber = RoutePresenter.getNameForRoute(route);
      addText(_routeNumberPronunciation.modify(routeNumber));

      String headsign = trip.getTripHeadsign();
      if (headsign != null) {
        addMessage(Messages.TO);

        String destination = _destinationPronunciation.modify(headsign);
        addText(destination);
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data.model.trips.TripBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.