@@ -0,0 +1,2638 @@
+package com.equalize.xpi.af.modules.json;%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.util.ArrayList;%0A%0Aimport com.equalize.xpi.af.modules.util.AbstractModuleConverter;%0Aimport com.equalize.xpi.af.modules.util.AuditLogHelper;%0Aimport com.equalize.xpi.af.modules.util.DynamicConfigurationHelper;%0Aimport com.equalize.xpi.af.modules.util.ParameterHelper;%0Aimport com.equalize.xpi.util.converter.ConversionDOMOutput;%0Aimport com.equalize.xpi.util.converter.ConversionJSONInput;%0Aimport com.equalize.xpi.util.converter.Field;%0Aimport com.sap.aii.af.lib.mp.module.ModuleException;%0Aimport com.sap.engine.interfaces.messaging.api.Message;%0Aimport com.sap.engine.interfaces.messaging.api.auditlog.AuditLogStatus;%0A%0Apublic class JSON2XMLConverter extends AbstractModuleConverter %7B%0A%09private ConversionJSONInput jsonIn;%0A%09private ConversionDOMOutput domOut;%0A%09private String documentName;%0A%09private String documentNamespace;%0A%09private int indentFactor;%0A%09private ArrayList%3CField%3E inputContents;%0A%0A%09public JSON2XMLConverter(Message msg, ParameterHelper param, AuditLogHelper audit, DynamicConfigurationHelper dyncfg) %7B%0A%09%09super(msg, param, audit, dyncfg);%0A%09%7D%0A%0A%09@Override%0A%09public void retrieveModuleParameters() throws ModuleException %7B%0A%09%09this.documentName = this.param.getMandatoryParameter(%22documentName%22);%0A%09%09this.documentNamespace = this.param.getMandatoryParameter(%22documentNamespace%22);%0A%09%09this.indentFactor = this.param.getIntParameter(%22indentFactor%22);%0A%09%7D%0A%0A%09@Override%0A%09public void parseInput() throws ModuleException %7B%0A%09%09// Parse input JSON contents%0A%09%09String content = this.payload.getText();%0A%09%09this.jsonIn = new ConversionJSONInput(content);%0A%09%09this.audit.addLog(AuditLogStatus.SUCCESS, %22Parsing input JSON%22);%0A%09%09//this.inputContents = this.jsonIn.extractJSONContent();%0A%09%09this.inputContents = this.jsonIn.extractJSONContentArray();%0A%09%7D%0A%0A%09@Override%0A%09public byte%5B%5D generateOutput() throws ModuleException %7B%0A%09%09try %7B%0A%09%09%09// Create output converter and generate output DOM%0A%09%09%09this.domOut = new ConversionDOMOutput(this.documentName, this.documentNamespace);%0A%09%09%09this.audit.addLog(AuditLogStatus.SUCCESS, %22Constructing output XML%22);%09%0A%09%09%09%0A%09%09%09// Generate OutputStream from DOM%0A%09%09%09if(this.indentFactor %3E 0) %7B%0A%09%09%09%09this.domOut.setIndentFactor(this.indentFactor);%0A%09%09%09%09this.audit.addLog(AuditLogStatus.SUCCESS, %22Output XML will be indented%22);%0A%09%09%09%7D%0A%0A%09%09%09ByteArrayOutputStream baos = this.domOut.generateDOMOutput(this.inputContents);%0A%09%09%09this.audit.addLog(AuditLogStatus.SUCCESS, %22Conversion complete%22);%0A%09%09%09return baos.toByteArray();%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09this.audit.addLog(AuditLogStatus.ERROR, e.getMessage());%0A%09%09%09throw new ModuleException(e.getMessage(), e);%0A%09%09%7D%0A%09%7D%0A%7D%0A

Create JSON2XMLConverter.java