Example usage for org.dom4j.io OutputFormat setNewLineAfterDeclaration

List of usage examples for org.dom4j.io OutputFormat setNewLineAfterDeclaration

Introduction

In this page you can find the example usage for org.dom4j.io OutputFormat setNewLineAfterDeclaration.

Prototype

public void setNewLineAfterDeclaration(boolean newLineAfterDeclaration) 

Source Link

Document

This will set whether a new line is printed after the XML declaration (assuming it is not supressed.)

Usage

From source file:au.com.acegi.xmlformat.XmlFormatPlugin.java

License:Apache License

private OutputFormat buildFormatter() {
    final OutputFormat fmt = createPrettyPrint();
    fmt.setAttributeQuoteCharacter(attributeQuoteChar);
    fmt.setEncoding(encoding);// w  w w  . j  a va 2s .c om
    fmt.setExpandEmptyElements(expandEmptyElements);
    fmt.setIndentSize(indentSize);
    fmt.setLineSeparator(determineLineSeparator());
    fmt.setNewLineAfterDeclaration(newLineAfterDeclaration);
    fmt.setNewLineAfterNTags(newLineAfterNTags);
    fmt.setNewlines(newlines);
    fmt.setOmitEncoding(omitEncoding);
    fmt.setPadText(padText);
    fmt.setSuppressDeclaration(suppressDeclaration);
    fmt.setTrimText(trimText);
    fmt.setXHTML(xhtml);
    return fmt;
}

From source file:be.hikage.maven.plugin.xmlmerge.MergeXmlMojo.java

License:Apache License

private void writeMergedXml(File baseFile, Document base, StringBuilder prologHeader) throws IOException {
    FileOutputStream fos = new FileOutputStream(baseFile);

    if (processProlog && prologHeader != null && StringUtils.isNotEmpty(prologHeader.toString())) {
        fos.write(prologHeader.toString().getBytes());
    }/*  w w w  . jav a 2  s.  c  om*/

    OutputFormat format = OutputFormat.createPrettyPrint();
    format.setSuppressDeclaration(true);
    format.setNewLineAfterDeclaration(false);
    XMLWriter writer = new XMLWriter(fos, format);
    writer.write(base);
    writer.flush();
    writer.close();

}

From source file:com.amalto.workbench.utils.XmlUtil.java

License:Open Source License

public static String format(Document document, OutputFormat format, String encoding) {

    StringWriter writer = new StringWriter();

    format.setEncoding(encoding);/*from   ww  w.  j  a  va  2s .  c  o m*/

    format.setNewLineAfterDeclaration(false);
    // format.setSuppressDeclaration(suppressDeclaration);

    XMLWriter xmlwriter = new XMLWriter(writer, format);

    String result = ""; //$NON-NLS-1$

    try {

        xmlwriter.write(document);
        result = writer.toString().replaceAll("<\\?xml.*?\\?>", "").trim();//$NON-NLS-1$//$NON-NLS-2$
    } catch (Exception e) {
        log.error(e.getMessage(), e);

    } finally {
        try {
            if (xmlwriter != null)
                xmlwriter.close();

            if (writer != null)
                writer.close();
        } catch (IOException e) {

        }
    }

    return result;
}

From source file:com.jswiff.xml.XMLWriter.java

License:Open Source License

/**
 * Writes the XML document generated from the SWF to a stream. If the
 * <code>format</code> flag is set, the output XML is formatted to make it
 * more readable.//from   w ww  .j a  va  2 s .c  om
 *
 * @param stream the target stream
 * @param format specifies whether to format the output XML
 *
 * @throws IOException if an I/O error occured
 */
public void write(OutputStream stream, boolean format) throws IOException {
    if (format) {
        OutputFormat formatter = OutputFormat.createPrettyPrint();
        formatter.setNewLineAfterDeclaration(false);
        formatter.setTrimText(false);
        org.dom4j.io.XMLWriter writer = new org.dom4j.io.XMLWriter(stream, formatter);
        writer.write(xmlDocument);
    } else {
        org.dom4j.io.XMLWriter writer = new org.dom4j.io.XMLWriter(stream);
        writer.write(xmlDocument);
    }
}

From source file:com.jswiff.xml.XMLWriter.java

License:Open Source License

/**
 * Writes the XML document generated from the SWF to a writer. If the
 * <code>format</code> flag is set, the output XML is formatted to make it
 * more readable./*from   w ww.  j  a va 2  s.c  om*/
 *
 * @param writer the target writer
 * @param format specifies whether to format the output XML
 *
 * @throws IOException if an I/O error occured
 */
public void write(Writer writer, boolean format) throws IOException {
    if (format) {
        OutputFormat formatter = OutputFormat.createPrettyPrint();
        formatter.setNewLineAfterDeclaration(false);
        formatter.setTrimText(false);
        org.dom4j.io.XMLWriter xmlWriter = new org.dom4j.io.XMLWriter(writer, formatter);
        xmlWriter.write(xmlDocument);
    } else {
        org.dom4j.io.XMLWriter xmlWriter = new org.dom4j.io.XMLWriter(writer);
        xmlWriter.write(xmlDocument);
    }
}

From source file:delphsim.model.Epidemia.java

License:Open Source License

/**
 * Guarda la informacin de esta epidemia en el archivo pasado como
 * parmetro, siguiendo el esquema del .xsd de la aplicacin.
 * @param archivoDestino El archivo destino donde se guardar el modelo.
 * @throws java.io.IOException Si hay problemas al escribir en disco.
 * @throws org.dom4j.DocumentException Si hay problemas al crear el objeto de tipo rbol.
 * @throws java.lang.Exception Si se produce algn otro problema.
 *//*from  w  ww .  ja v  a 2 s  .co  m*/
public void guardarXML(File archivoDestino) throws IOException, DocumentException, Exception {
    // Primero crear el documento dom4j con la informacin del modelo
    Document documento = DocumentHelper.createDocument();
    // Elemento raz epidemia
    Element elementoEpidemia = new DefaultElement("epidemia");
    documento.setRootElement(elementoEpidemia);
    elementoEpidemia.addAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    elementoEpidemia.addAttribute("xsi:noNamespaceSchemaLocation", "DelphSim1.18.xsd");
    elementoEpidemia.addAttribute("unidadTiempo", this.unidadTiempo);

    // Elementos parmetros
    if (this.parametros != null) {
        for (Parametro param : this.parametros) {
            Element elementoParametro = param.volcarAXML();
            elementoEpidemia.add(elementoParametro);
        }
    }

    // Elementos procesos
    if (this.procesos != null) {
        for (Proceso proc : this.procesos) {
            Element elementoProceso = proc.volcarAXML();
            elementoEpidemia.add(elementoProceso);
        }
    }

    // Elemento poblacin
    Element elementoPoblacion = this.poblacion.volcarAXML();
    elementoEpidemia.add(elementoPoblacion);

    // Elementos compartimentos
    for (Compartimento comp : this.compartimentos) {
        Element elementoCompartimento = comp.volcarAXML();
        elementoEpidemia.add(elementoCompartimento);
    }

    // Luego crear el formato, stream y escritor de la salida
    OutputFormat formato = OutputFormat.createPrettyPrint();
    formato.setEncoding("UTF-16");
    formato.setIndent("\t");
    formato.setNewLineAfterDeclaration(false);
    formato.setPadText(false);
    formato.setTrimText(true);
    formato.setXHTML(true);
    java.io.OutputStreamWriter salida = new java.io.OutputStreamWriter(
            new java.io.FileOutputStream(archivoDestino), "UTF-16");
    XMLWriter escritor = new XMLWriter(salida, formato);
    // Y escribir
    escritor.write(documento);
    escritor.close();
}

From source file:delphsim.model.Resultado.java

License:Open Source License

/**
 * Mtodo esttico que exporta los valores obtenidos tras la simulacin al
 * formato XML./*www. j  a va  2s .co m*/
 * @param destino El archivo de destino.
 * @param nombres Los nombres de las distintas columnas/funciones.
 * @param definiciones La definicin de cada columna/funcin.
 * @param temps Array con los archivos temporales de los cuales obtener los
 *              datos a exportar.
 * @param numPuntosTotal El nmero de puntos total que contienen los
 *                       archivos temporales.
 * @param numPuntosExportar El nmero de puntos que quiere obtener el usuario.
 * @throws java.io.IOException Si hubiera algn problema al crear el archivo en disco.
 */
public static void exportarComoXML(File destino, String[] nombres, String[] definiciones, File[] temps,
        long numPuntosTotal, long numPuntosExportar) throws IOException {
    // Crear el documento, el elemento 'raiz' y asignarlo
    org.dom4j.Document documento = DocumentHelper.createDocument();
    DefaultElement elementoResultado = new DefaultElement("resultado");
    documento.setRootElement(elementoResultado);

    // Creamos los bfers de lectura para leer los temporales
    BufferedReader[] buffers = new BufferedReader[temps.length];
    for (int i = 0; i < temps.length; i++) {
        buffers[i] = new BufferedReader(new FileReader(temps[i]));
    }
    // Calculamos cada cuanto tenemos que guardar un punto
    double cadaCuanto;
    if (numPuntosTotal == numPuntosExportar) {
        cadaCuanto = 1.0d;
    } else {
        cadaCuanto = new Double(numPuntosTotal) / new Double(numPuntosExportar - 1);
    }
    long siguientePuntoExportar = 0;
    long contadorNumPuntoLeido = 0;
    long contadorNumPuntosExportados = 0;
    // Comenzamos a leer los temporales aadiendo elementos al documento
    String[] valores = new String[buffers.length];
    for (int i = 0; i < buffers.length; i++) {
        valores[i] = buffers[i].readLine();
    }
    // En el momento en que se lee un null, se termina
    while (valores[0] != null) {
        // Para cada punto que haya que exportar
        if (siguientePuntoExportar == contadorNumPuntoLeido) {
            DefaultElement nuevaFila = new DefaultElement("fila");
            // Para el tiempo, nuevo elemento, su valor y aadirlo a la fila
            DefaultElement elementoTiempo = new DefaultElement("Tiempo");
            elementoTiempo.setText(valores[0]);
            nuevaFila.add(elementoTiempo);
            // Lo mismo para cada linea, pero ademas con nombre y definicin
            for (int i = 1; i < valores.length; i++) {
                DefaultElement elementoLinea = new DefaultElement("Lnea" + i);
                elementoLinea.add(new DefaultAttribute("nombre", nombres[i]));
                elementoLinea.add(new DefaultAttribute("definicion", definiciones[i]));
                elementoLinea.setText(valores[i]);
                nuevaFila.add(elementoLinea);
            }
            // Y aadimos la nueva fila
            elementoResultado.add(nuevaFila);
            // Calculamos el siguiente punto a exportar
            contadorNumPuntosExportados++;
            siguientePuntoExportar = Math.round(cadaCuanto * contadorNumPuntosExportados);
            if (siguientePuntoExportar >= numPuntosTotal) {
                siguientePuntoExportar = numPuntosTotal - 1;
            }
        }
        // Leemos la siguiente lnea de los ficheros
        for (int i = 0; i < buffers.length; i++) {
            valores[i] = buffers[i].readLine();
        }
        contadorNumPuntoLeido++;
    }
    // Cerramos los bfers y el archivo de salida
    for (int i = 0; i < buffers.length; i++) {
        buffers[i].close();
    }
    // Imprimimos el documento como XML
    OutputFormat formato = OutputFormat.createPrettyPrint();
    formato.setEncoding("UTF-16");
    formato.setIndent("\t");
    formato.setNewLineAfterDeclaration(false);
    formato.setPadText(false);
    formato.setTrimText(true);
    formato.setXHTML(true);
    OutputStreamWriter salida = new OutputStreamWriter(new FileOutputStream(destino), "UTF-16");
    XMLWriter escritor = new XMLWriter(salida, formato);
    escritor.write(documento);
    escritor.flush();
    escritor.close();
}

