16 |
import dk.thoerup.android.traininfo.common.StationBean.StationEntry; |
import dk.thoerup.android.traininfo.common.StationBean.StationEntry; |
17 |
import dk.thoerup.circuitbreaker.CircuitBreaker; |
import dk.thoerup.circuitbreaker.CircuitBreaker; |
18 |
import dk.thoerup.circuitbreaker.CircuitBreakerManager; |
import dk.thoerup.circuitbreaker.CircuitBreakerManager; |
|
import dk.thoerup.traininfoservice.StationDAO; |
|
19 |
import dk.thoerup.traininfoservice.Statistics; |
import dk.thoerup.traininfoservice.Statistics; |
20 |
|
import dk.thoerup.traininfoservice.db.StationDAO; |
21 |
|
|
22 |
public class DepartureFetcher { |
public class DepartureFetcher { |
23 |
|
|
75 |
StationEntry station = stationDao.getById(stationID); |
StationEntry station = stationDao.getById(stationID); |
76 |
|
|
77 |
departureBean.stationName = station.getName(); |
departureBean.stationName = station.getName(); |
78 |
|
|
79 |
if (station.getRegional() != null && (type == FetchTrainType.REGIONAL||type == FetchTrainType.BOTH) ) { |
if (station.getRegional() != null && (type == FetchTrainType.REGIONAL||type == FetchTrainType.BOTH) ) { |
80 |
DepartureBean tempBean = lookupDepartures(station.getRegional(), TrainType.REGIONAL, arrival); |
DepartureBean tempBean = lookupDepartures(station.getRegional(), TrainType.REGIONAL, arrival); |
81 |
departureBean.entries.addAll( tempBean.entries ); |
departureBean.entries.addAll( tempBean.entries ); |
92 |
logger.info("No departures found for station " + stationID); |
logger.info("No departures found for station " + stationID); |
93 |
} |
} |
94 |
|
|
95 |
Collections.sort( departureBean.entries ); |
if (type == FetchTrainType.BOTH) { //if we have both S-tog and regional order by departure/arrival time |
96 |
|
Collections.sort( departureBean.entries ); |
97 |
|
} |
98 |
|
|
99 |
|
|
100 |
return departureBean; |
return departureBean; |