use of pokeraidbot.domain.gym.GymRepository in project pokeraidbot by magnusmickelsson.
the class TestServerMain method getGymRepositoryForConfig.
public static GymRepository getGymRepositoryForConfig(LocaleService localeService, ServerConfigRepository serverConfigRepository) {
Map<String, Set<Gym>> gymsPerRegion = new HashMap<>();
final Map<String, Config> configMap = serverConfigRepository.getAllConfig();
System.out.println("Config has following servers: " + configMap.keySet());
for (String server : configMap.keySet()) {
final Config config = serverConfigRepository.getConfigForServer(server);
final String region = config.getRegion();
if (!gymsPerRegion.containsKey(region)) {
final Set<Gym> gymsInRegion = new CSVGymDataReader("/gyms_" + region + ".csv").readAll();
gymsPerRegion.put(region, gymsInRegion);
System.out.println("Loaded " + gymsInRegion.size() + " gyms for server " + server + ".");
}
}
return new GymRepository(gymsPerRegion, localeService);
}
Aggregations