Package org.onebusaway.transit_data.model.problems

Examples of org.onebusaway.transit_data.model.problems.TripProblemReportBean


  private TripProblemReportBean getRecordAsBean(TripProblemReportRecord record) {

    AgencyAndId stopId = record.getStopId();
    AgencyAndId tripId = record.getTripId();

    TripProblemReportBean bean = new TripProblemReportBean();

    bean.setCode(record.getCode());
    bean.setId(record.getId());
    bean.setServiceDate(record.getServiceDate());
    bean.setStatus(record.getStatus());
    bean.setLabel(record.getLabel());
    bean.setStopId(AgencyAndIdLibrary.convertToString(stopId));
    bean.setTime(record.getTime());
    bean.setTripId(AgencyAndIdLibrary.convertToString(tripId));
    bean.setUserComment(record.getUserComment());

    bean.setUserLat(record.getUserLat());
    bean.setUserLon(record.getUserLon());
    bean.setUserLocationAccuracy(record.getUserLocationAccuracy());

    bean.setUserOnVehicle(record.isUserOnVehicle());
    bean.setUserVehicleNumber(record.getUserVehicleNumber());

    bean.setPredicted(record.isPredicted());

    bean.setVehicleId(AgencyAndIdLibrary.convertToString(record.getVehicleId()));
    bean.setDistanceAlongBlock(record.getDistanceAlongBlock());
    bean.setScheduleDeviation(record.getScheduleDeviation());
    bean.setVehicleLat(record.getVehicleLat());
    bean.setVehicleLon(record.getVehicleLon());

    if (stopId != null) {
      try {
        bean.setStop(_stopBeanService.getStopForId(stopId));
      } catch (NoSuchStopServiceException ex) {

      }
    }

    if (tripId != null) {
      bean.setTrip(_tripBeanService.getTripForId(tripId));
    }

    if (tripId != null && stopId != null) {
      TripEntry trip = _graph.getTripEntryForId(tripId);
      StopEntry stop = _graph.getStopEntryForId(stopId);
      if (trip != null && stop != null) {

        AgencyAndId vehicleId = record.getMatchedVehicleId();
        if (vehicleId == null)
          vehicleId = record.getVehicleId();

        ArrivalAndDepartureQuery query = new ArrivalAndDepartureQuery();
        query.setStop(stop);
        query.setStopSequence(-1);
        query.setTrip(trip);
        query.setServiceDate(record.getServiceDate());
        query.setVehicleId(vehicleId);
        query.setTime(record.getTime());

        ArrivalAndDepartureInstance instance = _arrivalAndDepartureService.getArrivalAndDepartureForStop(query);

        if (instance != null) {
          StopTimeInstance sti = instance.getStopTimeInstance();
          StopTimeInstanceBean stopTimeBean = _stopTimeBeanService.getStopTimeInstanceAsBean(sti);
          bean.setStopTime(stopTimeBean);
        }
      }
    }

    return bean;
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data.model.problems.TripProblemReportBean

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.