/[projects]/dao/DaoAdresseService/src/dk/daoas/daoadresseservice/AdressSearch.java
ViewVC logotype

Diff of /dao/DaoAdresseService/src/dk/daoas/daoadresseservice/AdressSearch.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2345 by torben, Mon Feb 23 12:54:22 2015 UTC revision 2346 by torben, Mon Feb 23 14:39:49 2015 UTC
# Line 13  import java.util.Set; Line 13  import java.util.Set;
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;
# Line 33  public class AdressSearch { Line 34  public class AdressSearch {
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;
# Line 70  public class AdressSearch { Line 71  public class AdressSearch {
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(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                  }                  }

Legend:
Removed from v.2345  
changed lines
  Added in v.2346

  ViewVC Help
Powered by ViewVC 1.1.20