Package org.onebusaway.transit_data.model.realtime

Examples of org.onebusaway.transit_data.model.realtime.VehicleLocationRecordBean


    List<VehicleLocationRecordBean> beans = new ArrayList<VehicleLocationRecordBean>(
        records.size());

    for (BlockLocationRecord record : records) {
      VehicleLocationRecordBean bean = getBlockLocationRecordAsVehicleLocationRecord(record);
      beans.add(bean);
    }

    return new ListBean<VehicleLocationRecordBean>(beans, false);
  }
View Full Code Here


    List<VehicleLocationRecord> allRecords = status.getAllRecords();
    if (!CollectionsLibrary.isEmpty(allRecords)) {
      List<VehicleLocationRecordBean> allRecordBeans = new ArrayList<VehicleLocationRecordBean>();
      bean.setAllRecords(allRecordBeans);
      for (VehicleLocationRecord r : allRecords) {
        VehicleLocationRecordBean rBean = getVehicleLocationRecordAsBean(r);
        allRecordBeans.add(rBean);
      }
    }

    return bean;
View Full Code Here

  }

  private VehicleLocationRecordBean getVehicleLocationRecordAsBean(
      VehicleLocationRecord record) {

    VehicleLocationRecordBean bean = new VehicleLocationRecordBean();
    bean.setBlockId(AgencyAndIdLibrary.convertToString(record.getBlockId()));

    if (record.getPhase() != null)
      bean.setPhase(record.getPhase().toLabel());

    if (record.isCurrentLocationSet()) {
      CoordinatePoint location = new CoordinatePoint(
          record.getCurrentLocationLat(), record.getCurrentLocationLon());
      bean.setCurrentLocation(location);
    }
    if (record.isCurrentOrientationSet())
      bean.setCurrentOrientation(record.getCurrentOrientation());

    if (record.isDistanceAlongBlockSet())
      bean.setDistanceAlongBlock(record.getDistanceAlongBlock());

    if (record.isScheduleDeviationSet())
      bean.setScheduleDeviation(record.getScheduleDeviation());

    bean.setStatus(record.getStatus());
    bean.setServiceDate(record.getServiceDate());
    bean.setTimeOfRecord(record.getTimeOfRecord());
    bean.setTripId(AgencyAndIdLibrary.convertToString(record.getTripId()));
    bean.setVehicleId(AgencyAndIdLibrary.convertToString(record.getVehicleId()));
    return bean;
  }
View Full Code Here

  }

  private VehicleLocationRecordBean getBlockLocationRecordAsVehicleLocationRecord(
      BlockLocationRecord record) {

    VehicleLocationRecordBean bean = new VehicleLocationRecordBean();
    bean.setBlockId(AgencyAndIdLibrary.convertToString(record.getBlockId()));
    if (record.getPhase() != null)
      bean.setPhase(record.getPhase().toLabel());
    CoordinatePoint location = record.getLocation();
    if (location != null)
      bean.setCurrentLocation(location);
    if (record.getOrientation() != null)
      bean.setCurrentOrientation(record.getOrientation());
    if (record.getDistanceAlongBlock() != null)
      bean.setDistanceAlongBlock(record.getDistanceAlongBlock());
    if (record.getScheduleDeviation() != null)
      bean.setScheduleDeviation(record.getScheduleDeviation());
    bean.setStatus(record.getStatus());
    bean.setServiceDate(record.getServiceDate());
    bean.setTimeOfRecord(record.getTime());
    bean.setTripId(AgencyAndIdLibrary.convertToString(record.getTripId()));
    bean.setVehicleId(AgencyAndIdLibrary.convertToString(record.getVehicleId()));
    return bean;
  }
View Full Code Here

    return bean;
  }

  private VehicleLocationRecordBean getBlockLocationAsVehicleLocationRecord(
      BlockLocation record) {
    VehicleLocationRecordBean bean = new VehicleLocationRecordBean();
    bean.setBlockId(AgencyAndIdLibrary.convertToString(record.getBlockInstance().getBlock().getBlock().getId()));
    if (record.getPhase() != null)
      bean.setPhase(record.getPhase().toLabel());
    CoordinatePoint location = record.getLocation();
    if (location != null)
      bean.setCurrentLocation(location);

    if (record.isOrientationSet())
      bean.setCurrentOrientation(record.getOrientation());
    if (record.isDistanceAlongBlockSet())
      bean.setDistanceAlongBlock(record.getDistanceAlongBlock());
    if (record.isScheduleDeviationSet())
      bean.setScheduleDeviation(record.getScheduleDeviation());
    bean.setStatus(record.getStatus());
    bean.setServiceDate(record.getBlockInstance().getServiceDate());
    bean.setTimeOfRecord(record.getLastUpdateTime());
    bean.setTimeOfLocationUpdate(record.getLastLocationUpdateTime());
    bean.setTripId(AgencyAndIdLibrary.convertToString(record.getActiveTrip().getTrip().getId()));
    bean.setVehicleId(AgencyAndIdLibrary.convertToString(record.getVehicleId()));
    return bean;
  }
View Full Code Here

    if (hasErrors())
      return setValidationErrorsResponse();

    BeanFactoryV2 factory = getBeanFactoryV2();

    VehicleLocationRecordBean record = _service.getVehicleLocationRecordForVehicleId(
        _id, _time);
    if (record == null)
      return setResourceNotFoundResponse();
    return setOkResponse(factory.entry(factory.getVehicleLocationRecord(record)));
  }
View Full Code Here

  }

  @SkipValidation
  @Override
  public String execute() {
    VehicleLocationRecordBean lastRecord = (VehicleLocationRecordBean) _session.get(KEY_LAST_RECORD);
    if (lastRecord != null) {
      _model.copyFrom(lastRecord);
    }
    switch(_m) {
      case 1:
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data.model.realtime.VehicleLocationRecordBean

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.