35 |
|
|
36 |
ArrayList<AddressSourceEntry> rejectedEntries = new ArrayList<AddressSourceEntry>(); |
ArrayList<AddressSourceEntry> rejectedEntries = new ArrayList<AddressSourceEntry>(); |
37 |
|
|
38 |
|
Map<Integer,String> unknownStreets = new TreeMap<Integer, String>(); |
39 |
|
|
40 |
Map<Short,Short> dbkBaneMap = new TreeMap<Short,Short>(); |
Map<Short,Short> dbkBaneMap = new TreeMap<Short,Short>(); |
41 |
|
|
42 |
public AddressManager() throws SQLException { |
public AddressManager() throws SQLException { |
208 |
DatabaseLayerImplementation db = new DatabaseLayerImplementation(); |
DatabaseLayerImplementation db = new DatabaseLayerImplementation(); |
209 |
|
|
210 |
db.updateAddresses(updates); |
db.updateAddresses(updates); |
211 |
|
db.saveNewAddresses(inserts); |
212 |
|
|
213 |
|
|
214 |
|
|
227 |
private void visitSingle(AddressSourceEntry entry) { |
private void visitSingle(AddressSourceEntry entry) { |
228 |
TreeMap<Short, ArrayList<Address>> gade = searchStructure.get( entry.gadeid ); |
TreeMap<Short, ArrayList<Address>> gade = searchStructure.get( entry.gadeid ); |
229 |
if (gade == null) { |
if (gade == null) { |
230 |
|
unknownStreets.putIfAbsent(entry.gadeid, entry.vejnavn); |
231 |
createFromEntry(entry); // if we get here there was no match - so we need to create it |
createFromEntry(entry); // if we get here there was no match - so we need to create it |
232 |
return; |
return; |
233 |
} |
} |
254 |
|
|
255 |
TreeMap<Short, ArrayList<Address>> gade = searchStructure.get( entry.gadeid ); |
TreeMap<Short, ArrayList<Address>> gade = searchStructure.get( entry.gadeid ); |
256 |
if (gade == null) { |
if (gade == null) { |
257 |
|
unknownStreets.putIfAbsent(entry.gadeid, entry.vejnavn); |
258 |
System.out.println("[Range] Ukendt gadeID " + entry); |
System.out.println("[Range] Ukendt gadeID " + entry); |
259 |
return; |
return; |
260 |
} |
} |
482 |
if (entry.kommunekode < 100) { |
if (entry.kommunekode < 100) { |
483 |
return; |
return; |
484 |
} |
} |
485 |
if (Short.parseShort(Integer.toString(entry.gadeid).substring(0, 4)) != entry.postnr) { |
|
486 |
|
String gadeidStr = Integer.toString(entry.gadeid); |
487 |
|
if (gadeidStr.length() != 9) { |
488 |
|
return; |
489 |
|
} |
490 |
|
if (Short.parseShort(gadeidStr.substring(0, 4)) != entry.postnr) { |
491 |
return; //gadeid / postnr mismatch |
return; //gadeid / postnr mismatch |
492 |
} |
} |
493 |
|
|
626 |
return Collections.unmodifiableList(addressList); |
return Collections.unmodifiableList(addressList); |
627 |
} |
} |
628 |
|
|
629 |
|
public Map<Integer,String> getUnknownStreets() { |
630 |
|
return Collections.unmodifiableMap( unknownStreets ); |
631 |
|
} |
632 |
|
|
633 |
|
|
634 |
|
|
635 |
public int getRejectedCount() { |
public int getRejectedCount() { |