use of org.onebusaway.transit_data_federation.services.realtime.VehicleLocationCacheElements in project onebusaway-application-modules by camsys.
the class VehicleStatusServiceImpl method getVehicleStatusForId.
/**
**
* {@link VehicleStatusService} Interface
***
*/
@Override
public VehicleStatus getVehicleStatusForId(AgencyAndId vehicleId) {
VehicleLocationRecord record = _vehicleRecordsById.get(vehicleId);
if (record == null)
return null;
List<VehicleLocationRecord> records = new ArrayList<VehicleLocationRecord>();
VehicleLocationCacheElements elements = _vehicleLocationRecordCache.getRecordForVehicleId(vehicleId);
if (elements != null) {
for (VehicleLocationCacheElement element : elements.getElements()) records.add(element.getRecord());
}
VehicleStatus status = new VehicleStatus();
status.setRecord(record);
status.setAllRecords(records);
return status;
}
Aggregations