Package org.onebusaway.siri.model

Examples of org.onebusaway.siri.model.VehicleActivity


        }
        if (trip.getStatus().isPredicted() == false) {
          /* only show trips with realtime info */
          continue;
        }
        VehicleActivity activity = createActivity(trip, onwardCalls);
        if (activity != null) {
          activities.add(activity);
        }
      }
      _response = generateSiriResponse(_time, activities);
      return new DefaultHttpHeaders();
    }

    String routeId = _request.getParameter("LineRef");
    // multiple trips by route
    if (routeId != null) {
      TripsForRouteQueryBean query = new TripsForRouteQueryBean();
      query.setRouteId(agencyId + "_" + routeId);
      query.setTime(_time.getTime());
      ListBean<TripDetailsBean> trips = _transitDataService.getTripsForRoute(query);
      ArrayList<VehicleActivity> activities = new ArrayList<VehicleActivity>();
      for (TripDetailsBean trip : trips.getList()) {
        if (directionId != null
            && !trip.getTrip().getDirectionId().equals(directionId)) {
          continue;
        }
        if (trip.getStatus().isPredicted() == false) {
          /* only show trips with realtime info */
          continue;
        }
        VehicleActivity activity = createActivity(trip, onwardCalls);
        if (activity != null) {
          activities.add(activity);
        }
      }
      _response = generateSiriResponse(_time, activities);
      return new DefaultHttpHeaders();
    }

    /* All vehicles */
    ListBean<VehicleStatusBean> vehicles = _transitDataService.getAllVehiclesForAgency(
        agencyId, _time.getTime());
    ArrayList<VehicleActivity> activities = new ArrayList<VehicleActivity>();
    for (VehicleStatusBean v : vehicles.getList()) {
      VehicleActivity activity = createActivity(v, onwardCalls);
      if (activity != null) {
        activities.add(activity);
      }
    }
    _response = generateSiriResponse(_time, activities);
View Full Code Here


    if (vehicleStatus.getPhase().equals("DEADHEAD_AFTER")
        || vehicleStatus.getPhase().equals("DEADHEAD_BEFORE")
        || vehicleStatus.getPhase().equals("DEADHEAD_DURING")) {
      return null;
    }
    VehicleActivity activity = new VehicleActivity();

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

    activity.RecordedAtTime = time;
View Full Code Here

  /**
   * Create a VehicleActivity for a given vehicle's trip.
   */
  private VehicleActivity createActivity(TripDetailsBean trip,
      boolean onwardCalls) {
    VehicleActivity activity = new VehicleActivity();
    TripStatusBean status = trip.getStatus();
    if (status.getPhase().equals("DEADHEAD_AFTER")
        || status.getPhase().equals("DEADHEAD_BEFORE")
        || status.getPhase().equals("DEADHEAD_DURING")) {
      return null;
View Full Code Here

TOP

Related Classes of org.onebusaway.siri.model.VehicleActivity

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.