return leg;
}
public TransitLegV2Bean getTransitLeg(TransitLegBean leg) {
TransitLegV2Bean bean = new TransitLegV2Bean();
TripBean trip = leg.getTrip();
if (trip != null) {
bean.setTripId(trip.getId());
_factory.addToReferences(trip);
}
bean.setServiceDate(leg.getServiceDate());
bean.setVehicleId(leg.getVehicleId());
FrequencyBean frequency = leg.getFrequency();
if (frequency != null) {
FrequencyV2Bean freqBean = _factory.getFrequency(frequency);
bean.setFrequency(freqBean);
}
StopBean fromStop = leg.getFromStop();
if (fromStop != null) {
bean.setFromStopId(fromStop.getId());
bean.setFromStopSequence(leg.getFromStopSequence());
_factory.addToReferences(fromStop);
}
bean.setScheduledDepartureTime(leg.getScheduledDepartureTime());
bean.setPredictedDepartureTime(leg.getPredictedDepartureTime());
bean.setScheduledDepartureInterval(_factory.getTimeInterval(leg.getScheduledDepartureInterval()));
bean.setPredictedDepartureInterval(_factory.getTimeInterval(leg.getPredictedDepartureInterval()));
StopBean toStop = leg.getToStop();
if (toStop != null) {
bean.setToStopId(toStop.getId());
bean.setToStopSequence(leg.getToStopSequence());
_factory.addToReferences(toStop);
}
bean.setScheduledArrivalTime(leg.getScheduledArrivalTime());
bean.setPredictedArrivalTime(leg.getPredictedArrivalTime());
bean.setScheduledArrivalInterval(_factory.getTimeInterval(leg.getScheduledArrivalInterval()));
bean.setPredictedArrivalInterval(_factory.getTimeInterval(leg.getPredictedArrivalInterval()));
bean.setRouteShortName(leg.getRouteShortName());
bean.setRouteLongName(leg.getRouteLongName());
bean.setTripHeadsign(leg.getTripHeadsign());
bean.setPath(leg.getPath());
List<ServiceAlertBean> situations = leg.getSituations();
if (!CollectionsLibrary.isEmpty(situations)) {
List<String> situationIds = new ArrayList<String>(situations.size());
for (ServiceAlertBean situation : situations) {
situationIds.add(situation.getId());
_factory.addToReferences(situation);
}
bean.setSituationIds(situationIds);
}
return bean;
}