--- dao/DaoAdresseService/src/dk/daoas/daoadresseservice/AdressSearch.java 2015/02/23 14:39:49 2346 +++ dao/DaoAdresseService/src/dk/daoas/daoadresseservice/AdressSearch.java 2015/02/24 10:18:19 2358 @@ -31,10 +31,16 @@ private Map helperCache; - private DataStatisticsBean stats = new DataStatisticsBean(); + private DataStatisticsBean stats = new DataStatisticsBean(); + ServiceConfig config; - public SearchResult search(ServiceConfig config, String postnrStr, String adresse) { + public AdressSearch(ServiceConfig config) { + this.config = config; + } + + + public SearchResult search(String postnrStr, String adresse) { int postnr=0; boolean google = false; @@ -55,12 +61,14 @@ SplitResult split = AddressUtils.splitAdresse(adresse); - String vasketVejnavn = AddressUtils.vaskVejnavn( split.vej ); + if (split.husnr.length() == 0) { return new SearchResult(Status.ERROR_MISSING_HOUSENUMBER); } + String vasketVejnavn = AddressUtils.vaskVejnavn( split.vej ); + Long gadeident = postnrVeje.get(vasketVejnavn); @@ -72,7 +80,7 @@ if ( gadeident == null) { if (config.useGoogle) { - String googleVej = GeocodeHelper.googleHelper(postnr, split.vej ); + String googleVej = GeocodeHelper.googleHelper(config, postnr, split.vej ); google = true; if (googleVej != null) {