// Path: step9_soap_message_logging_into_custom_elasticsearch_field/src/main/java/de/jonashackt/tutorial/transformation/GetCityForecastByZIPOutMapper.java
// public final class GetCityForecastByZIPOutMapper {
// 
// 	private static de.codecentric.namespace.weatherservice.general.ObjectFactory objectFactoryGeneral = new de.codecentric.namespace.weatherservice.general.ObjectFactory();
// 	private static de.codecentric.namespace.weatherservice.datatypes.ObjectFactory objectFactoryDatatypes = new de.codecentric.namespace.weatherservice.datatypes.ObjectFactory();
// 
// 	public static ForecastReturn mapGeneralOutlook2Forecast() {      
// 		ForecastReturn forecastReturn = objectFactoryGeneral.createForecastReturn();
// 		forecastReturn.setCity("Weimar");
// 		forecastReturn.setState("Deutschland");
// 		forecastReturn.setSuccess(true);
// 		forecastReturn.setWeatherStationCity("Weimar");
// 		forecastReturn.setForecastResult(generateForecastResult(forecastReturn.getCity()));
// 		return forecastReturn;
//     }
// 
// 
// 	private static ArrayOfForecast generateForecastResult(String city) {
// 		ArrayOfForecast forecastContainer = objectFactoryDatatypes.createArrayOfForecast();
// 		forecastContainer.getForecast().add(generateForecast(city));
// 		return forecastContainer;
// 	}
// 
// 
// 	private static Forecast generateForecast(String city) {
// 		Forecast forecast = objectFactoryDatatypes.createForecast();	
// 		forecast.setDate(generateCalendarFromNow());
// 		forecast.setDesciption("Vorhersage für " + city);
// 		forecast.setTemperatures(generateTemp());
// 		forecast.setProbabilityOfPrecipiation(generateRegenwahrscheinlichkeit());
// 		return forecast;
// 	}
// 
// 	
// 	private static POP generateRegenwahrscheinlichkeit() {
// 		POP pop = objectFactoryDatatypes.createPOP();
// 		pop.setDaytime("22%");
// 		pop.setNighttime("5000%");
// 		return pop;
// 	}
// 
// 
// 	private static Temp generateTemp() {
// 		Temp temp = objectFactoryDatatypes.createTemp();
// 		temp.setDaytimeHigh("90°");
// 		temp.setMorningLow("0°");
// 		return temp;
// 	}
// 
// 
// 	private static XMLGregorianCalendar generateCalendarFromNow() {
// 		GregorianCalendar gregCal = GregorianCalendar.from(ZonedDateTime.now());
// 		XMLGregorianCalendar xmlGregCal = null;
// 		try {
// 			xmlGregCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregCal);
// 		} catch (DatatypeConfigurationException exception) {
// 			//LOG.calenderMappingNotWorking(exception);
// 		}
// 		return xmlGregCal;
// 	}
// 	
// }


import de.codecentric.namespace.weatherservice.general.ForecastRequest;
import de.codecentric.namespace.weatherservice.general.ForecastReturn;
import de.jonashackt.tutorial.transformation.GetCityForecastByZIPOutMapper;
import org.springframework.stereotype.Component;
package de.jonashackt.tutorial.controller;


/*
 *  Example-Controller:
 *  This Class would be responsible for Mapping from Request to internal Datamodel (and backwards),
 *  for calling Backend-Services and handling Backend-Exceptions
 *  So it decouples the WSDL-generated Classes from the internal Classes - for when the former changes,
 *  nothing or only the mapping has to be changed
 */ 
@Component
public class WeatherServiceController {
 
