use of org.onebusaway.transit_data.model.blocks.BlockTripBean in project onebusaway-application-modules by camsys.
the class BlockStatusBeanServiceImpl method bean.
private BlockStatusBean bean(BlockLocation blockLocation) {
if (blockLocation == null)
return null;
BlockInstance instance = blockLocation.getBlockInstance();
BlockConfigurationEntry block = instance.getBlock();
long serviceDate = instance.getServiceDate();
BlockStatusBean bean = new BlockStatusBean();
bean.setBlock(_blockBeanService.getBlockForId(block.getBlock().getId()));
bean.setStatus("default");
bean.setServiceDate(serviceDate);
bean.setTotalDistanceAlongBlock(block.getTotalBlockDistance());
bean.setInService(blockLocation.isInService());
CoordinatePoint location = blockLocation.getLocation();
bean.setLocation(location);
bean.setScheduledDistanceAlongBlock(blockLocation.getScheduledDistanceAlongBlock());
bean.setDistanceAlongBlock(blockLocation.getDistanceAlongBlock());
BlockTripEntry activeTrip = blockLocation.getActiveTrip();
if (activeTrip != null) {
BlockTripBean activeTripBean = _blockBeanService.getBlockTripAsBean(activeTrip);
bean.setActiveTrip(activeTripBean);
}
BlockStopTimeEntry stop = blockLocation.getClosestStop();
if (stop != null) {
StopBean stopBean = _stopBeanService.getStopForId(stop.getStopTime().getStop().getId());
bean.setClosestStop(stopBean);
bean.setClosestStopTimeOffset(blockLocation.getClosestStopTimeOffset());
}
bean.setPredicted(blockLocation.isPredicted());
bean.setLastUpdateTime(blockLocation.getLastUpdateTime());
bean.setScheduleDeviation(blockLocation.getScheduleDeviation());
AgencyAndId vid = blockLocation.getVehicleId();
if (vid != null)
bean.setVehicleId(ApplicationBeanLibrary.getId(vid));
return bean;
}
Aggregations