From source file:epa_eds.epa_prototype_0_1.EPA_Prototype.java

License:Apache License

public void tFileInputExcel_2Process(final java.util.Map<String, Object> globalMap) throws TalendException {
    globalMap.put("tFileInputExcel_2_SUBPROCESS_STATE", 0);

    final boolean execStat = this.execStat;
    String currentVirtualComponent = null;

    String iterateId = "";

    String currentComponent = "";
    java.util.Map<String, Object> resourceMap = new java.util.HashMap<String, Object>();

    try {/*from w  ww  . ja v a  2s  . co m*/

        String currentMethodName = new java.lang.Exception().getStackTrace()[0].getMethodName();
        boolean resumeIt = currentMethodName.equals(resumeEntryMethodName);
        if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start
            // the
            // resume
            globalResumeTicket = true;

            tFileInputExcel_1Process(globalMap);
            tFileInputExcel_3Process(globalMap);
            tFileInputExcel_4Process(globalMap);
            tFileInputExcel_5Process(globalMap);

            row1Struct row1 = new row1Struct();
            row7Struct row7 = new row7Struct();
            FLIGHT_OutStruct FLIGHT_Out = new FLIGHT_OutStruct();
            final_outputStruct final_output = new final_outputStruct();
            row11Struct row11 = new row11Struct();

            /**
             * [tAggregateRow_2_AGGOUT begin ] start
             */

            ok_Hash.put("tAggregateRow_2_AGGOUT", false);
            start_Hash.put("tAggregateRow_2_AGGOUT", System.currentTimeMillis());

            currentVirtualComponent = "tAggregateRow_2";

            currentComponent = "tAggregateRow_2_AGGOUT";

            int tos_count_tAggregateRow_2_AGGOUT = 0;

            // ------------

            java.util.Map hashAggreg_tAggregateRow_2 = new java.util.HashMap();

            // ------------

            class UtilClass_tAggregateRow_2 { // G_OutBegin_AggR_144

                public double sd(Double[] data) {
                    final int n = data.length;
                    if (n < 2) {
                        return Double.NaN;
                    }
                    double d1 = 0d;
                    double d2 = 0d;

                    for (int i = 0; i < data.length; i++) {
                        d1 += (data[i] * data[i]);
                        d2 += data[i];
                    }

                    return Math.sqrt((n * d1 - d2 * d2) / n / (n - 1));
                }

                public void checkedIADD(byte a, byte b, boolean checkTypeOverFlow, boolean checkUlp) {
                    byte r = (byte) (a + b);
                    if (checkTypeOverFlow && ((a ^ r) & (b ^ r)) < 0) {
                        throw new RuntimeException(buildOverflowMessage(String.valueOf(a), String.valueOf(b),
                                "'short/Short'", "'int/Integer'"));
                    }
                }

                public void checkedIADD(short a, short b, boolean checkTypeOverFlow, boolean checkUlp) {
                    short r = (short) (a + b);
                    if (checkTypeOverFlow && ((a ^ r) & (b ^ r)) < 0) {
                        throw new RuntimeException(buildOverflowMessage(String.valueOf(a), String.valueOf(b),
                                "'int/Integer'", "'short/Short'"));
                    }
                }

                public void checkedIADD(int a, int b, boolean checkTypeOverFlow, boolean checkUlp) {
                    int r = a + b;
                    if (checkTypeOverFlow && ((a ^ r) & (b ^ r)) < 0) {
                        throw new RuntimeException(buildOverflowMessage(String.valueOf(a), String.valueOf(b),
                                "'long/Long'", "'int/Integer'"));
                    }
                }

                public void checkedIADD(long a, long b, boolean checkTypeOverFlow, boolean checkUlp) {
                    long r = a + b;
                    if (checkTypeOverFlow && ((a ^ r) & (b ^ r)) < 0) {
                        throw new RuntimeException(buildOverflowMessage(String.valueOf(a), String.valueOf(b),
                                "'BigDecimal'", "'long/Long'"));
                    }
                }

                public void checkedIADD(float a, float b, boolean checkTypeOverFlow, boolean checkUlp) {

                    if (checkUlp) {
                        float minAddedValue = Math.ulp(a);
                        if (minAddedValue > Math.abs(b)) {
                            throw new RuntimeException(buildPrecisionMessage(String.valueOf(a),
                                    String.valueOf(b), "'double' or 'BigDecimal'", "'float/Float'"));
                        }
                    }

                    if (checkTypeOverFlow && ((double) a + (double) b > (double) Float.MAX_VALUE)
                            || ((double) a + (double) b < (double) -Float.MAX_VALUE)) {
                        throw new RuntimeException(buildOverflowMessage(String.valueOf(a), String.valueOf(b),
                                "'double' or 'BigDecimal'", "'float/Float'"));
                    }
                }

                public void checkedIADD(double a, double b, boolean checkTypeOverFlow, boolean checkUlp) {

                    if (checkUlp) {
                        double minAddedValue = Math.ulp(a);
                        if (minAddedValue > Math.abs(b)) {
                            throw new RuntimeException(buildPrecisionMessage(String.valueOf(a),
                                    String.valueOf(a), "'BigDecimal'", "'double/Double'"));
                        }
                    }

                    if (checkTypeOverFlow && (a + b > (double) Double.MAX_VALUE)
                            || (a + b < -Double.MAX_VALUE)) {
                        throw new RuntimeException(buildOverflowMessage(String.valueOf(a), String.valueOf(b),
                                "'BigDecimal'", "'double/Double'"));
                    }
                }

                public void checkedIADD(double a, byte b, boolean checkTypeOverFlow, boolean checkUlp) {

                    if (checkTypeOverFlow && (a + b > (double) Double.MAX_VALUE)
                            || (a + b < -Double.MAX_VALUE)) {
                        throw new RuntimeException(buildOverflowMessage(String.valueOf(a), String.valueOf(b),
                                "'BigDecimal'", "'double/Double'"));
                    }
                }

                public void checkedIADD(double a, short b, boolean checkTypeOverFlow, boolean checkUlp) {

                    if (checkTypeOverFlow && (a + b > (double) Double.MAX_VALUE)
                            || (a + b < -Double.MAX_VALUE)) {
                        throw new RuntimeException(buildOverflowMessage(String.valueOf(a), String.valueOf(b),
                                "'BigDecimal'", "'double/Double'"));
                    }
                }

                public void checkedIADD(double a, int b, boolean checkTypeOverFlow, boolean checkUlp) {

                    if (checkTypeOverFlow && (a + b > (double) Double.MAX_VALUE)
                            || (a + b < -Double.MAX_VALUE)) {
                        throw new RuntimeException(buildOverflowMessage(String.valueOf(a), String.valueOf(b),
                                "'BigDecimal'", "'double/Double'"));
                    }
                }

                public void checkedIADD(double a, float b, boolean checkTypeOverFlow, boolean checkUlp) {

                    if (checkUlp) {
                        double minAddedValue = Math.ulp(a);
                        if (minAddedValue > Math.abs(b)) {
                            throw new RuntimeException(buildPrecisionMessage(String.valueOf(a),
                                    String.valueOf(a), "'BigDecimal'", "'double/Double'"));
                        }
                    }

                    if (checkTypeOverFlow && (a + b > (double) Double.MAX_VALUE)
                            || (a + b < -Double.MAX_VALUE)) {
                        throw new RuntimeException(buildOverflowMessage(String.valueOf(a), String.valueOf(b),
                                "'BigDecimal'", "'double/Double'"));
                    }
                }

                private String buildOverflowMessage(String a, String b, String advicedTypes,
                        String originalType) {
                    return "Type overflow when adding " + b + " to " + a
                            + ", to resolve this problem, increase the precision by using " + advicedTypes
                            + " type in place of " + originalType + ".";
                }

                private String buildPrecisionMessage(String a, String b, String advicedTypes,
                        String originalType) {
                    return "The double precision is unsufficient to add the value " + b + " to " + a
                            + ", to resolve this problem, increase the precision by using " + advicedTypes
                            + " type in place of " + originalType + ".";
                }

            } // G_OutBegin_AggR_144

            UtilClass_tAggregateRow_2 utilClass_tAggregateRow_2 = new UtilClass_tAggregateRow_2();

            class AggOperationStruct_tAggregateRow_2 { // G_OutBegin_AggR_100

                private static final int DEFAULT_HASHCODE = 1;
                private static final int PRIME = 31;
                private int hashCode = DEFAULT_HASHCODE;
                public boolean hashCodeDirty = true;

                Integer reporting_year;
                String state;
                BigDecimal ghg_quantity_sum;

                @Override
                public int hashCode() {
                    if (this.hashCodeDirty) {
                        final int prime = PRIME;
                        int result = DEFAULT_HASHCODE;

                        result = prime * result
                                + ((this.reporting_year == null) ? 0 : this.reporting_year.hashCode());

                        result = prime * result + ((this.state == null) ? 0 : this.state.hashCode());

                        this.hashCode = result;
                        this.hashCodeDirty = false;
                    }
                    return this.hashCode;
                }

                @Override
                public boolean equals(Object obj) {
                    if (this == obj)
                        return true;
                    if (obj == null)
                        return false;
                    if (getClass() != obj.getClass())
                        return false;
                    final AggOperationStruct_tAggregateRow_2 other = (AggOperationStruct_tAggregateRow_2) obj;

                    if (this.reporting_year == null) {
                        if (other.reporting_year != null)
                            return false;
                    } else if (!this.reporting_year.equals(other.reporting_year))
                        return false;

                    if (this.state == null) {
                        if (other.state != null)
                            return false;
                    } else if (!this.state.equals(other.state))
                        return false;

                    return true;
                }

            } // G_OutBegin_AggR_100

            AggOperationStruct_tAggregateRow_2 operation_result_tAggregateRow_2 = null;
            AggOperationStruct_tAggregateRow_2 operation_finder_tAggregateRow_2 = new AggOperationStruct_tAggregateRow_2();
            java.util.Map<AggOperationStruct_tAggregateRow_2, AggOperationStruct_tAggregateRow_2> hash_tAggregateRow_2 = new java.util.HashMap<AggOperationStruct_tAggregateRow_2, AggOperationStruct_tAggregateRow_2>();

            /**
             * [tAggregateRow_2_AGGOUT begin ] stop
             */

            /**
             * [tFileInputExcel_2 begin ] start
             */

            ok_Hash.put("tFileInputExcel_2", false);
            start_Hash.put("tFileInputExcel_2", System.currentTimeMillis());

            currentComponent = "tFileInputExcel_2";

            int tos_count_tFileInputExcel_2 = 0;

            class RegexUtil_tFileInputExcel_2 {

                public java.util.List<jxl.Sheet> getSheets(jxl.Workbook workbook, String oneSheetName,
                        boolean useRegex) {

                    java.util.List<jxl.Sheet> list = new java.util.ArrayList<jxl.Sheet>();

                    if (useRegex) {// this part process the regex issue

                        jxl.Sheet[] sheets = workbook.getSheets();
                        java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(oneSheetName);
                        for (int i = 0; i < sheets.length; i++) {
                            String sheetName = sheets[i].getName();
                            java.util.regex.Matcher matcher = pattern.matcher(sheetName);
                            if (matcher.matches()) {
                                jxl.Sheet sheet = workbook.getSheet(sheetName);
                                if (sheet != null) {
                                    list.add(sheet);
                                }
                            }
                        }

                    } else {
                        jxl.Sheet sheet = workbook.getSheet(oneSheetName);
                        if (sheet != null) {
                            list.add(sheet);
                        }

                    }

                    return list;
                }

                public java.util.List<jxl.Sheet> getSheets(jxl.Workbook workbook, int index, boolean useRegex) {
                    java.util.List<jxl.Sheet> list = new java.util.ArrayList<jxl.Sheet>();
                    jxl.Sheet sheet = workbook.getSheet(index);
                    if (sheet != null) {
                        list.add(sheet);
                    }
                    return list;
                }

            }

            RegexUtil_tFileInputExcel_2 regexUtil_tFileInputExcel_2 = new RegexUtil_tFileInputExcel_2();
            final jxl.WorkbookSettings workbookSettings_tFileInputExcel_2 = new jxl.WorkbookSettings();
            workbookSettings_tFileInputExcel_2.setDrawingsDisabled(true);
            workbookSettings_tFileInputExcel_2.setEncoding("ISO-8859-15");

            Object source_tFileInputExcel_2 = context.recv_dir + "/FLIGHT 2011 Power Plant Extract.xls";
            final jxl.Workbook workbook_tFileInputExcel_2;

            java.io.InputStream toClose_tFileInputExcel_2 = null;
            java.io.BufferedInputStream buffIStreamtFileInputExcel_2 = null;
            try {
                if (source_tFileInputExcel_2 instanceof java.io.InputStream) {
                    toClose_tFileInputExcel_2 = (java.io.InputStream) source_tFileInputExcel_2;
                    buffIStreamtFileInputExcel_2 = new java.io.BufferedInputStream(toClose_tFileInputExcel_2);
                    workbook_tFileInputExcel_2 = jxl.Workbook.getWorkbook(buffIStreamtFileInputExcel_2,
                            workbookSettings_tFileInputExcel_2);
                } else if (source_tFileInputExcel_2 instanceof String) {
                    toClose_tFileInputExcel_2 = new java.io.FileInputStream(
                            source_tFileInputExcel_2.toString());
                    buffIStreamtFileInputExcel_2 = new java.io.BufferedInputStream(toClose_tFileInputExcel_2);
                    workbook_tFileInputExcel_2 = jxl.Workbook.getWorkbook(buffIStreamtFileInputExcel_2,
                            workbookSettings_tFileInputExcel_2);
                } else {
                    workbook_tFileInputExcel_2 = null;
                    throw new java.lang.Exception(
                            "The data source should be specified as Inputstream or File Path!");
                }
            } finally {
                try {
                    if (buffIStreamtFileInputExcel_2 != null) {
                        buffIStreamtFileInputExcel_2.close();
                    }
                } catch (Exception e) {
                }
            }
            try {
                java.util.List<jxl.Sheet> sheetList_tFileInputExcel_2 = new java.util.ArrayList<jxl.Sheet>();
                sheetList_tFileInputExcel_2.addAll(regexUtil_tFileInputExcel_2
                        .getSheets(workbook_tFileInputExcel_2, "FLIGHT Facilities and GHG Quant", false));
                if (sheetList_tFileInputExcel_2.size() <= 0) {
                    throw new RuntimeException("Special sheets not exist!");
                }

                java.util.List<jxl.Sheet> sheet_FilterNullList_tFileInputExcel_2 = new java.util.ArrayList<jxl.Sheet>();
                for (jxl.Sheet sheet_FilterNull_tFileInputExcel_2 : sheetList_tFileInputExcel_2) {
                    if (sheet_FilterNull_tFileInputExcel_2.getRows() > 0) {
                        sheet_FilterNullList_tFileInputExcel_2.add(sheet_FilterNull_tFileInputExcel_2);
                    }
                }
                sheetList_tFileInputExcel_2 = sheet_FilterNullList_tFileInputExcel_2;
                if (sheetList_tFileInputExcel_2.size() > 0) {
                    int nb_line_tFileInputExcel_2 = 0;

                    int begin_line_tFileInputExcel_2 = 6;

                    int footer_input_tFileInputExcel_2 = 0;

                    int end_line_tFileInputExcel_2 = 0;
                    for (jxl.Sheet sheet_tFileInputExcel_2 : sheetList_tFileInputExcel_2) {
                        end_line_tFileInputExcel_2 += sheet_tFileInputExcel_2.getRows();
                    }
                    end_line_tFileInputExcel_2 -= footer_input_tFileInputExcel_2;
                    int limit_tFileInputExcel_2 = -1;
                    int start_column_tFileInputExcel_2 = 1 - 1;
                    int end_column_tFileInputExcel_2 = sheetList_tFileInputExcel_2.get(0).getColumns();
                    jxl.Cell[] row_tFileInputExcel_2 = null;
                    jxl.Sheet sheet_tFileInputExcel_2 = sheetList_tFileInputExcel_2.get(0);
                    int rowCount_tFileInputExcel_2 = 0;
                    int sheetIndex_tFileInputExcel_2 = 0;
                    int currentRows_tFileInputExcel_2 = sheetList_tFileInputExcel_2.get(0).getRows();

                    // for the number format
                    java.text.DecimalFormat df_tFileInputExcel_2 = new java.text.DecimalFormat(
                            "#.####################################");
                    char separatorChar_tFileInputExcel_2 = df_tFileInputExcel_2.getDecimalFormatSymbols()
                            .getDecimalSeparator();

                    for (int i_tFileInputExcel_2 = begin_line_tFileInputExcel_2; i_tFileInputExcel_2 < end_line_tFileInputExcel_2; i_tFileInputExcel_2++) {

                        int emptyColumnCount_tFileInputExcel_2 = 0;

                        if (limit_tFileInputExcel_2 != -1
                                && nb_line_tFileInputExcel_2 >= limit_tFileInputExcel_2) {
                            break;
                        }

                        while (i_tFileInputExcel_2 >= rowCount_tFileInputExcel_2
                                + currentRows_tFileInputExcel_2) {
                            rowCount_tFileInputExcel_2 += currentRows_tFileInputExcel_2;
                            sheet_tFileInputExcel_2 = sheetList_tFileInputExcel_2
                                    .get(++sheetIndex_tFileInputExcel_2);
                            currentRows_tFileInputExcel_2 = sheet_tFileInputExcel_2.getRows();
                        }
                        if (rowCount_tFileInputExcel_2 <= i_tFileInputExcel_2) {
                            row_tFileInputExcel_2 = sheet_tFileInputExcel_2
                                    .getRow(i_tFileInputExcel_2 - rowCount_tFileInputExcel_2);
                        }
                        globalMap.put("tFileInputExcel_2_CURRENT_SHEET", sheet_tFileInputExcel_2.getName());
                        row1 = null;
                        int tempRowLength_tFileInputExcel_2 = 13;

                        int columnIndex_tFileInputExcel_2 = 0;

                        //
                        // end%>

                        String[] temp_row_tFileInputExcel_2 = new String[tempRowLength_tFileInputExcel_2];
                        int actual_end_column_tFileInputExcel_2 = end_column_tFileInputExcel_2 > row_tFileInputExcel_2.length
                                ? row_tFileInputExcel_2.length
                                : end_column_tFileInputExcel_2;
                        for (int i = 0; i < tempRowLength_tFileInputExcel_2; i++) {

                            if (i + start_column_tFileInputExcel_2 < actual_end_column_tFileInputExcel_2) {

                                jxl.Cell cell_tFileInputExcel_2 = row_tFileInputExcel_2[i
                                        + start_column_tFileInputExcel_2];
                                temp_row_tFileInputExcel_2[i] = cell_tFileInputExcel_2.getContents();

                            } else {
                                temp_row_tFileInputExcel_2[i] = "";
                            }
                        }

                        boolean whetherReject_tFileInputExcel_2 = false;
                        row1 = new row1Struct();
                        int curColNum_tFileInputExcel_2 = -1;
                        String curColName_tFileInputExcel_2 = "";
                        try {
                            columnIndex_tFileInputExcel_2 = 0;

                            if (temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2].length() > 0) {
                                curColNum_tFileInputExcel_2 = columnIndex_tFileInputExcel_2
                                        + start_column_tFileInputExcel_2 + 1;
                                curColName_tFileInputExcel_2 = "reporting_year";
                                row1.reporting_year = ParserUtils.parseTo_Integer(
                                        temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2]);
                            } else {
                                row1.reporting_year = null;
                                emptyColumnCount_tFileInputExcel_2++;
                            }
                            columnIndex_tFileInputExcel_2 = 1;

                            if (temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2].length() > 0) {
                                curColNum_tFileInputExcel_2 = columnIndex_tFileInputExcel_2
                                        + start_column_tFileInputExcel_2 + 1;
                                curColName_tFileInputExcel_2 = "facility_name";
                                row1.facility_name = temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2];
                            } else {
                                row1.facility_name = null;
                                emptyColumnCount_tFileInputExcel_2++;
                            }
                            columnIndex_tFileInputExcel_2 = 2;

                            if (temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2].length() > 0) {
                                curColNum_tFileInputExcel_2 = columnIndex_tFileInputExcel_2
                                        + start_column_tFileInputExcel_2 + 1;
                                curColName_tFileInputExcel_2 = "ghgrp_id";
                                row1.ghgrp_id = ParserUtils.parseTo_Integer(
                                        temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2]);
                            } else {
                                row1.ghgrp_id = null;
                                emptyColumnCount_tFileInputExcel_2++;
                            }
                            columnIndex_tFileInputExcel_2 = 3;

                            if (temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2].length() > 0) {
                                curColNum_tFileInputExcel_2 = columnIndex_tFileInputExcel_2
                                        + start_column_tFileInputExcel_2 + 1;
                                curColName_tFileInputExcel_2 = "reported_address";
                                row1.reported_address = temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2];
                            } else {
                                row1.reported_address = null;
                                emptyColumnCount_tFileInputExcel_2++;
                            }
                            columnIndex_tFileInputExcel_2 = 4;

                            if (temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2].length() > 0) {
                                curColNum_tFileInputExcel_2 = columnIndex_tFileInputExcel_2
                                        + start_column_tFileInputExcel_2 + 1;
                                curColName_tFileInputExcel_2 = "latitude";
                                row1.latitude = ParserUtils.parseTo_Float(
                                        temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2]);
                            } else {
                                row1.latitude = null;
                                emptyColumnCount_tFileInputExcel_2++;
                            }
                            columnIndex_tFileInputExcel_2 = 5;

                            if (temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2].length() > 0) {
                                curColNum_tFileInputExcel_2 = columnIndex_tFileInputExcel_2
                                        + start_column_tFileInputExcel_2 + 1;
                                curColName_tFileInputExcel_2 = "longitude";
                                row1.longitude = ParserUtils.parseTo_Float(
                                        temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2]);
                            } else {
                                row1.longitude = null;
                                emptyColumnCount_tFileInputExcel_2++;
                            }
                            columnIndex_tFileInputExcel_2 = 6;

                            if (temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2].length() > 0) {
                                curColNum_tFileInputExcel_2 = columnIndex_tFileInputExcel_2
                                        + start_column_tFileInputExcel_2 + 1;
                                curColName_tFileInputExcel_2 = "city_name";
                                row1.city_name = temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2];
                            } else {
                                row1.city_name = null;
                                emptyColumnCount_tFileInputExcel_2++;
                            }
                            columnIndex_tFileInputExcel_2 = 7;

                            if (temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2].length() > 0) {
                                curColNum_tFileInputExcel_2 = columnIndex_tFileInputExcel_2
                                        + start_column_tFileInputExcel_2 + 1;
                                curColName_tFileInputExcel_2 = "county_name";
                                row1.county_name = temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2];
                            } else {
                                row1.county_name = null;
                                emptyColumnCount_tFileInputExcel_2++;
                            }
                            columnIndex_tFileInputExcel_2 = 8;

                            if (temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2].length() > 0) {
                                curColNum_tFileInputExcel_2 = columnIndex_tFileInputExcel_2
                                        + start_column_tFileInputExcel_2 + 1;
                                curColName_tFileInputExcel_2 = "state";
                                row1.state = temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2];
                            } else {
                                row1.state = null;
                                emptyColumnCount_tFileInputExcel_2++;
                            }
                            columnIndex_tFileInputExcel_2 = 9;

                            if (temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2].length() > 0) {
                                curColNum_tFileInputExcel_2 = columnIndex_tFileInputExcel_2
                                        + start_column_tFileInputExcel_2 + 1;
                                curColName_tFileInputExcel_2 = "zip";
                                row1.zip = temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2];
                            } else {
                                row1.zip = null;
                                emptyColumnCount_tFileInputExcel_2++;
                            }
                            columnIndex_tFileInputExcel_2 = 10;

                            if (temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2].length() > 0) {
                                curColNum_tFileInputExcel_2 = columnIndex_tFileInputExcel_2
                                        + start_column_tFileInputExcel_2 + 1;
                                curColName_tFileInputExcel_2 = "parent_companies";
                                row1.parent_companies = temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2];
                            } else {
                                row1.parent_companies = null;
                                emptyColumnCount_tFileInputExcel_2++;
                            }
                            columnIndex_tFileInputExcel_2 = 11;

                            if (temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2].length() > 0) {
                                curColNum_tFileInputExcel_2 = columnIndex_tFileInputExcel_2
                                        + start_column_tFileInputExcel_2 + 1;
                                curColName_tFileInputExcel_2 = "ghg_quantity";
                                row1.ghg_quantity = ParserUtils.parseTo_BigDecimal(
                                        temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2]);
                            } else {
                                row1.ghg_quantity = null;
                                emptyColumnCount_tFileInputExcel_2++;
                            }
                            columnIndex_tFileInputExcel_2 = 12;

                            if (temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2].length() > 0) {
                                curColNum_tFileInputExcel_2 = columnIndex_tFileInputExcel_2
                                        + start_column_tFileInputExcel_2 + 1;
                                curColName_tFileInputExcel_2 = "sub_parts";
                                row1.sub_parts = temp_row_tFileInputExcel_2[columnIndex_tFileInputExcel_2];
                            } else {
                                row1.sub_parts = null;
                                emptyColumnCount_tFileInputExcel_2++;
                            }
                            nb_line_tFileInputExcel_2++;

                        } catch (java.lang.Exception e) {
                            whetherReject_tFileInputExcel_2 = true;
                            System.err.println(e.getMessage());
                            row1 = null;
                        }

                        /**
                         * [tFileInputExcel_2 begin ] stop
                         */

                        /**
                         * [tFileInputExcel_2 main ] start
                         */

                        currentComponent = "tFileInputExcel_2";

                        tos_count_tFileInputExcel_2++;

                        /**
                         * [tFileInputExcel_2 main ] stop
                         */
                        // Start of branch "row1"
                        if (row1 != null) {

                            /**
                             * [tAggregateRow_2_AGGOUT main ] start
                             */

                            currentVirtualComponent = "tAggregateRow_2";

                            currentComponent = "tAggregateRow_2_AGGOUT";

                            operation_finder_tAggregateRow_2.reporting_year = row1.reporting_year;
                            operation_finder_tAggregateRow_2.state = row1.state;

                            operation_finder_tAggregateRow_2.hashCodeDirty = true;

                            operation_result_tAggregateRow_2 = hash_tAggregateRow_2
                                    .get(operation_finder_tAggregateRow_2);

                            if (operation_result_tAggregateRow_2 == null) { // G_OutMain_AggR_001

                                operation_result_tAggregateRow_2 = new AggOperationStruct_tAggregateRow_2();

                                operation_result_tAggregateRow_2.reporting_year = operation_finder_tAggregateRow_2.reporting_year;
                                operation_result_tAggregateRow_2.state = operation_finder_tAggregateRow_2.state;

                                hash_tAggregateRow_2.put(operation_result_tAggregateRow_2,
                                        operation_result_tAggregateRow_2);

                            } // G_OutMain_AggR_001

                            if (operation_result_tAggregateRow_2.ghg_quantity_sum == null) {
                                operation_result_tAggregateRow_2.ghg_quantity_sum = new BigDecimal(0);
                            }
                            operation_result_tAggregateRow_2.ghg_quantity_sum = operation_result_tAggregateRow_2.ghg_quantity_sum
                                    .add(new BigDecimal(String.valueOf(row1.ghg_quantity)));

                            tos_count_tAggregateRow_2_AGGOUT++;

                            /**
                             * [tAggregateRow_2_AGGOUT main ] stop
                             */

                        } // End of branch "row1"

                        /**
                         * [tFileInputExcel_2 end ] start
                         */

                        currentComponent = "tFileInputExcel_2";

                    }

                    globalMap.put("tFileInputExcel_2_NB_LINE", nb_line_tFileInputExcel_2);

                }

            } finally {

                if (!(source_tFileInputExcel_2 instanceof java.io.InputStream)) {
                    workbook_tFileInputExcel_2.close();
                }

            }

            ok_Hash.put("tFileInputExcel_2", true);
            end_Hash.put("tFileInputExcel_2", System.currentTimeMillis());

            /**
             * [tFileInputExcel_2 end ] stop
             */

            /**
             * [tAggregateRow_2_AGGOUT end ] start
             */

            currentVirtualComponent = "tAggregateRow_2";

            currentComponent = "tAggregateRow_2_AGGOUT";

            ok_Hash.put("tAggregateRow_2_AGGOUT", true);
            end_Hash.put("tAggregateRow_2_AGGOUT", System.currentTimeMillis());

            /**
             * [tAggregateRow_2_AGGOUT end ] stop
             */

            /**
             * [tSortRow_1_SortOut begin ] start
             */

            ok_Hash.put("tSortRow_1_SortOut", false);
            start_Hash.put("tSortRow_1_SortOut", System.currentTimeMillis());

            currentVirtualComponent = "tSortRow_1";

            currentComponent = "tSortRow_1_SortOut";

            int tos_count_tSortRow_1_SortOut = 0;

            class Comparablefinal_outputStruct extends final_outputStruct
                    implements Comparable<Comparablefinal_outputStruct> {

                public int compareTo(Comparablefinal_outputStruct other) {

                    if (this.state == null && other.state != null) {
                        return -1;

                    } else if (this.state != null && other.state == null) {
                        return 1;

                    } else if (this.state != null && other.state != null) {
                        if (!this.state.equals(other.state)) {
                            return this.state.compareTo(other.state);
                        }
                    }
                    return 0;
                }
            }

            java.util.List<Comparablefinal_outputStruct> list_tSortRow_1_SortOut = new java.util.ArrayList<Comparablefinal_outputStruct>();

            /**
             * [tSortRow_1_SortOut begin ] stop
             */

            /**
             * [tMap_2 begin ] start
             */

            ok_Hash.put("tMap_2", false);
            start_Hash.put("tMap_2", System.currentTimeMillis());

            currentComponent = "tMap_2";

            int tos_count_tMap_2 = 0;

            // ###############################
            // # Lookup's keys initialization

            org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row2Struct> tHash_Lookup_row2 = (org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row2Struct>) ((org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row2Struct>) globalMap
                    .get("tHash_Lookup_row2"));

            row2Struct row2HashKey = new row2Struct();
            row2Struct row2Default = new row2Struct();
            // ###############################

            // ###############################
            // # Vars initialization
            class Var__tMap_2__Struct {
            }
            Var__tMap_2__Struct Var__tMap_2 = new Var__tMap_2__Struct();
            // ###############################

            // ###############################
            // # Outputs initialization
            final_outputStruct final_output_tmp = new final_outputStruct();
            // ###############################

            /**
             * [tMap_2 begin ] stop
             */

            /**
             * [tMap_1 begin ] start
             */

            ok_Hash.put("tMap_1", false);
            start_Hash.put("tMap_1", System.currentTimeMillis());

            currentComponent = "tMap_1";

            int tos_count_tMap_1 = 0;

            // ###############################
            // # Lookup's keys initialization

            org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row8Struct> tHash_Lookup_row8 = (org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row8Struct>) ((org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row8Struct>) globalMap
                    .get("tHash_Lookup_row8"));

            row8Struct row8HashKey = new row8Struct();
            row8Struct row8Default = new row8Struct();

            org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row9Struct> tHash_Lookup_row9 = (org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row9Struct>) ((org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row9Struct>) globalMap
                    .get("tHash_Lookup_row9"));

            row9Struct row9HashKey = new row9Struct();
            row9Struct row9Default = new row9Struct();

            org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row10Struct> tHash_Lookup_row10 = (org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row10Struct>) ((org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row10Struct>) globalMap
                    .get("tHash_Lookup_row10"));

            row10Struct row10HashKey = new row10Struct();
            row10Struct row10Default = new row10Struct();
            // ###############################

            // ###############################
            // # Vars initialization
            class Var__tMap_1__Struct {
            }
            Var__tMap_1__Struct Var__tMap_1 = new Var__tMap_1__Struct();
            // ###############################

            // ###############################
            // # Outputs initialization
            FLIGHT_OutStruct FLIGHT_Out_tmp = new FLIGHT_OutStruct();
            // ###############################

            /**
             * [tMap_1 begin ] stop
             */

            /**
             * [tAggregateRow_2_AGGIN begin ] start
             */

            ok_Hash.put("tAggregateRow_2_AGGIN", false);
            start_Hash.put("tAggregateRow_2_AGGIN", System.currentTimeMillis());

            currentVirtualComponent = "tAggregateRow_2";

            currentComponent = "tAggregateRow_2_AGGIN";

            int tos_count_tAggregateRow_2_AGGIN = 0;

            java.util.Collection<AggOperationStruct_tAggregateRow_2> values_tAggregateRow_2 = hash_tAggregateRow_2
                    .values();

            globalMap.put("tAggregateRow_2_NB_LINE", values_tAggregateRow_2.size());

            for (AggOperationStruct_tAggregateRow_2 aggregated_row_tAggregateRow_2 : values_tAggregateRow_2) { // G_AggR_600

                /**
                 * [tAggregateRow_2_AGGIN begin ] stop
                 */

                /**
                 * [tAggregateRow_2_AGGIN main ] start
                 */

                currentVirtualComponent = "tAggregateRow_2";

                currentComponent = "tAggregateRow_2_AGGIN";

                row7.reporting_year = aggregated_row_tAggregateRow_2.reporting_year;

                row7.state = aggregated_row_tAggregateRow_2.state;
                row7.ghg_quantity = aggregated_row_tAggregateRow_2.ghg_quantity_sum;

                tos_count_tAggregateRow_2_AGGIN++;

                /**
                 * [tAggregateRow_2_AGGIN main ] stop
                 */

                /**
                 * [tMap_1 main ] start
                 */

                currentComponent = "tMap_1";

                boolean hasCasePrimitiveKeyWithNull_tMap_1 = false;

                // ###############################
                // # Input tables (lookups)
                boolean rejectedInnerJoin_tMap_1 = false;
                boolean mainRowRejected_tMap_1 = false;

                // /////////////////////////////////////////////
                // Starting Lookup Table "row8"
                // /////////////////////////////////////////////

                boolean forceLooprow8 = false;

                row8Struct row8ObjectFromLookup = null;

                if (!rejectedInnerJoin_tMap_1) { // G_TM_M_020

                    hasCasePrimitiveKeyWithNull_tMap_1 = false;

                    row8HashKey.state = row7.state;

                    row8HashKey.hashCodeDirty = true;

                    tHash_Lookup_row8.lookup(row8HashKey);

                } // G_TM_M_020

                if (tHash_Lookup_row8 != null && tHash_Lookup_row8.getCount(row8HashKey) > 1) { // G
                    // 071

                    // System.out.println("WARNING: UNIQUE MATCH is configured for the lookup 'row8' and it contains more one result from keys :  row8.state = '"
                    // + row8HashKey.state + "'");
                } // G 071

                row8Struct row8 = null;

                row8Struct fromLookup_row8 = null;
                row8 = row8Default;

                if (tHash_Lookup_row8 != null && tHash_Lookup_row8.hasNext()) { // G 099

                    fromLookup_row8 = tHash_Lookup_row8.next();

                } // G 099

                if (fromLookup_row8 != null) {
                    row8 = fromLookup_row8;
                }

                // /////////////////////////////////////////////
                // Starting Lookup Table "row9"
                // /////////////////////////////////////////////

                boolean forceLooprow9 = false;

                row9Struct row9ObjectFromLookup = null;

                if (!rejectedInnerJoin_tMap_1) { // G_TM_M_020

                    hasCasePrimitiveKeyWithNull_tMap_1 = false;

                    row9HashKey.state = row7.state;

                    row9HashKey.hashCodeDirty = true;

                    tHash_Lookup_row9.lookup(row9HashKey);

                } // G_TM_M_020

                if (tHash_Lookup_row9 != null && tHash_Lookup_row9.getCount(row9HashKey) > 1) { // G
                    // 071

                    // System.out.println("WARNING: UNIQUE MATCH is configured for the lookup 'row9' and it contains more one result from keys :  row9.state = '"
                    // + row9HashKey.state + "'");
                } // G 071

                row9Struct row9 = null;

                row9Struct fromLookup_row9 = null;
                row9 = row9Default;

                if (tHash_Lookup_row9 != null && tHash_Lookup_row9.hasNext()) { // G 099

                    fromLookup_row9 = tHash_Lookup_row9.next();

                } // G 099

                if (fromLookup_row9 != null) {
                    row9 = fromLookup_row9;
                }

                // /////////////////////////////////////////////
                // Starting Lookup Table "row10"
                // /////////////////////////////////////////////

                boolean forceLooprow10 = false;

                row10Struct row10ObjectFromLookup = null;

                if (!rejectedInnerJoin_tMap_1) { // G_TM_M_020

                    hasCasePrimitiveKeyWithNull_tMap_1 = false;

                    row10HashKey.state = row7.state;

                    row10HashKey.hashCodeDirty = true;

                    tHash_Lookup_row10.lookup(row10HashKey);

                } // G_TM_M_020

                if (tHash_Lookup_row10 != null && tHash_Lookup_row10.getCount(row10HashKey) > 1) { // G
                    // 071

                    // System.out.println("WARNING: UNIQUE MATCH is configured for the lookup 'row10' and it contains more one result from keys :  row10.state = '"
                    // + row10HashKey.state + "'");
                } // G 071

                row10Struct row10 = null;

                row10Struct fromLookup_row10 = null;
                row10 = row10Default;

                if (tHash_Lookup_row10 != null && tHash_Lookup_row10.hasNext()) { // G 099

                    fromLookup_row10 = tHash_Lookup_row10.next();

                } // G 099

                if (fromLookup_row10 != null) {
                    row10 = fromLookup_row10;
                }

                // ###############################
                { // start of Var scope

                    // ###############################
                    // # Vars tables

                    Var__tMap_1__Struct Var = Var__tMap_1;// ###############################
                    // ###############################
                    // # Output tables

                    FLIGHT_Out = null;

                    // # Output table : 'FLIGHT_Out'
                    FLIGHT_Out_tmp.state = row7.state;
                    FLIGHT_Out_tmp.ghg_quantity_2011 = row7.ghg_quantity;
                    FLIGHT_Out_tmp.ghg_quantity_2012 = row8.ghg_quantity;
                    FLIGHT_Out_tmp.ghg_quantity_2013 = row9.ghg_quantity;
                    FLIGHT_Out_tmp.ghg_quantity_2014 = row10.ghg_quantity;
                    FLIGHT_Out = FLIGHT_Out_tmp;
                    // ###############################

                } // end of Var scope

                rejectedInnerJoin_tMap_1 = false;

                tos_count_tMap_1++;

                /**
                 * [tMap_1 main ] stop
                 */
                // Start of branch "FLIGHT_Out"
                if (FLIGHT_Out != null) {

                    /**
                     * [tMap_2 main ] start
                     */

                    currentComponent = "tMap_2";

                    boolean hasCasePrimitiveKeyWithNull_tMap_2 = false;

                    // ###############################
                    // # Input tables (lookups)
                    boolean rejectedInnerJoin_tMap_2 = false;
                    boolean mainRowRejected_tMap_2 = false;

                    // /////////////////////////////////////////////
                    // Starting Lookup Table "row2"
                    // /////////////////////////////////////////////

                    boolean forceLooprow2 = false;

                    row2Struct row2ObjectFromLookup = null;

                    if (!rejectedInnerJoin_tMap_2) { // G_TM_M_020

                        hasCasePrimitiveKeyWithNull_tMap_2 = false;

                        row2HashKey.state = FLIGHT_Out.state;

                        row2HashKey.hashCodeDirty = true;

                        tHash_Lookup_row2.lookup(row2HashKey);

                    } // G_TM_M_020

                    if (tHash_Lookup_row2 != null && tHash_Lookup_row2.getCount(row2HashKey) > 1) { // G
                        // 071

                        // System.out.println("WARNING: UNIQUE MATCH is configured for the lookup 'row2' and it contains more one result from keys :  row2.state = '"
                        // + row2HashKey.state + "'");
                    } // G 071

                    row2Struct row2 = null;

                    row2Struct fromLookup_row2 = null;
                    row2 = row2Default;

                    if (tHash_Lookup_row2 != null && tHash_Lookup_row2.hasNext()) { // G 099

                        fromLookup_row2 = tHash_Lookup_row2.next();

                    } // G 099

                    if (fromLookup_row2 != null) {
                        row2 = fromLookup_row2;
                    }

                    // ###############################
                    { // start of Var scope

                        // ###############################
                        // # Vars tables

                        Var__tMap_2__Struct Var = Var__tMap_2;// ###############################
                        // ###############################
                        // # Output tables

                        final_output = null;

                        // # Output table : 'final_output'
                        final_output_tmp.state = FLIGHT_Out.state;
                        final_output_tmp.ghg_quantity_2011 = FLIGHT_Out.ghg_quantity_2011;
                        final_output_tmp.ghg_quantity_2012 = FLIGHT_Out.ghg_quantity_2012;
                        final_output_tmp.ghg_quantity_2013 = FLIGHT_Out.ghg_quantity_2013;
                        final_output_tmp.ghg_quantity_2014 = FLIGHT_Out.ghg_quantity_2014;
                        final_output_tmp.ghg_goal_2022 = row2.ghg_goal_2022;
                        final_output_tmp.ghg_goal_2023 = row2.ghg_goal_2023;
                        final_output_tmp.ghg_goal_2024 = row2.ghg_goal_2024;
                        final_output_tmp.ghg_goal_2025 = row2.ghg_goal_2025;
                        final_output_tmp.ghg_goal_2026 = row2.ghg_goal_2026;
                        final_output_tmp.ghg_goal_2027 = row2.ghg_goal_2027;
                        final_output_tmp.ghg_goal_2028 = row2.ghg_goal_2028;
                        final_output_tmp.ghg_goal_2029 = row2.ghg_goal_2029;
                        final_output_tmp.ghg_goal_2030 = row2.ghg_goal_2030;
                        final_output_tmp.state_fullname = row2.state_name;
                        final_output = final_output_tmp;
                        // ###############################

                    } // end of Var scope

                    rejectedInnerJoin_tMap_2 = false;

                    tos_count_tMap_2++;

                    /**
                     * [tMap_2 main ] stop
                     */
                    // Start of branch "final_output"
                    if (final_output != null) {

                        /**
                         * [tSortRow_1_SortOut main ] start
                         */

                        currentVirtualComponent = "tSortRow_1";

                        currentComponent = "tSortRow_1_SortOut";

                        Comparablefinal_outputStruct arrayRowtSortRow_1_SortOut = new Comparablefinal_outputStruct();

                        arrayRowtSortRow_1_SortOut.state = final_output.state;
                        arrayRowtSortRow_1_SortOut.ghg_quantity_2011 = final_output.ghg_quantity_2011;
                        arrayRowtSortRow_1_SortOut.ghg_quantity_2012 = final_output.ghg_quantity_2012;
                        arrayRowtSortRow_1_SortOut.ghg_quantity_2013 = final_output.ghg_quantity_2013;
                        arrayRowtSortRow_1_SortOut.ghg_quantity_2014 = final_output.ghg_quantity_2014;
                        arrayRowtSortRow_1_SortOut.ghg_goal_2022 = final_output.ghg_goal_2022;
                        arrayRowtSortRow_1_SortOut.ghg_goal_2023 = final_output.ghg_goal_2023;
                        arrayRowtSortRow_1_SortOut.ghg_goal_2024 = final_output.ghg_goal_2024;
                        arrayRowtSortRow_1_SortOut.ghg_goal_2025 = final_output.ghg_goal_2025;
                        arrayRowtSortRow_1_SortOut.ghg_goal_2026 = final_output.ghg_goal_2026;
                        arrayRowtSortRow_1_SortOut.ghg_goal_2027 = final_output.ghg_goal_2027;
                        arrayRowtSortRow_1_SortOut.ghg_goal_2028 = final_output.ghg_goal_2028;
                        arrayRowtSortRow_1_SortOut.ghg_goal_2029 = final_output.ghg_goal_2029;
                        arrayRowtSortRow_1_SortOut.ghg_goal_2030 = final_output.ghg_goal_2030;
                        arrayRowtSortRow_1_SortOut.state_fullname = final_output.state_fullname;
                        list_tSortRow_1_SortOut.add(arrayRowtSortRow_1_SortOut);

                        tos_count_tSortRow_1_SortOut++;

                        /**
                         * [tSortRow_1_SortOut main ] stop
                         */

                    } // End of branch "final_output"

                } // End of branch "FLIGHT_Out"

                /**
                 * [tAggregateRow_2_AGGIN end ] start
                 */

                currentVirtualComponent = "tAggregateRow_2";

                currentComponent = "tAggregateRow_2_AGGIN";

            } // G_AggR_600

            ok_Hash.put("tAggregateRow_2_AGGIN", true);
            end_Hash.put("tAggregateRow_2_AGGIN", System.currentTimeMillis());

            /**
             * [tAggregateRow_2_AGGIN end ] stop
             */

            /**
             * [tMap_1 end ] start
             */

            currentComponent = "tMap_1";

            // ###############################
            // # Lookup hashes releasing
            if (tHash_Lookup_row8 != null) {
                tHash_Lookup_row8.endGet();
            }
            globalMap.remove("tHash_Lookup_row8");

            if (tHash_Lookup_row9 != null) {
                tHash_Lookup_row9.endGet();
            }
            globalMap.remove("tHash_Lookup_row9");

            if (tHash_Lookup_row10 != null) {
                tHash_Lookup_row10.endGet();
            }
            globalMap.remove("tHash_Lookup_row10");

            // ###############################

            ok_Hash.put("tMap_1", true);
            end_Hash.put("tMap_1", System.currentTimeMillis());

            /**
             * [tMap_1 end ] stop
             */

            /**
             * [tMap_2 end ] start
             */

            currentComponent = "tMap_2";

            // ###############################
            // # Lookup hashes releasing
            if (tHash_Lookup_row2 != null) {
                tHash_Lookup_row2.endGet();
            }
            globalMap.remove("tHash_Lookup_row2");

            // ###############################

            ok_Hash.put("tMap_2", true);
            end_Hash.put("tMap_2", System.currentTimeMillis());

            /**
             * [tMap_2 end ] stop
             */

            /**
             * [tSortRow_1_SortOut end ] start
             */

            currentVirtualComponent = "tSortRow_1";

            currentComponent = "tSortRow_1_SortOut";

            final_outputStruct[] array_tSortRow_1_SortOut = list_tSortRow_1_SortOut
                    .toArray(new Comparablefinal_outputStruct[0]);

            java.util.Arrays.sort(array_tSortRow_1_SortOut);

            globalMap.put("tSortRow_1", array_tSortRow_1_SortOut);

            ok_Hash.put("tSortRow_1_SortOut", true);
            end_Hash.put("tSortRow_1_SortOut", System.currentTimeMillis());

            /**
             * [tSortRow_1_SortOut end ] stop
             */

            /**
             * [tWriteJSONField_1_Out begin ] start
             */

            ok_Hash.put("tWriteJSONField_1_Out", false);
            start_Hash.put("tWriteJSONField_1_Out", System.currentTimeMillis());

            currentVirtualComponent = "tWriteJSONField_1";

            currentComponent = "tWriteJSONField_1_Out";

            int tos_count_tWriteJSONField_1_Out = 0;

            // tWriteXMLFieldOut_begin
            int nb_line_tWriteJSONField_1_Out = 0;
            boolean needRoot_tWriteJSONField_1_Out = true;

            String strCompCache_tWriteJSONField_1_Out = null;

            java.util.Queue<row3Struct> listGroupby_tWriteJSONField_1_Out = new java.util.concurrent.ConcurrentLinkedQueue<row3Struct>();

            class ThreadXMLField_tWriteJSONField_1_Out extends Thread {

                java.util.Queue<row3Struct> queue;

                java.util.List<java.util.Map<String, String>> flows;
                java.lang.Exception lastException;
                String currentComponent;

                ThreadXMLField_tWriteJSONField_1_Out(java.util.Queue q) {
                    this.queue = q;
                    globalMap.put("queue_tWriteJSONField_1_In", queue);
                    lastException = null;
                }

                ThreadXMLField_tWriteJSONField_1_Out(java.util.Queue q,
                        java.util.List<java.util.Map<String, String>> l) {
                    this.queue = q;
                    this.flows = l;
                    lastException = null;
                    globalMap.put("queue_tWriteJSONField_1_In", queue);
                    globalMap.put("flows_tWriteJSONField_1_In", flows);
                }

                public java.lang.Exception getLastException() {
                    return this.lastException;
                }

                public String getCurrentComponent() {
                    return this.currentComponent;
                }

                @Override
                public void run() {
                    try {
                        tWriteJSONField_1_InProcess(globalMap);
                    } catch (TalendException te) {
                        this.lastException = te.getException();
                        this.currentComponent = te.getCurrentComponent();
                    }
                }
            }

            ThreadXMLField_tWriteJSONField_1_Out txf_tWriteJSONField_1_Out = new ThreadXMLField_tWriteJSONField_1_Out(
                    listGroupby_tWriteJSONField_1_Out);

            txf_tWriteJSONField_1_Out.start();

            java.util.List<java.util.List<String>> groupbyList_tWriteJSONField_1_Out = new java.util.ArrayList<java.util.List<String>>();
            java.util.Map<String, String> valueMap_tWriteJSONField_1_Out = new java.util.HashMap<String, String>();

            class NestXMLTool_tWriteJSONField_1_Out {
                public void parseAndAdd(org.dom4j.Element nestRoot, String value) {
                    try {
                        org.dom4j.Document doc4Str = org.dom4j.DocumentHelper
                                .parseText("<root>" + value + "</root>");
                        nestRoot.setContent(doc4Str.getRootElement().content());
                    } catch (java.lang.Exception e) {
                        e.printStackTrace();
                        nestRoot.setText(value);
                    }
                }

                public void setText(org.dom4j.Element element, String value) {
                    if (value.startsWith("<![CDATA[") && value.endsWith("]]>")) {
                        String text = value.substring(9, value.length() - 3);
                        element.addCDATA(text);
                    } else {
                        element.setText(value);
                    }
                }

                public void replaceDefaultNameSpace(org.dom4j.Element nestRoot) {
                    if (nestRoot != null) {
                        for (org.dom4j.Element tmp : (java.util.List<org.dom4j.Element>) nestRoot.elements()) {
                            if (("").equals(tmp.getQName().getNamespace().getURI())
                                    && ("").equals(tmp.getQName().getNamespace().getPrefix())) {
                                tmp.setQName(org.dom4j.DocumentHelper.createQName(tmp.getName(),
                                        nestRoot.getQName().getNamespace()));
                            }
                            replaceDefaultNameSpace(tmp);
                        }
                    }
                }

                public void removeEmptyElement(org.dom4j.Element root) {
                    if (root != null) {
                        for (org.dom4j.Element tmp : (java.util.List<org.dom4j.Element>) root.elements()) {
                            removeEmptyElement(tmp);
                        }
                        if (root.content().size() == 0 && root.attributes().size() == 0
                                && root.declaredNamespaces().size() == 0) {
                            if (root.getParent() != null) {
                                root.getParent().remove(root);
                            }
                        }
                    }
                }
            }
            NestXMLTool_tWriteJSONField_1_Out nestXMLTool_tWriteJSONField_1_Out = new NestXMLTool_tWriteJSONField_1_Out();

            row11Struct rowStructOutput_tWriteJSONField_1_Out = null;
            // sort group root element for judgement of group
            java.util.List<org.dom4j.Element> groupElementList_tWriteJSONField_1_Out = new java.util.ArrayList<org.dom4j.Element>();
            org.dom4j.Element root4Group_tWriteJSONField_1_Out = null;
            org.dom4j.Document doc_tWriteJSONField_1_Out = org.dom4j.DocumentHelper.createDocument();
            org.dom4j.io.OutputFormat format_tWriteJSONField_1_Out = org.dom4j.io.OutputFormat
                    .createCompactFormat();
            format_tWriteJSONField_1_Out.setNewLineAfterDeclaration(false);
            format_tWriteJSONField_1_Out.setTrimText(false);
            format_tWriteJSONField_1_Out.setEncoding("ISO-8859-15");
            int[] orders_tWriteJSONField_1_Out = new int[1];

            /**
             * [tWriteJSONField_1_Out begin ] stop
             */

            /**
             * [tSortRow_1_SortIn begin ] start
             */

            ok_Hash.put("tSortRow_1_SortIn", false);
            start_Hash.put("tSortRow_1_SortIn", System.currentTimeMillis());

            currentVirtualComponent = "tSortRow_1";

            currentComponent = "tSortRow_1_SortIn";

            int tos_count_tSortRow_1_SortIn = 0;

            final_outputStruct[] array_tSortRow_1_SortIn = (final_outputStruct[]) globalMap.get("tSortRow_1");

            int nb_line_tSortRow_1_SortIn = 0;

            final_outputStruct current_tSortRow_1_SortIn = null;

            for (int i_tSortRow_1_SortIn = 0; i_tSortRow_1_SortIn < array_tSortRow_1_SortIn.length; i_tSortRow_1_SortIn++) {
                current_tSortRow_1_SortIn = array_tSortRow_1_SortIn[i_tSortRow_1_SortIn];
                row11.state = current_tSortRow_1_SortIn.state;
                row11.ghg_quantity_2011 = current_tSortRow_1_SortIn.ghg_quantity_2011;
                row11.ghg_quantity_2012 = current_tSortRow_1_SortIn.ghg_quantity_2012;
                row11.ghg_quantity_2013 = current_tSortRow_1_SortIn.ghg_quantity_2013;
                row11.ghg_quantity_2014 = current_tSortRow_1_SortIn.ghg_quantity_2014;
                row11.ghg_goal_2022 = current_tSortRow_1_SortIn.ghg_goal_2022;
                row11.ghg_goal_2023 = current_tSortRow_1_SortIn.ghg_goal_2023;
                row11.ghg_goal_2024 = current_tSortRow_1_SortIn.ghg_goal_2024;
                row11.ghg_goal_2025 = current_tSortRow_1_SortIn.ghg_goal_2025;
                row11.ghg_goal_2026 = current_tSortRow_1_SortIn.ghg_goal_2026;
                row11.ghg_goal_2027 = current_tSortRow_1_SortIn.ghg_goal_2027;
                row11.ghg_goal_2028 = current_tSortRow_1_SortIn.ghg_goal_2028;
                row11.ghg_goal_2029 = current_tSortRow_1_SortIn.ghg_goal_2029;
                row11.ghg_goal_2030 = current_tSortRow_1_SortIn.ghg_goal_2030;
                row11.state_fullname = current_tSortRow_1_SortIn.state_fullname;
                // increase number of line sorted
                nb_line_tSortRow_1_SortIn++;

                /**
                 * [tSortRow_1_SortIn begin ] stop
                 */

                /**
                 * [tSortRow_1_SortIn main ] start
                 */

                currentVirtualComponent = "tSortRow_1";

                currentComponent = "tSortRow_1_SortIn";

                tos_count_tSortRow_1_SortIn++;

                /**
                 * [tSortRow_1_SortIn main ] stop
                 */

                /**
                 * [tWriteJSONField_1_Out main ] start
                 */

                currentVirtualComponent = "tWriteJSONField_1";

                currentComponent = "tWriteJSONField_1_Out";

                if (txf_tWriteJSONField_1_Out.getLastException() != null) {
                    currentComponent = txf_tWriteJSONField_1_Out.getCurrentComponent();
                    throw txf_tWriteJSONField_1_Out.getLastException();
                }
                nb_line_tWriteJSONField_1_Out++;
                valueMap_tWriteJSONField_1_Out.clear();
                valueMap_tWriteJSONField_1_Out.put("state",
                        (row11.state != null ? row11.state.toString() : null));
                valueMap_tWriteJSONField_1_Out.put("ghg_quantity_2011",
                        (row11.ghg_quantity_2011 != null ? row11.ghg_quantity_2011.toPlainString() : null));
                valueMap_tWriteJSONField_1_Out.put("ghg_quantity_2012",
                        (row11.ghg_quantity_2012 != null ? row11.ghg_quantity_2012.toPlainString() : null));
                valueMap_tWriteJSONField_1_Out.put("ghg_quantity_2013",
                        (row11.ghg_quantity_2013 != null ? row11.ghg_quantity_2013.toPlainString() : null));
                valueMap_tWriteJSONField_1_Out.put("ghg_quantity_2014",
                        (row11.ghg_quantity_2014 != null ? row11.ghg_quantity_2014.toPlainString() : null));
                valueMap_tWriteJSONField_1_Out.put("ghg_goal_2022",
                        (row11.ghg_goal_2022 != null ? row11.ghg_goal_2022.toPlainString() : null));
                valueMap_tWriteJSONField_1_Out.put("ghg_goal_2023",
                        (row11.ghg_goal_2023 != null ? row11.ghg_goal_2023.toPlainString() : null));
                valueMap_tWriteJSONField_1_Out.put("ghg_goal_2024",
                        (row11.ghg_goal_2024 != null ? row11.ghg_goal_2024.toPlainString() : null));
                valueMap_tWriteJSONField_1_Out.put("ghg_goal_2025",
                        (row11.ghg_goal_2025 != null ? row11.ghg_goal_2025.toPlainString() : null));
                valueMap_tWriteJSONField_1_Out.put("ghg_goal_2026",
                        (row11.ghg_goal_2026 != null ? row11.ghg_goal_2026.toPlainString() : null));
                valueMap_tWriteJSONField_1_Out.put("ghg_goal_2027",
                        (row11.ghg_goal_2027 != null ? row11.ghg_goal_2027.toPlainString() : null));
                valueMap_tWriteJSONField_1_Out.put("ghg_goal_2028",
                        (row11.ghg_goal_2028 != null ? row11.ghg_goal_2028.toPlainString() : null));
                valueMap_tWriteJSONField_1_Out.put("ghg_goal_2029",
                        (row11.ghg_goal_2029 != null ? row11.ghg_goal_2029.toPlainString() : null));
                valueMap_tWriteJSONField_1_Out.put("ghg_goal_2030",
                        (row11.ghg_goal_2030 != null ? row11.ghg_goal_2030.toPlainString() : null));
                valueMap_tWriteJSONField_1_Out.put("state_fullname",
                        (row11.state_fullname != null ? row11.state_fullname.toString() : null));
                String strTemp_tWriteJSONField_1_Out = "";
                if (strCompCache_tWriteJSONField_1_Out == null) {
                    strCompCache_tWriteJSONField_1_Out = strTemp_tWriteJSONField_1_Out;

                    rowStructOutput_tWriteJSONField_1_Out = row11;

                } else {
                    nestXMLTool_tWriteJSONField_1_Out
                            .replaceDefaultNameSpace(doc_tWriteJSONField_1_Out.getRootElement());
                    java.io.StringWriter strWriter_tWriteJSONField_1_Out = new java.io.StringWriter();
                    org.dom4j.io.XMLWriter output_tWriteJSONField_1_Out = new org.dom4j.io.XMLWriter(
                            strWriter_tWriteJSONField_1_Out, format_tWriteJSONField_1_Out);
                    output_tWriteJSONField_1_Out.write(doc_tWriteJSONField_1_Out);
                    output_tWriteJSONField_1_Out.close();

                    row3Struct row_tWriteJSONField_1_Out = new row3Struct();

                    row_tWriteJSONField_1_Out.state = strWriter_tWriteJSONField_1_Out.toString();
                    listGroupby_tWriteJSONField_1_Out.add(row_tWriteJSONField_1_Out);

                    doc_tWriteJSONField_1_Out.clearContent();
                    needRoot_tWriteJSONField_1_Out = true;
                    for (int i_tWriteJSONField_1_Out = 0; i_tWriteJSONField_1_Out < orders_tWriteJSONField_1_Out.length; i_tWriteJSONField_1_Out++) {
                        orders_tWriteJSONField_1_Out[i_tWriteJSONField_1_Out] = 0;
                    }

                    if (groupbyList_tWriteJSONField_1_Out != null
                            && groupbyList_tWriteJSONField_1_Out.size() >= 0) {
                        groupbyList_tWriteJSONField_1_Out.clear();
                    }
                    strCompCache_tWriteJSONField_1_Out = strTemp_tWriteJSONField_1_Out;
                    rowStructOutput_tWriteJSONField_1_Out = row11;

                }

                org.dom4j.Element subTreeRootParent_tWriteJSONField_1_Out = null;

                // build root xml tree
                if (needRoot_tWriteJSONField_1_Out) {
                    needRoot_tWriteJSONField_1_Out = false;
                    org.dom4j.Element root_tWriteJSONField_1_Out = doc_tWriteJSONField_1_Out
                            .addElement("state_group");
                    subTreeRootParent_tWriteJSONField_1_Out = root_tWriteJSONField_1_Out;
                    org.dom4j.Element root_0_tWriteJSONField_1_Out = root_tWriteJSONField_1_Out
                            .addElement("acronymn");
                    if (valueMap_tWriteJSONField_1_Out.get("state") != null) {
                        nestXMLTool_tWriteJSONField_1_Out.setText(root_0_tWriteJSONField_1_Out,
                                valueMap_tWriteJSONField_1_Out.get("state"));
                    }
                    org.dom4j.Element root_1_tWriteJSONField_1_Out = root_tWriteJSONField_1_Out
                            .addElement("ghg_emissions");
                    org.dom4j.Element root_1_0_tWriteJSONField_1_Out = root_1_tWriteJSONField_1_Out
                            .addElement("emissions_2011");
                    if (valueMap_tWriteJSONField_1_Out.get("ghg_quantity_2011") != null) {
                        nestXMLTool_tWriteJSONField_1_Out.setText(root_1_0_tWriteJSONField_1_Out,
                                valueMap_tWriteJSONField_1_Out.get("ghg_quantity_2011"));
                    }
                    org.dom4j.Element root_1_1_tWriteJSONField_1_Out = root_1_tWriteJSONField_1_Out
                            .addElement("emissions_2012");
                    if (valueMap_tWriteJSONField_1_Out.get("ghg_quantity_2012") != null) {
                        nestXMLTool_tWriteJSONField_1_Out.setText(root_1_1_tWriteJSONField_1_Out,
                                valueMap_tWriteJSONField_1_Out.get("ghg_quantity_2012"));
                    }
                    org.dom4j.Element root_1_2_tWriteJSONField_1_Out = root_1_tWriteJSONField_1_Out
                            .addElement("emissions_2013");
                    if (valueMap_tWriteJSONField_1_Out.get("ghg_quantity_2013") != null) {
                        nestXMLTool_tWriteJSONField_1_Out.setText(root_1_2_tWriteJSONField_1_Out,
                                valueMap_tWriteJSONField_1_Out.get("ghg_quantity_2013"));
                    }
                    org.dom4j.Element root_1_3_tWriteJSONField_1_Out = root_1_tWriteJSONField_1_Out
                            .addElement("emissions_2014");
                    if (valueMap_tWriteJSONField_1_Out.get("ghg_quantity_2014") != null) {
                        nestXMLTool_tWriteJSONField_1_Out.setText(root_1_3_tWriteJSONField_1_Out,
                                valueMap_tWriteJSONField_1_Out.get("ghg_quantity_2014"));
                    }
                    org.dom4j.Element root_2_tWriteJSONField_1_Out = root_tWriteJSONField_1_Out
                            .addElement("ghg_goals");
                    org.dom4j.Element root_2_0_tWriteJSONField_1_Out = root_2_tWriteJSONField_1_Out
                            .addElement("goals_2022");
                    if (valueMap_tWriteJSONField_1_Out.get("ghg_goal_2022") != null) {
                        nestXMLTool_tWriteJSONField_1_Out.setText(root_2_0_tWriteJSONField_1_Out,
                                valueMap_tWriteJSONField_1_Out.get("ghg_goal_2022"));
                    }
                    org.dom4j.Element root_2_1_tWriteJSONField_1_Out = root_2_tWriteJSONField_1_Out
                            .addElement("goals_2023");
                    if (valueMap_tWriteJSONField_1_Out.get("ghg_goal_2023") != null) {
                        nestXMLTool_tWriteJSONField_1_Out.setText(root_2_1_tWriteJSONField_1_Out,
                                valueMap_tWriteJSONField_1_Out.get("ghg_goal_2023"));
                    }
                    org.dom4j.Element root_2_2_tWriteJSONField_1_Out = root_2_tWriteJSONField_1_Out
                            .addElement("goals_2024");
                    if (valueMap_tWriteJSONField_1_Out.get("ghg_goal_2024") != null) {
                        nestXMLTool_tWriteJSONField_1_Out.setText(root_2_2_tWriteJSONField_1_Out,
                                valueMap_tWriteJSONField_1_Out.get("ghg_goal_2024"));
                    }
                    org.dom4j.Element root_2_3_tWriteJSONField_1_Out = root_2_tWriteJSONField_1_Out
                            .addElement("goals_2025");
                    if (valueMap_tWriteJSONField_1_Out.get("ghg_goal_2025") != null) {
                        nestXMLTool_tWriteJSONField_1_Out.setText(root_2_3_tWriteJSONField_1_Out,
                                valueMap_tWriteJSONField_1_Out.get("ghg_goal_2025"));
                    }
                    org.dom4j.Element root_2_4_tWriteJSONField_1_Out = root_2_tWriteJSONField_1_Out
                            .addElement("goals_2026");
                    if (valueMap_tWriteJSONField_1_Out.get("ghg_goal_2026") != null) {
                        nestXMLTool_tWriteJSONField_1_Out.setText(root_2_4_tWriteJSONField_1_Out,
                                valueMap_tWriteJSONField_1_Out.get("ghg_goal_2026"));
                    }
                    org.dom4j.Element root_2_5_tWriteJSONField_1_Out = root_2_tWriteJSONField_1_Out
                            .addElement("goals_2027");
                    if (valueMap_tWriteJSONField_1_Out.get("ghg_goal_2027") != null) {
                        nestXMLTool_tWriteJSONField_1_Out.setText(root_2_5_tWriteJSONField_1_Out,
                                valueMap_tWriteJSONField_1_Out.get("ghg_goal_2027"));
                    }
                    org.dom4j.Element root_2_6_tWriteJSONField_1_Out = root_2_tWriteJSONField_1_Out
                            .addElement("goals_2028");
                    if (valueMap_tWriteJSONField_1_Out.get("ghg_goal_2028") != null) {
                        nestXMLTool_tWriteJSONField_1_Out.setText(root_2_6_tWriteJSONField_1_Out,
                                valueMap_tWriteJSONField_1_Out.get("ghg_goal_2028"));
                    }
                    org.dom4j.Element root_2_7_tWriteJSONField_1_Out = root_2_tWriteJSONField_1_Out
                            .addElement("goals_2029");
                    if (valueMap_tWriteJSONField_1_Out.get("ghg_goal_2029") != null) {
                        nestXMLTool_tWriteJSONField_1_Out.setText(root_2_7_tWriteJSONField_1_Out,
                                valueMap_tWriteJSONField_1_Out.get("ghg_goal_2029"));
                    }
                    org.dom4j.Element root_2_8_tWriteJSONField_1_Out = root_2_tWriteJSONField_1_Out
                            .addElement("goals_2030");
                    if (valueMap_tWriteJSONField_1_Out.get("ghg_goal_2030") != null) {
                        nestXMLTool_tWriteJSONField_1_Out.setText(root_2_8_tWriteJSONField_1_Out,
                                valueMap_tWriteJSONField_1_Out.get("ghg_goal_2030"));
                    }
                    root4Group_tWriteJSONField_1_Out = subTreeRootParent_tWriteJSONField_1_Out;
                } else {
                    subTreeRootParent_tWriteJSONField_1_Out = root4Group_tWriteJSONField_1_Out;
                }
                // build group xml tree
                // build loop xml tree
                org.dom4j.Element loop_tWriteJSONField_1_Out = org.dom4j.DocumentHelper.createElement("name");
                if (orders_tWriteJSONField_1_Out[0] == 0) {
                    orders_tWriteJSONField_1_Out[0] = 0;
                }
                if (1 < orders_tWriteJSONField_1_Out.length) {
                    orders_tWriteJSONField_1_Out[1] = 0;
                }
                subTreeRootParent_tWriteJSONField_1_Out.elements().add(orders_tWriteJSONField_1_Out[0]++,
                        loop_tWriteJSONField_1_Out);
                if (valueMap_tWriteJSONField_1_Out.get("state_fullname") != null) {
                    nestXMLTool_tWriteJSONField_1_Out.setText(loop_tWriteJSONField_1_Out,
                            valueMap_tWriteJSONField_1_Out.get("state_fullname"));
                }

                tos_count_tWriteJSONField_1_Out++;

                /**
                 * [tWriteJSONField_1_Out main ] stop
                 */

                /**
                 * [tSortRow_1_SortIn end ] start
                 */

                currentVirtualComponent = "tSortRow_1";

                currentComponent = "tSortRow_1_SortIn";

            }

            globalMap.put("tSortRow_1_SortIn_NB_LINE", nb_line_tSortRow_1_SortIn);

            ok_Hash.put("tSortRow_1_SortIn", true);
            end_Hash.put("tSortRow_1_SortIn", System.currentTimeMillis());

            /**
             * [tSortRow_1_SortIn end ] stop
             */

            /**
             * [tWriteJSONField_1_Out end ] start
             */

            currentVirtualComponent = "tWriteJSONField_1";

            currentComponent = "tWriteJSONField_1_Out";

            if (nb_line_tWriteJSONField_1_Out > 0) {
                nestXMLTool_tWriteJSONField_1_Out
                        .replaceDefaultNameSpace(doc_tWriteJSONField_1_Out.getRootElement());
                java.io.StringWriter strWriter_tWriteJSONField_1_Out = new java.io.StringWriter();
                org.dom4j.io.XMLWriter output_tWriteJSONField_1_Out = new org.dom4j.io.XMLWriter(
                        strWriter_tWriteJSONField_1_Out, format_tWriteJSONField_1_Out);
                output_tWriteJSONField_1_Out.write(doc_tWriteJSONField_1_Out);
                output_tWriteJSONField_1_Out.close();
                row3Struct row_tWriteJSONField_1_Out = new row3Struct();

                row_tWriteJSONField_1_Out.state = strWriter_tWriteJSONField_1_Out.toString();
                listGroupby_tWriteJSONField_1_Out.add(row_tWriteJSONField_1_Out);

            }
            globalMap.put("tWriteJSONField_1_Out_NB_LINE", nb_line_tWriteJSONField_1_Out);
            globalMap.put("tWriteJSONField_1_In_FINISH" + (listGroupby_tWriteJSONField_1_Out == null ? ""
                    : listGroupby_tWriteJSONField_1_Out.hashCode()), "true");

            txf_tWriteJSONField_1_Out.join();
            if (txf_tWriteJSONField_1_Out.getLastException() != null) {
                currentComponent = txf_tWriteJSONField_1_Out.getCurrentComponent();
                throw txf_tWriteJSONField_1_Out.getLastException();
            }

            resourceMap.put("finish_tWriteJSONField_1_Out", true);

            ok_Hash.put("tWriteJSONField_1_Out", true);
            end_Hash.put("tWriteJSONField_1_Out", System.currentTimeMillis());

            /**
             * [tWriteJSONField_1_Out end ] stop
             */

        } // end the resume

    } catch (java.lang.Exception e) {

        TalendException te = new TalendException(e, currentComponent, globalMap);

        te.setVirtualComponentName(currentVirtualComponent);

        throw te;
    } catch (java.lang.Error error) {

        throw error;
    } finally {

        // free memory for "tSortRow_1_SortIn"
        globalMap.remove("tSortRow_1");

        // free memory for "tMap_2"
        globalMap.remove("tHash_Lookup_row2");

        // free memory for "tMap_1"
        globalMap.remove("tHash_Lookup_row8");

        // free memory for "tMap_1"
        globalMap.remove("tHash_Lookup_row9");

        // free memory for "tMap_1"
        globalMap.remove("tHash_Lookup_row10");

        // free memory for "tAggregateRow_2_AGGIN"
        globalMap.remove("tAggregateRow_2");

        try {

            /**
             * [tFileInputExcel_2 finally ] start
             */

            currentComponent = "tFileInputExcel_2";

            /**
             * [tFileInputExcel_2 finally ] stop
             */

            /**
             * [tAggregateRow_2_AGGOUT finally ] start
             */

            currentVirtualComponent = "tAggregateRow_2";

            currentComponent = "tAggregateRow_2_AGGOUT";

            /**
             * [tAggregateRow_2_AGGOUT finally ] stop
             */

            /**
             * [tAggregateRow_2_AGGIN finally ] start
             */

            currentVirtualComponent = "tAggregateRow_2";

            currentComponent = "tAggregateRow_2_AGGIN";

            /**
             * [tAggregateRow_2_AGGIN finally ] stop
             */

            /**
             * [tMap_1 finally ] start
             */

            currentComponent = "tMap_1";

            /**
             * [tMap_1 finally ] stop
             */

            /**
             * [tMap_2 finally ] start
             */

            currentComponent = "tMap_2";

            /**
             * [tMap_2 finally ] stop
             */

            /**
             * [tSortRow_1_SortOut finally ] start
             */

            currentVirtualComponent = "tSortRow_1";

            currentComponent = "tSortRow_1_SortOut";

            /**
             * [tSortRow_1_SortOut finally ] stop
             */

            /**
             * [tSortRow_1_SortIn finally ] start
             */

            currentVirtualComponent = "tSortRow_1";

            currentComponent = "tSortRow_1_SortIn";

            /**
             * [tSortRow_1_SortIn finally ] stop
             */

            /**
             * [tWriteJSONField_1_Out finally ] start
             */

            currentVirtualComponent = "tWriteJSONField_1";

            currentComponent = "tWriteJSONField_1_Out";

            java.util.Queue listGroupby_tWriteJSONField_1_Out = (java.util.Queue) globalMap
                    .get("queue_tWriteJSONField_1_In");
            if (resourceMap.get("finish_tWriteJSONField_1_Out") == null) {
                globalMap.put("tWriteJSONField_1_In_FINISH_WITH_EXCEPTION"
                        + (listGroupby_tWriteJSONField_1_Out == null ? ""
                                : listGroupby_tWriteJSONField_1_Out.hashCode()),
                        "true");
            }

            if (listGroupby_tWriteJSONField_1_Out != null) {
                globalMap.put("tWriteJSONField_1_In_FINISH" + (listGroupby_tWriteJSONField_1_Out == null ? ""
                        : listGroupby_tWriteJSONField_1_Out.hashCode()), "true");
            }

            /**
             * [tWriteJSONField_1_Out finally ] stop
             */

        } catch (java.lang.Exception e) {
            // ignore
        } catch (java.lang.Error error) {
            // ignore
        }
        resourceMap = null;
    }

    globalMap.put("tFileInputExcel_2_SUBPROCESS_STATE", 1);
}

