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) { |
|
logger.info("getByName failover: " + name); |
|
|
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) + ")" ); |
167 |
} |
} |
168 |
return stations; |
return stations; |
169 |
} |
} |