13 |
import java.util.concurrent.ConcurrentHashMap; |
import java.util.concurrent.ConcurrentHashMap; |
14 |
|
|
15 |
import dk.daoas.daoadresseservice.AddressUtils.SplitResult; |
import dk.daoas.daoadresseservice.AddressUtils.SplitResult; |
16 |
|
import dk.daoas.daoadresseservice.admin.ServiceConfig; |
17 |
import dk.daoas.daoadresseservice.beans.Address; |
import dk.daoas.daoadresseservice.beans.Address; |
18 |
import dk.daoas.daoadresseservice.beans.DataStatisticsBean; |
import dk.daoas.daoadresseservice.beans.DataStatisticsBean; |
19 |
import dk.daoas.daoadresseservice.beans.ExtendedBean; |
import dk.daoas.daoadresseservice.beans.ExtendedBean; |
34 |
private DataStatisticsBean stats = new DataStatisticsBean(); |
private DataStatisticsBean stats = new DataStatisticsBean(); |
35 |
|
|
36 |
|
|
37 |
public SearchResult search(String postnrStr, String adresse) { |
public SearchResult search(ServiceConfig config, String postnrStr, String adresse) { |
38 |
|
|
39 |
int postnr=0; |
int postnr=0; |
40 |
boolean google = false; |
boolean google = false; |
71 |
|
|
72 |
|
|
73 |
if ( gadeident == null) { |
if ( gadeident == null) { |
74 |
String googleVej = GeocodeHelper.googleHelper(postnr, split.vej ); |
if (config.useGoogle) { |
75 |
google = true; |
String googleVej = GeocodeHelper.googleHelper(config, postnr, split.vej ); |
76 |
|
google = true; |
|
if (googleVej != null) { |
|
|
String googleVasket = AddressUtils.vaskVejnavn( googleVej ); |
|
|
gadeident = postnrVeje.get(googleVasket); |
|
77 |
|
|
78 |
if (gadeident != null) { |
if (googleVej != null) { |
79 |
helperCache.put(helperSearchKey, gadeident); |
String googleVasket = AddressUtils.vaskVejnavn( googleVej ); |
80 |
|
gadeident = postnrVeje.get(googleVasket); |
81 |
|
|
82 |
|
if (gadeident != null) { |
83 |
|
helperCache.put(helperSearchKey, gadeident); |
84 |
|
} |
85 |
} |
} |
86 |
} |
} |
87 |
} |
} |
88 |
|
|
89 |
if ( gadeident == null) { |
if ( gadeident == null) { |
90 |
String osmVej = GeocodeHelper.openstreetmapHelper(postnr, split.vej ); |
if (config.useOpenStreetMaps) { |
91 |
osm = true; |
String osmVej = GeocodeHelper.openstreetmapHelper(postnr, split.vej ); |
92 |
|
osm = true; |
|
if (osmVej != null) { |
|
|
String osmVasket = AddressUtils.vaskVejnavn( osmVej ); |
|
|
gadeident = postnrVeje.get(osmVasket); |
|
93 |
|
|
94 |
if (gadeident != null) { |
if (osmVej != null) { |
95 |
helperCache.put(helperSearchKey, gadeident); |
String osmVasket = AddressUtils.vaskVejnavn( osmVej ); |
96 |
|
gadeident = postnrVeje.get(osmVasket); |
97 |
|
|
98 |
|
if (gadeident != null) { |
99 |
|
helperCache.put(helperSearchKey, gadeident); |
100 |
|
} |
101 |
} |
} |
102 |
} |
} |
103 |
} |
} |