From source file:it.doqui.index.ecmengine.business.foundation.repository.ExportSvcBean.java

License:Open Source License

private Exporter createXMLExporter(OutputStream viewWriter, ReferenceType referenceType) {
    // Define output format
    OutputFormat format = OutputFormat.createPrettyPrint();
    format.setNewLineAfterDeclaration(false);
    format.setIndentSize(2);/*from  ww  w .ja v  a2 s  .  c  o m*/
    format.setEncoding("UTF-8");

    // Construct an XML Exporter
    try {
        XMLWriter writer = new XMLWriter(viewWriter, format);
        ECMEngineExporter exporter = new ECMEngineExporter(serviceRegistry.getNamespaceService(),
                serviceRegistry.getNodeService(), serviceRegistry.getSearchService(),
                serviceRegistry.getDictionaryService(), serviceRegistry.getPermissionService(), writer);
        exporter.setReferenceType(referenceType);
        return exporter;
    } catch (UnsupportedEncodingException e) {
        throw new ExporterException("Failed to create XML Writer for export", e);
    } catch (Exception e) {
        throw new ExporterException("Failed to create XML Writer for export", e);
    }
}

From source file:org.alfresco.module.vti.web.fp.DeleteMethod.java

License:Open Source License

@Override
protected OutputFormat getXMLOutputFormat() {
    OutputFormat outputFormat = new OutputFormat();
    outputFormat.setNewLineAfterDeclaration(false);
    outputFormat.setNewlines(false);/*from   w w w  .  j  av  a  2  s.c om*/
    outputFormat.setIndent(false);
    return outputFormat;
}