--- dao/DaoAdresseService/src/dk/daoas/daoadresseservice/AdressSearch.java 2015/02/27 12:43:54 2407 +++ dao/DaoAdresseService/src/dk/daoas/daoadresseservice/AddressSearch.java 2015/02/28 16:16:17 2410 @@ -24,7 +24,7 @@ import dk.daoas.daoadresseservice.beans.SearchResult.Status; import dk.daoas.daoadresseservice.db.DatabaseLayer; -public class AdressSearch { +public class AddressSearch { private Map> searchPostnrVejnavnGadeid; private Map> searchGadeidentAdresser; @@ -37,8 +37,14 @@ ServiceConfig config; - public AdressSearch(ServiceConfig config) { + StreetnameHelper googleHelper; + StreetnameHelper osmHelper; + + public AddressSearch(ServiceConfig config) { this.config = config; + + googleHelper = new GoogleStreetnameHelper( config ); + osmHelper = new OSMStreetnameHelper( config ); } @@ -95,21 +101,13 @@ // Brug OpenStreetMap før vi prøver google // For google har en request limit, det har OSM ikke! if ( gadeident == null) { - if (config.useOpenStreetMaps) { - result.osmVej = GeocodeHelper.openstreetmapHelper(config, postnr, result.splitResult.vej ); - result.osm = true; - - gadeident = helperWrapper(result.osmVej, postnrVeje, helperSearchKey); - } + String vej = osmHelper.proposeStreetName(result, postnr, result.splitResult.vej); + gadeident = helperWrapper(vej, postnrVeje, helperSearchKey); } if ( gadeident == null) { - if (config.useGoogle) { - result.googleVej = GeocodeHelper.googleHelper(config, postnr, result.splitResult.vej ); - result.google = true; - - gadeident = helperWrapper(result.googleVej, postnrVeje, helperSearchKey); - } + String vej = googleHelper.proposeStreetName(result, postnr, result.splitResult.vej); + gadeident = helperWrapper(vej, postnrVeje, helperSearchKey); }