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 |
|
if (! unknownStreets.containsKey(entry.gadeid)) { |
231 |
|
unknownStreets.put(entry.gadeid, entry.vejnavn); |
232 |
|
} |
233 |
|
|
234 |
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 |
235 |
return; |
return; |
236 |
} |
} |
257 |
|
|
258 |
TreeMap<Short, ArrayList<Address>> gade = searchStructure.get( entry.gadeid ); |
TreeMap<Short, ArrayList<Address>> gade = searchStructure.get( entry.gadeid ); |
259 |
if (gade == null) { |
if (gade == null) { |
260 |
|
if (! unknownStreets.containsKey(entry.gadeid)) { |
261 |
|
unknownStreets.put(entry.gadeid, entry.vejnavn); |
262 |
|
} |
263 |
|
|
264 |
System.out.println("[Range] Ukendt gadeID " + entry); |
System.out.println("[Range] Ukendt gadeID " + entry); |
265 |
return; |
return; |
266 |
} |
} |
488 |
if (entry.kommunekode < 100) { |
if (entry.kommunekode < 100) { |
489 |
return; |
return; |
490 |
} |
} |
491 |
if (Short.parseShort(Integer.toString(entry.gadeid).substring(0, 4)) != entry.postnr) { |
|
492 |
|
String gadeidStr = Integer.toString(entry.gadeid); |
493 |
|
if (gadeidStr.length() != 9) { |
494 |
|
return; |
495 |
|
} |
496 |
|
if (Short.parseShort(gadeidStr.substring(0, 4)) != entry.postnr) { |
497 |
return; //gadeid / postnr mismatch |
return; //gadeid / postnr mismatch |
498 |
} |
} |
499 |
|
|
632 |
return Collections.unmodifiableList(addressList); |
return Collections.unmodifiableList(addressList); |
633 |
} |
} |
634 |
|
|
635 |
|
public Map<Integer,String> getUnknownStreets() { |
636 |
|
return Collections.unmodifiableMap( unknownStreets ); |
637 |
|
} |
638 |
|
|
639 |
|
|
640 |
|
|
641 |
public int getRejectedCount() { |
public int getRejectedCount() { |