TripEntry trip = _graph.getTripEntryForId(tripId);
if (trip == null)
return;
BlockEntry block = trip.getBlock();
TripProblemReportRecord record = new TripProblemReportRecord();
record.setCode(problem.getCode());
record.setServiceDate(problem.getServiceDate());
String vehicleId = problem.getVehicleId();
if (vehicleId != null)
record.setVehicleId(AgencyAndIdLibrary.convertFromString(vehicleId));
String stopId = problem.getStopId();
if (stopId != null)
record.setStopId(AgencyAndIdLibrary.convertFromString(stopId));
record.setTime(problem.getTime());
record.setTripId(tripId);
record.setBlockId(block.getId());
record.setUserComment(problem.getUserComment());
if (problem.getUserLat() != null && !Double.isNaN(problem.getUserLat()))
record.setUserLat(problem.getUserLat());
if (problem.getUserLon() != null && !Double.isNaN(problem.getUserLon()))
record.setUserLon(problem.getUserLon());
if (problem.getUserLocationAccuracy() != null
&& !Double.isNaN(problem.getUserLocationAccuracy()))
record.setUserLocationAccuracy(problem.getUserLocationAccuracy());
record.setUserOnVehicle(problem.isUserOnVehicle());
record.setUserVehicleNumber(problem.getUserVehicleNumber());
Map<BlockInstance, List<BlockLocation>> locationsByInstance = _blockStatusService.getBlocks(
block.getId(), problem.getServiceDate(), record.getVehicleId(),
problem.getTime());
BlockInstance blockInstance = getBestBlockInstance(locationsByInstance.keySet());
if (blockInstance != null) {