java/webservice/src/main/java/be/bosa/dt/best/webservice/LookupResource.java
/**
	 * Cache the JSON rendering of all municipalities
	 * 
	 * @param ev 
	 */
Cache the JSON rendering of all municipalities

@param ev
Cache the JSON rendering of all municipalities @param ev
void onStart(@Observes StartupEvent ev) {               
        Log.info("Caching");
		Multi<Municipality> municipalities = repo.findMunicipalitiesAll();
		municipalities.subscribe().with(m -> {
			cache.put(m.id, JsonObject.mapFrom(m));
		});
		int size = cache.size();
		Log.infof("%d municipalities", size);
		Multi<MunicipalityPart> parts = repo.findMunicipalityPartsAll();
		parts.subscribe().with(mp -> {
			cache.put(mp.id, JsonObject.mapFrom(mp));
		});
		Log.infof("%d municipality parts", cache.size() - size);
		size = cache.size();
		Multi<PostalInfo> postals = repo.findPostalInfosAll();
		postals.subscribe().with(p -> {			
			cache.put(p.id, JsonObject.mapFrom(p));
		});
		Log.infof("%d postal info", cache.size() - size);
    }
void onStart ( @ Observes StartupEvent ev ) { Log . info ( "Caching" ) ; Multi < Municipality > municipalities = repo . findMunicipalitiesAll ( ) ; municipalities . subscribe ( ) . with ( m -> { cache . put ( m . id , JsonObject . mapFrom ( m ) ) ; } ) ; int size = cache . size ( ) ; Log . infof ( "%d municipalities" , size ) ; Multi < MunicipalityPart > parts = repo . findMunicipalityPartsAll ( ) ; parts . subscribe ( ) . with ( mp -> { cache . put ( mp . id , JsonObject . mapFrom ( mp ) ) ; } ) ; Log . infof ( "%d municipality parts" , cache . size ( ) - size ) ; size = cache . size ( ) ; Multi < PostalInfo > postals = repo . findPostalInfosAll ( ) ; postals . subscribe ( ) . with ( p -> { cache . put ( p . id , JsonObject . mapFrom ( p ) ) ; } ) ; Log . infof ( "%d postal info" , cache . size ( ) - size ) ; }
Cache the JSON rendering of all municipalities
Cache the JSON rendering of all municipalities