import org.milyn.Smooks;
import org.milyn.container.ExecutionContext;
import org.milyn.payload.StringResult;
-import org.onap.dcaegen2.ves.domain.VesEvent;
+import org.onap.dcaegen2.ves.domain.ves7_0.VesEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* @author kmalbari
*
*/
+
+
public class SmooksUtils {
- private final static Logger LOGGER = LoggerFactory.getLogger(SmooksUtils.class);
+ private static final Logger debugLogger = LoggerFactory.getLogger("debugLogger");
+ private static final Logger errorLogger = LoggerFactory.getLogger("errorLogger");
/**
* converts the incoming json using passed smooks instance and return the pojo representation of VES event
*/
public static VesEvent getTransformedObjectForInput(Smooks smooks, String incomingJsonString) {
- LOGGER.debug("Transforming json " + incomingJsonString);
+ debugLogger.info("Transforming incoming json " );
ExecutionContext executionContext = smooks.createExecutionContext();
- LOGGER.debug("Context created");
+ debugLogger.info("Context created");
Locale defaultLocale = Locale.getDefault();
Locale.setDefault(new Locale("en", "IE"));
StringResult result = new StringResult();
- // Configure the execution context to generate a report...
-// executionContext.setEventListener(new HtmlReportGenerator("target/report/report.html"));
-
- // Filter the input message to the outputWriter, using the execution context...
smooks.filterSource(executionContext, new StreamSource(new ByteArrayInputStream(incomingJsonString.getBytes(StandardCharsets.UTF_8))), result);
- LOGGER.debug("Transformed incoming json now");
+
Locale.setDefault(defaultLocale);
VesEvent vesEvent = (VesEvent) executionContext.getBeanContext().getBean("vesEvent");
- LOGGER.debug("Converted vesEvent from incoming json");
+ debugLogger.debug("consversion successful to VES Event");
return vesEvent;
}