use of org.onebusaway.container.cache.Cacheable in project onebusaway-application-modules by camsys.
the class RouteServiceImpl method getRouteCollectionIdsForStop.
@Override
@Cacheable
public Set<AgencyAndId> getRouteCollectionIdsForStop(AgencyAndId stopId) {
StopEntry stopEntry = _transitGraphDao.getStopEntryForId(stopId);
if (stopEntry == null)
throw new InternalErrorServiceException("no such stop: id=" + stopId);
Set<AgencyAndId> routeCollectionIds = new HashSet<AgencyAndId>();
List<BlockStopTimeIndex> indices = _blockIndexService.getStopTimeIndicesForStop(stopEntry);
for (BlockStopTimeIndex blockStopTimeIndex : indices) {
for (BlockTripEntry blockTrip : blockStopTimeIndex.getTrips()) {
TripEntry trip = blockTrip.getTrip();
routeCollectionIds.add(trip.getRouteCollection().getId());
}
}
List<FrequencyBlockStopTimeIndex> frequencyIndices = _blockIndexService.getFrequencyStopTimeIndicesForStop(stopEntry);
for (FrequencyBlockStopTimeIndex blockStopTimeIndex : frequencyIndices) {
for (BlockTripEntry blockTrip : blockStopTimeIndex.getTrips()) {
TripEntry trip = blockTrip.getTrip();
routeCollectionIds.add(trip.getRouteCollection().getId());
}
}
return routeCollectionIds;
}
use of org.onebusaway.container.cache.Cacheable in project onebusaway-application-modules by camsys.
the class ProjectedShapePointServiceImpl method getProjectedShapePoints.
@Cacheable
@Override
public T2<List<XYPoint>, double[]> getProjectedShapePoints(List<AgencyAndId> shapeIds, int utmZoneId) {
ShapePoints shapePoints = _shapePointService.getShapePointsForShapeIds(shapeIds);
if (shapePoints == null || shapePoints.isEmpty())
return null;
UTMProjection projection = new UTMProjection(utmZoneId);
List<XYPoint> projected = _shapePointsLibrary.getProjectedShapePoints(shapePoints, projection);
return Tuples.tuple(projected, shapePoints.getDistTraveled());
}
use of org.onebusaway.container.cache.Cacheable in project onebusaway-application-modules by camsys.
the class ShapePointServiceImpl method getShapePointsForShapeIds.
@Cacheable
@Override
public ShapePoints getShapePointsForShapeIds(List<AgencyAndId> shapeIds) {
ShapePointsFactory factory = new ShapePointsFactory();
for (AgencyAndId shapeId : shapeIds) {
ShapePoints shapePoints = getShapePointsForShapeId(shapeId);
factory.addPoints(shapePoints);
}
return factory.create();
}
use of org.onebusaway.container.cache.Cacheable in project onebusaway-application-modules by camsys.
the class ExtendedCalendarServiceImpl method getDatesForServiceIds.
@Cacheable
@Override
public Set<Date> getDatesForServiceIds(ServiceIdActivation serviceIds) {
Set<Date> serviceDates = null;
List<LocalizedServiceId> activeServiceIds = serviceIds.getActiveServiceIds();
List<LocalizedServiceId> inactiveServiceIds = serviceIds.getInactiveServiceIds();
for (LocalizedServiceId activeServiceId : activeServiceIds) {
List<Date> dates = _calendarService.getDatesForLocalizedServiceId(activeServiceId);
if (dates.isEmpty())
return Collections.emptySet();
if (serviceDates == null)
serviceDates = new HashSet<Date>(dates);
else
serviceDates.retainAll(dates);
if (serviceDates.isEmpty())
return Collections.emptySet();
}
for (LocalizedServiceId inactiveServiceId : inactiveServiceIds) {
List<Date> dates = _calendarService.getDatesForLocalizedServiceId(inactiveServiceId);
serviceDates.removeAll(dates);
}
return serviceDates;
}
use of org.onebusaway.container.cache.Cacheable in project onebusaway-application-modules by camsys.
the class ExtendedCalendarServiceImpl method getServiceDatesForServiceIds.
@Cacheable
@Override
public Set<ServiceDate> getServiceDatesForServiceIds(ServiceIdActivation serviceIds) {
Set<ServiceDate> serviceDates = null;
List<LocalizedServiceId> activeServiceIds = serviceIds.getActiveServiceIds();
List<LocalizedServiceId> inactiveServiceIds = serviceIds.getInactiveServiceIds();
for (LocalizedServiceId activeServiceId : activeServiceIds) {
Set<ServiceDate> dates = _calendarService.getServiceDatesForServiceId(activeServiceId.getId());
if (dates.isEmpty())
return Collections.emptySet();
if (serviceDates == null)
serviceDates = new HashSet<ServiceDate>(dates);
else
serviceDates.retainAll(dates);
if (serviceDates.isEmpty())
return Collections.emptySet();
}
for (LocalizedServiceId inactiveServiceId : inactiveServiceIds) {
Set<ServiceDate> dates = _calendarService.getServiceDatesForServiceId(inactiveServiceId.getId());
serviceDates.removeAll(dates);
}
return serviceDates;
}
Aggregations