/[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 2297 by torben, Sun Feb 15 09:57:55 2015 UTC revision 2298 by torben, Sun Feb 15 11:00:48 2015 UTC
# Line 28  public class AdressSearch { Line 28  public class AdressSearch {
28                    
29                    
30          public SearchResult search(String postnrStr, String adresse)  {          public SearchResult search(String postnrStr, String adresse)  {
 //long start1 = System.currentTimeMillis();  
31                                    
32                  int postnr=0;                  int postnr=0;
33                    boolean google = false;
34                                    
35                  try {                  try {
36                          postnr = Integer.parseInt(postnrStr);                          postnr = Integer.parseInt(postnrStr);
37                  } catch (Exception E) {                  } catch (Exception E) {
38                          return new SearchResult(Status.ERROR_UNKNOWN_POSTAL);                          return new SearchResult(Status.ERROR_UNKNOWN_POSTAL);
39                  }                                }              
 //long start2 = System.currentTimeMillis();  
40                                    
41                  Map<String,Long> postnrVeje = searchPostnrVejnavnGadeid.get(postnr);                                      Map<String,Long> postnrVeje = searchPostnrVejnavnGadeid.get(postnr);                    
42                                    
# Line 45  public class AdressSearch { Line 44  public class AdressSearch {
44                          return new SearchResult(Status.ERROR_UNKNOWN_POSTAL);                          return new SearchResult(Status.ERROR_UNKNOWN_POSTAL);
45                  }                  }
46                                    
 //long start3 = System.currentTimeMillis();  
47                                    
48                  SplitResult split = AddressUtils.splitAdresse(adresse);                  SplitResult split = AddressUtils.splitAdresse(adresse);
49                  String vasketVejnavn = AddressUtils.vaskVejnavn( split.vej );                                            String vasketVejnavn = AddressUtils.vaskVejnavn( split.vej );                          
# Line 53  public class AdressSearch { Line 51  public class AdressSearch {
51                  if (split.husnr.length() == 0) {                  if (split.husnr.length() == 0) {
52                          return new SearchResult(Status.ERROR_MISSING_HOUSENUMBER);                                                return new SearchResult(Status.ERROR_MISSING_HOUSENUMBER);                      
53                  }                  }
 //long start4 = System.currentTimeMillis();  
54                                    
55                  Long gadeident =  postnrVeje.get(vasketVejnavn);                  Long gadeident =  postnrVeje.get(vasketVejnavn);
56                    if ( gadeident == null) {
57                            String googleVej = GeocodeHelper.googleHelper(postnr, split.vej );
58                            String googleVasket = AddressUtils.vaskVejnavn( googleVej );
59                            gadeident =  postnrVeje.get(googleVasket);
60                            google = true;
61                    }
62                    
63                  if (gadeident == null) {                  if (gadeident == null) {
64                          return new SearchResult(Status.ERROR_UNKNOWN_STREETNAME);                          return new SearchResult(Status.ERROR_UNKNOWN_STREETNAME);
65                  }                  }
 //long start5 = System.currentTimeMillis();  
66                                    
67                  Map<String, Address> gade =  searchGadeidentAdresser.get(gadeident); //Denne søgning må ikke fejle                  Map<String, Address> gade =  searchGadeidentAdresser.get(gadeident); //Denne søgning må ikke fejle
68                                    
 //long start6 = System.currentTimeMillis();  
69                                    
70                  String husnrSearch = "" + split.husnr + split.litra;                  String husnrSearch = "" + split.husnr + split.litra;
71                  Address addr = gade.get(husnrSearch);                  Address addr = gade.get(husnrSearch);
72  //long start7 = System.currentTimeMillis();  
73                  if (addr == null) {                  if (addr == null) {
74                          return new SearchResult(Status.ERROR_UNKNOWN_ADDRESSPOINT);                          return new SearchResult(Status.ERROR_UNKNOWN_ADDRESSPOINT);
75                  }                  }
# Line 78  public class AdressSearch { Line 80  public class AdressSearch {
80                                    
81                  if (addr.distributor.equals("LUKKET")) {                  if (addr.distributor.equals("LUKKET")) {
82                          return new SearchResult(Status.STATUS_NOT_COVERED); //Skal vi have en special status til Lukkede adresser ?                          return new SearchResult(Status.STATUS_NOT_COVERED); //Skal vi have en special status til Lukkede adresser ?
83                  }                  }              
                   
 /*  
 System.out.println("Search2: " + (start2-start1) );  
 System.out.println("Search3: " + (start3-start1) );  
 System.out.println("Search4: " + (start4-start1) );  
 System.out.println("Search5: " + (start5-start1) );  
 System.out.println("Search6: " + (start6-start1) );  
 System.out.println("Search7: " + (start7-start1) );  
 */  
   
                                   
84                                    
85                  return new SearchResult(addr);                  SearchResult res = new SearchResult(addr);
86                    res.google = google;
87                    return res;
88          }          }
89                    
90                    

Legend:
Removed from v.2297  
changed lines
  Added in v.2298

  ViewVC Help
Powered by ViewVC 1.1.20