    public ForecastReturn getCityForecastByZIP(ForecastRequest forecastRequest) {
	    /*
	     * We leave out inbound transformation, plausibility-checking, logging, backend-calls e.g.
	     * for the moment
	     */
// Path: step9_soap_message_logging_into_custom_elasticsearch_field/src/main/java/de/jonashackt/tutorial/transformation/GetCityForecastByZIPOutMapper.java
// public final class GetCityForecastByZIPOutMapper {
// 
// 	private static de.codecentric.namespace.weatherservice.general.ObjectFactory objectFactoryGeneral = new de.codecentric.namespace.weatherservice.general.ObjectFactory();
// 	private static de.codecentric.namespace.weatherservice.datatypes.ObjectFactory objectFactoryDatatypes = new de.codecentric.namespace.weatherservice.datatypes.ObjectFactory();
// 
// 	public static ForecastReturn mapGeneralOutlook2Forecast() {      
// 		ForecastReturn forecastReturn = objectFactoryGeneral.createForecastReturn();
// 		forecastReturn.setCity("Weimar");
// 		forecastReturn.setState("Deutschland");
// 		forecastReturn.setSuccess(true);
// 		forecastReturn.setWeatherStationCity("Weimar");
// 		forecastReturn.setForecastResult(generateForecastResult(forecastReturn.getCity()));
// 		return forecastReturn;
//     }
// 
// 
// 	private static ArrayOfForecast generateForecastResult(String city) {
// 		ArrayOfForecast forecastContainer = objectFactoryDatatypes.createArrayOfForecast();
// 		forecastContainer.getForecast().add(generateForecast(city));
// 		return forecastContainer;
// 	}
// 
// 
// 	private static Forecast generateForecast(String city) {
// 		Forecast forecast = objectFactoryDatatypes.createForecast();	
// 		forecast.setDate(generateCalendarFromNow());
// 		forecast.setDesciption("Vorhersage für " + city);
// 		forecast.setTemperatures(generateTemp());
// 		forecast.setProbabilityOfPrecipiation(generateRegenwahrscheinlichkeit());
// 		return forecast;
// 	}
// 
// 	
// 	private static POP generateRegenwahrscheinlichkeit() {
// 		POP pop = objectFactoryDatatypes.createPOP();
// 		pop.setDaytime("22%");
// 		pop.setNighttime("5000%");
// 		return pop;
// 	}
// 
// 
// 	private static Temp generateTemp() {
// 		Temp temp = objectFactoryDatatypes.createTemp();
// 		temp.setDaytimeHigh("90°");
// 		temp.setMorningLow("0°");
// 		return temp;
// 	}
// 
// 
// 	private static XMLGregorianCalendar generateCalendarFromNow() {
// 		GregorianCalendar gregCal = GregorianCalendar.from(ZonedDateTime.now());
// 		XMLGregorianCalendar xmlGregCal = null;
// 		try {
// 			xmlGregCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregCal);
// 		} catch (DatatypeConfigurationException exception) {
// 			//LOG.calenderMappingNotWorking(exception);
// 		}
// 		return xmlGregCal;
// 	}
// 	
// }


// Path: step10_simple_app_with_cxf-spring-boot-starter/src/main/java/de/jonashackt/tutorial/controller/WeatherServiceController.java
import de.codecentric.namespace.weatherservice.general.ForecastRequest;
import de.codecentric.namespace.weatherservice.general.ForecastReturn;
import de.jonashackt.tutorial.transformation.GetCityForecastByZIPOutMapper;
import org.springframework.stereotype.Component;

package de.jonashackt.tutorial.controller;


/*
 *  Example-Controller:
 *  This Class would be responsible for Mapping from Request to internal Datamodel (and backwards),
 *  for calling Backend-Services and handling Backend-Exceptions
 *  So it decouples the WSDL-generated Classes from the internal Classes - for when the former changes,
 *  nothing or only the mapping has to be changed
 */ 
@Component
public class WeatherServiceController {
 
    public ForecastReturn getCityForecastByZIP(ForecastRequest forecastRequest) {
	    /*
	     * We leave out inbound transformation, plausibility-checking, logging, backend-calls e.g.
	     * for the moment
	     */
        return GetCityForecastByZIPOutMapper.mapGeneralOutlook2Forecast();