private void updateWeatherForecasts(Event e) throws InvalidInputException, NotFoundException { if (e.getStatus() != EventStatus.PLANNED) { return; } // Ask new weather forecasts List<WeatherForecast> newForecasts = weatherForecastFacade.askWeatherForecasts(e.getId()); boolean newForecastsGood = e.areForecastsGood(newForecasts); if (e.getWeatherForecasts() != null && e.getWeatherForecasts().size() != 0) { // Check good/ bad boolean currentForecastsGood = e.areCurrentForecastsGood(); // Disable current weather forecasts disableWeatherForecasts(e); // Produce notification if good -> bad, bad -> good if (newForecastsGood != currentForecastsGood) { // Produce notification notificationFacade.createNotificationForWeatherConditions(e.getId(), newForecastsGood); } } else if (!newForecastsGood) { // Produce notification notificationFacade.createNotificationForWeatherConditions(e.getId(), newForecastsGood); } // Update event with new forecasts e.setWeatherForecasts(newForecasts); weatherForecastFacade.save(newForecasts); if (!newForecastsGood && needsSuggestedScheduling(e)) { // TODO check suggested scheduling updateSuggestedScheduling(e); } }