Package org.onebusaway.api.model.transit

Examples of org.onebusaway.api.model.transit.BeanFactoryV2


  private DefaultHttpHeaders transformResult(StopsBean result) {
    if (isVersion(V1)) {
      return setOkResponse(result);
    } else if (isVersion(V2)) {
      BeanFactoryV2 factory = getBeanFactoryV2();
      return setOkResponse(factory.getResponse(result));
    } else {
      return setUnknownVersionResponse();
    }
  }
View Full Code Here


  private DefaultHttpHeaders transformOutOfRangeResult() {
    if (isVersion(V1)) {
      return setOkResponse(new StopsBean());
    } else if (isVersion(V2)) {
      BeanFactoryV2 factory = getBeanFactoryV2();
      return setOkResponse(factory.getEmptyList(StopV2Bean.class, true));
    } else {
      return setUnknownVersionResponse();
    }
  }
View Full Code Here

      return setResourceNotFoundResponse();

    if (isVersion(V1)) {
      return setOkResponse(route);
    } else if (isVersion(V2)) {
      BeanFactoryV2 factory = getBeanFactoryV2();
      return setOkResponse(factory.getResponse(route));
    } else {
      return setUnknownVersionResponse();
    }
  }
View Full Code Here

    TripDetailsInclusionBean inclusion = query.getInclusion();
    inclusion.setIncludeTripBean(_includeTrip);
    inclusion.setIncludeTripStatus(_includeStatus);
    inclusion.setIncludeTripSchedule(_includeSchedule);

    BeanFactoryV2 factory = getBeanFactoryV2();

    try {
      ListBean<TripDetailsBean> trips = _service.getTripsForAgency(query);
      return setOkResponse(factory.getTripDetailsResponse(trips));
    } catch (OutOfServiceAreaServiceException ex) {
      return setOkResponse(factory.getEmptyList(TripDetailsV2Bean.class, true));
    }
  }
View Full Code Here

    if( ! isVersion(V2))
      return setUnknownVersionResponse();
   
    ListBean<String> stopIds = _service.getStopIdsForAgencyId(_id);
    BeanFactoryV2 factory = getBeanFactoryV2();
    return setOkResponse(factory.getEntityIdsResponse(stopIds));
  }
View Full Code Here

      List<ArrivalAndDepartureBeanV1> arrivals = getArrivalsAsV1(result);
      StopWithArrivalsAndDeparturesBeanV1 v1 = new StopWithArrivalsAndDeparturesBeanV1(
          result.getStop(), arrivals, result.getNearbyStops());
      return setOkResponse(v1);
    } else if (isVersion(V2)) {
      BeanFactoryV2 factory = getBeanFactoryV2();
      return setOkResponse(factory.getResponse(result));
    } else {
      return setUnknownVersionResponse();
    }
  }
View Full Code Here

      return setValidationErrorsResponse();

    if (!isVersion(V2))
      return setUnknownVersionResponse();

    BeanFactoryV2 factory = getBeanFactoryV2();
    List<RouteV2Bean> beans = new ArrayList<RouteV2Bean>();

    List<AgencyWithCoverageBean> agenciesWithCoverage = _service.getAgenciesWithCoverage();
    for (AgencyWithCoverageBean agencyWithCoverage : agenciesWithCoverage)
    {
      String agencyId = agencyWithCoverage.getAgency().getId();
      ListBean<RouteBean> routes = _service.getRoutesForAgencyId(agencyId);

      for (RouteBean route : routes.getList())
        beans.add(factory.getRoute(route));
    }


    return setOkResponse(factory.list(beans, false));
  }
View Full Code Here

    CoordinatePoint location = new CoordinatePoint(_lat, _lon);

    MinTravelTimeToStopsBean result = _transitDataService.getMinTravelTimeToStopsFrom(
        location, _time, _constraints);

    BeanFactoryV2 factory = getBeanFactoryV2();

    try {
      ListWithReferencesBean<MinTravelTimeToStopV2Bean> response = factory.getMinTravelTimeToStops(result);
      return setOkResponse(response);
    } catch (OutOfServiceAreaServiceException ex) {
      return setOkResponse(factory.getEmptyList(TripDetailsV2Bean.class, true));
    }
  }
View Full Code Here

  public DefaultHttpHeaders index() throws IOException, ServiceException {

    ListBean<VertexBean> vertices = _transitDataService.getStreetGraphForRegion(
        _latFrom, _lonFrom, _latTo, _lonTo);

    BeanFactoryV2 factory = getBeanFactoryV2();
    ItineraryV2BeanFactory itineraryFactory = new ItineraryV2BeanFactory(
        factory);

    GraphResultV2Bean bean = itineraryFactory.getGraphResult(vertices.getList());
    return setOkResponse(factory.entry(bean));
  }
View Full Code Here

    TripDetailsInclusionBean inclusion = query.getInclusion();
    inclusion.setIncludeTripBean(_includeTrip);
    inclusion.setIncludeTripSchedule(_includeSchedule);
    inclusion.setIncludeTripStatus(_includeStatus);

    BeanFactoryV2 factory = getBeanFactoryV2();

    try {
      ListBean<TripDetailsBean> trips = _service.getTripsForRoute(query);
      return setOkResponse(factory.getTripDetailsResponse(trips));
    } catch (OutOfServiceAreaServiceException ex) {
      return setOkResponse(factory.getEmptyList(TripDetailsV2Bean.class, true));
    }
  }
View Full Code Here

TOP

Related Classes of org.onebusaway.api.model.transit.BeanFactoryV2

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.