java/dbloader/src/main/java/be/bosa/dt/best/dbloader/CsvPreparer.java
/**
	 * Load streets
	 * 
	 * @param xmlPath XML BeST directory
	 * @param csvPath CSV output directory
	 * @throws IOException 
	 */
Load streets

@param xmlPath XML BeST directory
@param csvPath CSV output directory
@throws IOException
Load streets @param xmlPath XML BeST directory @param csvPath CSV output directory @throws IOException
private void writeStreets(Path xmlPath, Path csvPath) throws IOException {
		try(CsvWriter w = builder.build(csvPath.resolve("streets.csv"), StandardCharsets.UTF_8)) {
			for (BestRegion reg: new BestRegion[] { BestRegion.BRUSSELS, BestRegion.FLANDERS, BestRegion.WALLONIA }) {
				LOG.log(Level.INFO, "Starting streets {0} ", reg.getName());
				int cnt = 0;
				StreetnameReader reader = new StreetnameReader();
				Stream<Street> streets = reader.read(reg, xmlPath);
				Iterator<Street> iter = streets.iterator();
				while (iter.hasNext()) {
					Street a = iter.next();
					w.writeRow(NsConverter.streetEncode(a.getIDVersion()),
								"1",
								NsConverter.municipalityEncode(a.getCity().getIDVersion()), 
								"1",
								a.getName("nl"), a.getName("fr"), a.getName("de"), 
								"", "", a.getStatus(),
								(a.getFromDate() != null) ? a.getFromDate().toString() : "", 
								(a.getTillDate() != null) ? a.getTillDate().toString() : "", 
								(a.getBeginLife() != null) ? a.getBeginLife().toString() : "",
								(a.getEndLife() != null) ? a.getEndLife().toString() : "");
					if (++cnt % 10_000 == 0) {
						LOG.log(Level.INFO, "Wrote {0}", cnt);
					}
				}
				LOG.log(Level.INFO, "Wrote {0}", cnt);
			}
		}
	}
private void writeStreets ( Path xmlPath , Path csvPath ) throws IOException { try ( CsvWriter w = builder . build ( csvPath . resolve ( "streets.csv" ) , StandardCharsets . UTF_8 ) ) { for ( BestRegion reg : new BestRegion [ ] { BestRegion . BRUSSELS , BestRegion . FLANDERS , BestRegion . WALLONIA } ) { LOG . log ( Level . INFO , "Starting streets {0} " , reg . getName ( ) ) ; int cnt = 0 ; StreetnameReader reader = new StreetnameReader ( ) ; Stream < Street > streets = reader . read ( reg , xmlPath ) ; Iterator < Street > iter = streets . iterator ( ) ; while ( iter . hasNext ( ) ) { Street a = iter . next ( ) ; w . writeRow ( NsConverter . streetEncode ( a . getIDVersion ( ) ) , "1" , NsConverter . municipalityEncode ( a . getCity ( ) . getIDVersion ( ) ) , "1" , a . getName ( "nl" ) , a . getName ( "fr" ) , a . getName ( "de" ) , "" , "" , a . getStatus ( ) , ( a . getFromDate ( ) != null ) ? a . getFromDate ( ) . toString ( ) : "" , ( a . getTillDate ( ) != null ) ? a . getTillDate ( ) . toString ( ) : "" , ( a . getBeginLife ( ) != null ) ? a . getBeginLife ( ) . toString ( ) : "" , ( a . getEndLife ( ) != null ) ? a . getEndLife ( ) . toString ( ) : "" ) ; if ( ++ cnt % 10_000 == 0 ) { LOG . log ( Level . INFO , "Wrote {0}" , cnt ) ; } } LOG . log ( Level . INFO , "Wrote {0}" , cnt ) ; } } }
Load streets
Load streets