/[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 2295 by torben, Sun Feb 15 09:57:55 2015 UTC revision 2300 by torben, Sun Feb 15 14:17:03 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                            if (googleVej != null) {
59                                    String googleVasket = AddressUtils.vaskVejnavn( googleVej );
60                                    gadeident =  postnrVeje.get(googleVasket);
61                                    google = true;
62                            }
63                    }
64                    
65                  if (gadeident == null) {                  if (gadeident == null) {
66                          return new SearchResult(Status.ERROR_UNKNOWN_STREETNAME);                          return new SearchResult(Status.ERROR_UNKNOWN_STREETNAME);
67                  }                  }
 //long start5 = System.currentTimeMillis();  
68                                    
69                  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
70                                    
 //long start6 = System.currentTimeMillis();  
71                                    
72                  String husnrSearch = "" + split.husnr + split.litra;                  String husnrSearch = "" + split.husnr + split.litra;
73                  Address addr = gade.get(husnrSearch);                  Address addr = gade.get(husnrSearch);
74  //long start7 = System.currentTimeMillis();  
75                  if (addr == null) {                  if (addr == null) {
76                          return new SearchResult(Status.ERROR_UNKNOWN_ADDRESSPOINT);                          return new SearchResult(Status.ERROR_UNKNOWN_ADDRESSPOINT);
77                  }                  }
# Line 78  public class AdressSearch { Line 82  public class AdressSearch {
82                                    
83                  if (addr.distributor.equals("LUKKET")) {                  if (addr.distributor.equals("LUKKET")) {
84                          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 ?
85                  }                  }              
                   
 /*  
 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) );  
 */  
   
                                   
86                                    
87                  return new SearchResult(addr);                  SearchResult res = new SearchResult(addr);
88                    res.google = google;
89                    return res;
90          }          }
91                    
92                    

Legend:
Removed from v.2295  
changed lines
  Added in v.2300

  ViewVC Help
Powered by ViewVC 1.1.20