31 |
|
|
32 |
private Map<String,Long> helperCache; |
private Map<String,Long> helperCache; |
33 |
|
|
34 |
private DataStatisticsBean stats = new DataStatisticsBean(); |
private DataStatisticsBean stats = new DataStatisticsBean(); |
35 |
|
|
36 |
|
ServiceConfig config; |
37 |
|
|
38 |
public SearchResult search(ServiceConfig config, String postnrStr, String adresse) { |
public AdressSearch(ServiceConfig config) { |
39 |
|
this.config = config; |
40 |
|
} |
41 |
|
|
42 |
|
|
43 |
|
public SearchResult search(String postnrStr, String adresse) { |
44 |
|
|
45 |
int postnr=0; |
int postnr=0; |
46 |
boolean google = false; |
boolean google = false; |
61 |
|
|
62 |
|
|
63 |
SplitResult split = AddressUtils.splitAdresse(adresse); |
SplitResult split = AddressUtils.splitAdresse(adresse); |
64 |
String vasketVejnavn = AddressUtils.vaskVejnavn( split.vej ); |
|
65 |
|
|
66 |
if (split.husnr.length() == 0) { |
if (split.husnr.length() == 0) { |
67 |
return new SearchResult(Status.ERROR_MISSING_HOUSENUMBER); |
return new SearchResult(Status.ERROR_MISSING_HOUSENUMBER); |
68 |
} |
} |
69 |
|
|
70 |
|
String vasketVejnavn = AddressUtils.vaskVejnavn( split.vej ); |
71 |
|
|
72 |
Long gadeident = postnrVeje.get(vasketVejnavn); |
Long gadeident = postnrVeje.get(vasketVejnavn); |
73 |
|
|
74 |
|
|
80 |
|
|
81 |
if ( gadeident == null) { |
if ( gadeident == null) { |
82 |
if (config.useGoogle) { |
if (config.useGoogle) { |
83 |
String googleVej = GeocodeHelper.googleHelper(postnr, split.vej ); |
String googleVej = GeocodeHelper.googleHelper(config, postnr, split.vej ); |
84 |
google = true; |
google = true; |
85 |
|
|
86 |
if (googleVej != null) { |
if (googleVej != null) { |