49 |
|
|
50 |
protected StationBean getStations(HttpServletRequest req) throws SQLException { |
protected StationBean getStations(HttpServletRequest req) throws SQLException { |
51 |
StationBean stations = null; |
StationBean stations = null; |
52 |
|
|
53 |
|
boolean dummy = req.getParameter("dummy") != null; |
54 |
|
if (dummy == true) |
55 |
|
stations = new StationBean(); |
56 |
|
|
57 |
if (req.getParameter("latitude") != null && req.getParameter("latitude") != null) { |
if (req.getParameter("latitude") != null && req.getParameter("latitude") != null) { |
58 |
|
|
59 |
Statistics.getInstance().incrementStationLookupsLocation(); |
Statistics.getInstance().incrementStationLookupsLocation(); |
60 |
|
|
61 |
double latitude = Double.parseDouble( req.getParameter("latitude") ); |
double latitude = Double.parseDouble( req.getParameter("latitude") ); |
62 |
double longitude = Double.parseDouble( req.getParameter("longitude") ); |
double longitude = Double.parseDouble( req.getParameter("longitude") ); |
63 |
stations = stationDao.getByLocation(latitude, longitude); |
if (dummy == false) |
64 |
|
stations = stationDao.getByLocation(latitude, longitude); |
65 |
|
|
66 |
} else if (req.getParameter("name") != null) { |
} else if (req.getParameter("name") != null) { |
67 |
Statistics.getInstance().incrementStationLookupsName(); |
Statistics.getInstance().incrementStationLookupsName(); |
68 |
String name = req.getParameter("name").trim(); |
String name = req.getParameter("name").trim(); |
69 |
stations = stationDao.getByName(name); |
if (dummy == false) |
70 |
|
stations = stationDao.getByName(name); |
71 |
|
|
72 |
} else if (req.getParameter("list") != null) { |
} else if (req.getParameter("list") != null) { |
73 |
Statistics.getInstance().incrementStationLookupsFavorites(); |
Statistics.getInstance().incrementStationLookupsFavorites(); |
74 |
String list = transformToIntList( req.getParameter("list")); |
String list = transformToIntList( req.getParameter("list")); |
75 |
stations = stationDao.getByList(list); |
if (dummy == false) |
76 |
|
stations = stationDao.getByList(list); |
77 |
} else if (req.getParameter("dump") != null) { |
} else if (req.getParameter("dump") != null) { |
78 |
stations = stationDao.dumpAll(); |
stations = stationDao.dumpAll(); |
79 |
} |
} |