/[projects]/android/TrainInfoService/src/dk/thoerup/traininfoservice/db/StationDAO.java
ViewVC logotype

Diff of /android/TrainInfoService/src/dk/thoerup/traininfoservice/db/StationDAO.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1515 by torben, Fri Jun 10 08:25:43 2011 UTC revision 1569 by torben, Sat Jul 9 07:31:01 2011 UTC
# Line 145  public class StationDAO { Line 145  public class StationDAO {
145                  return stations;                  return stations;
146          }          }
147                    
148            private String removeSuffix(String str, String suffix) {
149                    if (str.endsWith(suffix)) {
150                            return str.substring(0, str.length() - suffix.length() );
151                    } else {
152                            return str;
153                    }
154            }
155            
156          public StationBean getByName(String name) throws SQLException {          public StationBean getByName(String name) throws SQLException {
157                    name = removeSuffix(name, " st.");
158                    name = removeSuffix(name, " st");
159                    name = removeSuffix(name, " station");
160                    
161                  StationBean stations = getByNameNormal(name);                  StationBean stations = getByNameNormal(name);
162                                    
163                  if (stations.entries.size() == 0) {                  if (stations.entries.size() == 0) {
                         name = name.replace(".", ""); //remove any .'s before fuzzy search  
164                          stations = getByNameFuzzy(name);                          stations = getByNameFuzzy(name);
165    
166                          logger.info("getByName failover: " + name + "(" + (stations.entries.size() >0) + ")" );                          logger.info("getByName failover: " + name + "(" + (stations.entries.size() >0) + ")" );
# Line 247  public class StationDAO { Line 258  public class StationDAO {
258          }          }
259                    
260          //used to create full dump in order to populate Google Appengine DB          //used to create full dump in order to populate Google Appengine DB
261          @Deprecated          //after 1.1.0 also used to populate client-side station list
262          public StationBean dumpAll() throws SQLException {          public StationBean dumpAll() throws SQLException {
263                                    
264                  String SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog,stationcode_metro,address,0.0,aliases " +                  String SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog,stationcode_metro,address,0.0,aliases " +

Legend:
Removed from v.1515  
changed lines
  Added in v.1569

  ViewVC Help
Powered by ViewVC 1.1.20