use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class OtpTransitServiceBuilder method removeTripsWithNoneExistingServiceIds.
/**
* Remove all trips witch reference none existing service ids
*/
private void removeTripsWithNoneExistingServiceIds() {
Set<FeedScopedId> serviceIds = findAllServiceIds();
int orgSize = tripsById.size();
tripsById.removeIf(t -> !serviceIds.contains(t.getServiceId()));
logRemove("Trip", orgSize, tripsById.size(), "Trip service id does not exist.");
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class IndexAPI method getAlertsForStop.
/**
* Return all alerts for a stop
*/
@GET
@Path("/stops/{stopId}/alerts")
public Collection<ApiAlert> getAlertsForStop(@PathParam("stopId") String stopId) {
RoutingService routingService = createRoutingService();
// TODO: Add locale
AlertMapper alertMapper = new AlertMapper(null);
FeedScopedId id = createId("stopId", stopId);
return alertMapper.mapToApi(routingService.getTransitAlertService().getStopAlerts(id));
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class IndexAPI method getAlertsForPattern.
/**
* Return all alerts for a pattern
*/
@GET
@Path("/patterns/{patternId}/alerts")
public Collection<ApiAlert> getAlertsForPattern(@PathParam("patternId") String patternId) {
RoutingService routingService = createRoutingService();
// TODO: Add locale
AlertMapper alertMapper = new AlertMapper(null);
FeedScopedId id = createId("patternId", patternId);
return alertMapper.mapToApi(routingService.getTransitAlertService().getTripPatternAlerts(id));
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class CalendarServiceDataFactoryImpl method createData.
private CalendarServiceData createData() {
CalendarServiceData data = new CalendarServiceData();
setTimeZonesForAgencies(data);
int index = 0;
for (FeedScopedId serviceId : serviceIds) {
index++;
LOG.debug("serviceId=" + serviceId + " (" + index + "/" + serviceIds.size() + ")");
TimeZone serviceIdTimeZone = data.getTimeZoneForAgencyId(data.getAgencyIds().stream().filter(agency -> agency.getFeedId().equals(serviceId.getFeedId())).findAny().orElse(null));
if (serviceIdTimeZone == null) {
serviceIdTimeZone = TimeZone.getDefault();
}
Set<ServiceDate> activeDates = getServiceDatesForServiceId(serviceId, serviceIdTimeZone);
List<ServiceDate> serviceDates = new ArrayList<>(activeDates);
Collections.sort(serviceDates);
data.putServiceDatesForServiceId(serviceId, serviceDates);
}
return data;
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class StopToParentStationLinker method link.
void link() {
for (Map.Entry<StationElement, FeedScopedId> entry : stationElementsToStations.entrySet()) {
StationElement stationElement = entry.getKey();
FeedScopedId stationId = entry.getValue();
Station otpStation = otpStations.get(stationId);
if (otpStation == null) {
issueStore.add(new ParentStationNotFound(stationElement, stationId.getId()));
} else {
stationElement.setParentStation(otpStation);
if (stationElement instanceof Stop) {
otpStation.addChildStop((Stop) stationElement);
}
}
}
for (Map.Entry<BoardingArea, FeedScopedId> entry : boardingAreasToStops.entrySet()) {
BoardingArea boardingArea = entry.getKey();
FeedScopedId stopId = entry.getValue();
StationElement otpStop = otpStationElements.get(stopId);
if (!(otpStop instanceof Stop)) {
issueStore.add(new ParentStationNotFound(boardingArea, stopId.getId()));
} else {
boardingArea.setParentStop((Stop) otpStop);
((Stop) otpStop).addBoardingArea(boardingArea);
boardingArea.setParentStation(otpStop.getParentStation());
}
}
}
Aggregations