33 |
|
|
34 |
Map<Integer, TreeMap<Short, ArrayList<Address>> > searchStructure; |
Map<Integer, TreeMap<Short, ArrayList<Address>> > searchStructure; |
35 |
|
|
36 |
ArrayList<AddressSourceEntry> afvisteEntries = 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 |
|
|
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 |
} |
} |
294 |
|
|
295 |
private void updateAddress(Address addr, AddressSourceEntry entry) { |
private void updateAddress(Address addr, AddressSourceEntry entry) { |
296 |
if ( addr.distributor != null && addr.distributor.equals(entry.distributor) == false) { |
if ( addr.distributor != null && addr.distributor.equals(entry.distributor) == false) { |
297 |
afvisteEntries.add(entry); |
rejectedEntries.add(entry); |
298 |
System.out.println("Afviser " + entry); |
System.out.println("Afviser " + entry); |
299 |
return; |
return; |
300 |
} |
} |
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 |
|
|
605 |
break; |
break; |
606 |
case "NS": |
case "NS": |
607 |
bane = 204; |
bane = 204; |
608 |
break; |
break; |
609 |
|
default: |
610 |
|
throw new RuntimeException("Ukendt distributor" + a.distributor); //Silence findBugs |
611 |
} |
} |
612 |
|
|
613 |
if (bane == null) { |
if (bane == null) { |
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 getAfvistAntal() { |
public int getRejectedCount() { |
636 |
return afvisteEntries.size(); |
return rejectedEntries.size(); |
637 |
} |
} |
638 |
|
|
639 |
} |
} |