Example usage for org.dom4j Element getNamespaceForPrefix

List of usage examples for org.dom4j Element getNamespaceForPrefix

Introduction

In this page you can find the example usage for org.dom4j Element getNamespaceForPrefix.

Prototype

Namespace getNamespaceForPrefix(String prefix);

Source Link

Document

Returns the Namespace which is mapped to the given prefix or null if it could not be found.

Usage

From source file:pahma_etl.tmslocation_barcode_mvcrate_1_1.TMSlocation_barcode_mvCrate.java

License:LGPL

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

    final boolean execStat = this.execStat;

    String iterateId = "";
    int iterateLoop = 0;
    String currentComponent = "";

    try {//  w w w  .j av  a2s .c  om

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

            tFileInputDelimited_8Process(globalMap);
            tFileInputDelimited_2Process(globalMap);
            tFileInputDelimited_6Process(globalMap);
            tFileInputDelimited_5Process(globalMap);

            batcode_fileStruct batcode_file = new batcode_fileStruct();
            barcode_wNameStruct barcode_wName = new barcode_wNameStruct();
            row2Struct row2 = new row2Struct();
            barcodeStruct barcode = new barcodeStruct();
            barcode_no_obj_yet_txtStruct barcode_no_obj_yet_txt = new barcode_no_obj_yet_txtStruct();
            mvCrate_XMLStruct mvCrate_XML = new mvCrate_XMLStruct();
            mvCrate_CSIDStruct mvCrate_CSID = new mvCrate_CSIDStruct();
            barcode_no_obj_yetStruct barcode_no_obj_yet = new barcode_no_obj_yetStruct();

            /**
             * [tSortRow_3_SortOut begin ] start
             */

            ok_Hash.put("tSortRow_3_SortOut", false);
            start_Hash.put("tSortRow_3_SortOut", System.currentTimeMillis());
            currentComponent = "tSortRow_3_SortOut";

            int tos_count_tSortRow_3_SortOut = 0;

            class Comparablebarcode_wNameStruct extends barcode_wNameStruct
                    implements Comparable<Comparablebarcode_wNameStruct> {

                public int compareTo(Comparablebarcode_wNameStruct other) {

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

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

                    } else if (this.reason_for_move != null && other.reason_for_move != null) {
                        if (!this.reason_for_move.equals(other.reason_for_move)) {
                            return this.reason_for_move.compareTo(other.reason_for_move);
                        }
                    }
                    if (this.date_time == null && other.date_time != null) {
                        return -1;

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

                    } else if (this.date_time != null && other.date_time != null) {
                        if (!this.date_time.equals(other.date_time)) {
                            return this.date_time.compareTo(other.date_time);
                        }
                    }
                    if (this.current_crate == null && other.current_crate != null) {
                        return -1;

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

                    } else if (this.current_crate != null && other.current_crate != null) {
                        if (!this.current_crate.equals(other.current_crate)) {
                            return this.current_crate.compareTo(other.current_crate);
                        }
                    }
                    if (this.new_location == null && other.new_location != null) {
                        return -1;

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

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

            java.util.List<Comparablebarcode_wNameStruct> list_tSortRow_3_SortOut = new java.util.ArrayList<Comparablebarcode_wNameStruct>();

            /**
             * [tSortRow_3_SortOut begin ] stop
             */

            /**
             * [tMap_3 begin ] start
             */

            ok_Hash.put("tMap_3", false);
            start_Hash.put("tMap_3", System.currentTimeMillis());
            currentComponent = "tMap_3";

            int tos_count_tMap_3 = 0;

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

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

            handler_listStruct handler_listHashKey = new handler_listStruct();
            handler_listStruct handler_listDefault = new handler_listStruct();
            // ###############################

            // ###############################
            // # Vars initialization
            class Var__tMap_3__Struct {
            }
            Var__tMap_3__Struct Var__tMap_3 = new Var__tMap_3__Struct();
            // ###############################

            // ###############################
            // # Outputs initialization
            barcode_wNameStruct barcode_wName_tmp = new barcode_wNameStruct();
            // ###############################

            /**
             * [tMap_3 begin ] stop
             */

            /**
             * [tFileInputDelimited_1 begin ] start
             */

            ok_Hash.put("tFileInputDelimited_1", false);
            start_Hash.put("tFileInputDelimited_1", System.currentTimeMillis());
            currentComponent = "tFileInputDelimited_1";

            int tos_count_tFileInputDelimited_1 = 0;

            class RowHelper_tFileInputDelimited_1 {

                public void valueToConn(String[] row, batcode_fileStruct batcode_file) throws Exception {

                    if (row.length == 1 && ("\015").equals(row[0])) {// empty
                        // line
                        // when
                        // row
                        // separator
                        // is
                        // '\n'

                        batcode_file.reason_for_move = null;

                        batcode_file.person_scanning = null;

                        batcode_file.date_time = null;

                        batcode_file.current_crate = null;

                        batcode_file.new_location = null;

                    } else {

                        if (0 < row.length) {

                            batcode_file.reason_for_move = row[0].trim();

                        } else {
                            batcode_file.reason_for_move = null;
                        }

                        if (1 < row.length) {

                            batcode_file.person_scanning = row[1].trim();

                        } else {
                            batcode_file.person_scanning = null;
                        }

                        if (2 < row.length) {

                            batcode_file.date_time = row[2].trim();

                        } else {
                            batcode_file.date_time = null;
                        }

                        if (3 < row.length) {

                            batcode_file.current_crate = row[3].trim();

                        } else {
                            batcode_file.current_crate = null;
                        }

                        if (4 < row.length) {

                            batcode_file.new_location = row[4].trim();

                        } else {
                            batcode_file.new_location = null;
                        }

                    }

                }

            }
            RowHelper_tFileInputDelimited_1 rowHelper_tFileInputDelimited_1 = new RowHelper_tFileInputDelimited_1();

            int nb_line_tFileInputDelimited_1 = 0;
            int footer_tFileInputDelimited_1 = 0;
            int totalLinetFileInputDelimited_1 = 0;
            int limittFileInputDelimited_1 = -1;
            int lastLinetFileInputDelimited_1 = -1;

            char fieldSeparator_tFileInputDelimited_1[] = null;

            // support passing value (property: Field Separator) by
            // 'context.fs' or 'globalMap.get("fs")'.
            if (((String) ",").length() > 0) {
                fieldSeparator_tFileInputDelimited_1 = ((String) ",").toCharArray();
            } else {
                throw new IllegalArgumentException("Field Separator must be assigned a char.");
            }

            char rowSeparator_tFileInputDelimited_1[] = null;

            // support passing value (property: Row Separator) by
            // 'context.rs' or 'globalMap.get("rs")'.
            if (((String) "\n").length() > 0) {
                rowSeparator_tFileInputDelimited_1 = ((String) "\n").toCharArray();
            } else {
                throw new IllegalArgumentException("Row Separator must be assigned a char.");
            }

            Object filename_tFileInputDelimited_1 = /**
                                                    * Start field
                                                    * tFileInputDelimited_1:FILENAME
                                                    */
                    "/tmp/ProcessMvCrate_" + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min
                            + ".barcode"/**
                                        * End field
                                        * tFileInputDelimited_1:FILENAME
                                        */
            ;
            com.talend.csv.CSVReader csvReadertFileInputDelimited_1 = null;

            try {

                String[] rowtFileInputDelimited_1 = null;
                int currentLinetFileInputDelimited_1 = 0;
                int outputLinetFileInputDelimited_1 = 0;
                try {// TD110 begin
                    if (filename_tFileInputDelimited_1 instanceof java.io.InputStream) {

                        int footer_value_tFileInputDelimited_1 = 0;
                        if (footer_value_tFileInputDelimited_1 > 0) {
                            throw new Exception(
                                    "When the input source is a stream,footer shouldn't be bigger than 0.");
                        }

                        csvReadertFileInputDelimited_1 = new com.talend.csv.CSVReader(
                                (java.io.InputStream) filename_tFileInputDelimited_1,
                                fieldSeparator_tFileInputDelimited_1[0], "US-ASCII");
                    } else {
                        csvReadertFileInputDelimited_1 = new com.talend.csv.CSVReader(
                                new java.io.BufferedReader(
                                        new java.io.InputStreamReader(
                                                new java.io.FileInputStream(
                                                        String.valueOf(filename_tFileInputDelimited_1)),
                                                "US-ASCII")),
                                fieldSeparator_tFileInputDelimited_1[0]);
                    }

                    csvReadertFileInputDelimited_1.setTrimWhitespace(false);
                    if ((rowSeparator_tFileInputDelimited_1[0] != '\n')
                            && (rowSeparator_tFileInputDelimited_1[0] != '\r'))
                        csvReadertFileInputDelimited_1.setLineEnd("" + rowSeparator_tFileInputDelimited_1[0]);

                    csvReadertFileInputDelimited_1.setQuoteChar('\"');

                    // ?????doesn't work for other escapeChar
                    // the default escape mode is double escape
                    csvReadertFileInputDelimited_1.setEscapeChar(csvReadertFileInputDelimited_1.getQuoteChar());

                    if (footer_tFileInputDelimited_1 > 0) {
                        for (totalLinetFileInputDelimited_1 = 0; totalLinetFileInputDelimited_1 < 0; totalLinetFileInputDelimited_1++) {
                            csvReadertFileInputDelimited_1.readNext();
                        }
                        csvReadertFileInputDelimited_1.setSkipEmptyRecords(false);
                        while (csvReadertFileInputDelimited_1.readNext()) {

                            totalLinetFileInputDelimited_1++;

                        }
                        int lastLineTemptFileInputDelimited_1 = totalLinetFileInputDelimited_1
                                - footer_tFileInputDelimited_1 < 0 ? 0
                                        : totalLinetFileInputDelimited_1 - footer_tFileInputDelimited_1;
                        if (lastLinetFileInputDelimited_1 > 0) {
                            lastLinetFileInputDelimited_1 = lastLinetFileInputDelimited_1 < lastLineTemptFileInputDelimited_1
                                    ? lastLinetFileInputDelimited_1
                                    : lastLineTemptFileInputDelimited_1;
                        } else {
                            lastLinetFileInputDelimited_1 = lastLineTemptFileInputDelimited_1;
                        }

                        csvReadertFileInputDelimited_1.close();
                        if (filename_tFileInputDelimited_1 instanceof java.io.InputStream) {
                            csvReadertFileInputDelimited_1 = new com.talend.csv.CSVReader(
                                    (java.io.InputStream) filename_tFileInputDelimited_1,
                                    fieldSeparator_tFileInputDelimited_1[0], "US-ASCII");
                        } else {
                            csvReadertFileInputDelimited_1 = new com.talend.csv.CSVReader(
                                    new java.io.BufferedReader(new java.io.InputStreamReader(
                                            new java.io.FileInputStream(
                                                    String.valueOf(filename_tFileInputDelimited_1)),
                                            "US-ASCII")),
                                    fieldSeparator_tFileInputDelimited_1[0]);
                        }
                        csvReadertFileInputDelimited_1.setTrimWhitespace(false);
                        if ((rowSeparator_tFileInputDelimited_1[0] != '\n')
                                && (rowSeparator_tFileInputDelimited_1[0] != '\r'))
                            csvReadertFileInputDelimited_1
                                    .setLineEnd("" + rowSeparator_tFileInputDelimited_1[0]);

                        csvReadertFileInputDelimited_1.setQuoteChar('\"');

                        // ?????doesn't work for other escapeChar
                        // the default escape mode is double escape
                        csvReadertFileInputDelimited_1
                                .setEscapeChar(csvReadertFileInputDelimited_1.getQuoteChar());

                    }

                    if (limittFileInputDelimited_1 != 0) {
                        for (currentLinetFileInputDelimited_1 = 0; currentLinetFileInputDelimited_1 < 0; currentLinetFileInputDelimited_1++) {
                            csvReadertFileInputDelimited_1.readNext();
                        }
                    }
                    csvReadertFileInputDelimited_1.setSkipEmptyRecords(false);

                } catch (Exception e) {

                    System.err.println(e.getMessage());

                } // TD110 end

                while (limittFileInputDelimited_1 != 0 && csvReadertFileInputDelimited_1 != null
                        && csvReadertFileInputDelimited_1.readNext()) {

                    rowtFileInputDelimited_1 = csvReadertFileInputDelimited_1.getValues();

                    currentLinetFileInputDelimited_1++;

                    if (lastLinetFileInputDelimited_1 > -1
                            && currentLinetFileInputDelimited_1 > lastLinetFileInputDelimited_1) {
                        break;
                    }
                    outputLinetFileInputDelimited_1++;
                    if (limittFileInputDelimited_1 > 0
                            && outputLinetFileInputDelimited_1 > limittFileInputDelimited_1) {
                        break;
                    }

                    batcode_file = null;

                    boolean whetherReject_tFileInputDelimited_1 = false;
                    batcode_file = new batcode_fileStruct();
                    try {

                        rowHelper_tFileInputDelimited_1.valueToConn(rowtFileInputDelimited_1, batcode_file);

                    } catch (Exception e) {
                        whetherReject_tFileInputDelimited_1 = true;

                        System.err.println(e.getMessage());
                        batcode_file = null;

                    }

                    /**
                     * [tFileInputDelimited_1 begin ] stop
                     */
                    /**
                     * [tFileInputDelimited_1 main ] start
                     */

                    currentComponent = "tFileInputDelimited_1";

                    tos_count_tFileInputDelimited_1++;

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

                        /**
                         * [tMap_3 main ] start
                         */

                        currentComponent = "tMap_3";

                        boolean hasCasePrimitiveKeyWithNull_tMap_3 = false;

                        // ###############################
                        // # Input tables (lookups)
                        boolean rejectedInnerJoin_tMap_3 = false;
                        boolean mainRowRejected_tMap_3 = false;

                        // /////////////////////////////////////////////
                        // Starting Lookup Table "handler_list"
                        // /////////////////////////////////////////////

                        boolean forceLoophandler_list = false;

                        handler_listStruct handler_listObjectFromLookup = null;

                        if (!rejectedInnerJoin_tMap_3) { // G_TM_M_020

                            hasCasePrimitiveKeyWithNull_tMap_3 = false;

                            handler_listHashKey.handler_code = batcode_file.person_scanning;

                            handler_listHashKey.hashCodeDirty = true;

                            tHash_Lookup_handler_list.lookup(handler_listHashKey);

                        } // G_TM_M_020

                        if (tHash_Lookup_handler_list != null
                                && tHash_Lookup_handler_list.getCount(handler_listHashKey) > 1) { // G
                            // 071

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

                        handler_listStruct handler_list = null;

                        handler_listStruct fromLookup_handler_list = null;
                        handler_list = handler_listDefault;

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

                            fromLookup_handler_list = tHash_Lookup_handler_list.next();

                        } // G 099

                        if (fromLookup_handler_list != null) {
                            handler_list = fromLookup_handler_list;
                        }

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

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

                            Var__tMap_3__Struct Var = Var__tMap_3;// ###############################
                            // ###############################
                            // # Output tables

                            barcode_wName = null;

                            // # Output table : 'barcode_wName'
                            barcode_wName_tmp.reason_for_move = batcode_file.reason_for_move;
                            barcode_wName_tmp.person_scanning = handler_list.handler_displname;
                            barcode_wName_tmp.date_time = batcode_file.date_time;
                            barcode_wName_tmp.current_crate = batcode_file.current_crate;
                            barcode_wName_tmp.new_location = batcode_file.new_location;
                            barcode_wName = barcode_wName_tmp;
                            // ###############################

                        } // end of Var scope

                        rejectedInnerJoin_tMap_3 = false;

                        tos_count_tMap_3++;

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

                            /**
                             * [tSortRow_3_SortOut main ] start
                             */

                            currentComponent = "tSortRow_3_SortOut";

                            Comparablebarcode_wNameStruct arrayRowtSortRow_3_SortOut = new Comparablebarcode_wNameStruct();

                            arrayRowtSortRow_3_SortOut.reason_for_move = barcode_wName.reason_for_move;
                            arrayRowtSortRow_3_SortOut.person_scanning = barcode_wName.person_scanning;
                            arrayRowtSortRow_3_SortOut.date_time = barcode_wName.date_time;
                            arrayRowtSortRow_3_SortOut.current_crate = barcode_wName.current_crate;
                            arrayRowtSortRow_3_SortOut.new_location = barcode_wName.new_location;
                            list_tSortRow_3_SortOut.add(arrayRowtSortRow_3_SortOut);

                            tos_count_tSortRow_3_SortOut++;

                            /**
                             * [tSortRow_3_SortOut main ] stop
                             */

                        } // End of branch "barcode_wName"

                    } // End of branch "batcode_file"

                    /**
                     * [tFileInputDelimited_1 end ] start
                     */

                    currentComponent = "tFileInputDelimited_1";

                    nb_line_tFileInputDelimited_1++;
                }

            } finally {
                if (!(filename_tFileInputDelimited_1 instanceof java.io.InputStream)) {
                    if (csvReadertFileInputDelimited_1 != null) {
                        csvReadertFileInputDelimited_1.close();
                    }
                }
                if (csvReadertFileInputDelimited_1 != null) {
                    globalMap.put("tFileInputDelimited_1_NB_LINE", nb_line_tFileInputDelimited_1);
                }
            }

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

            /**
             * [tFileInputDelimited_1 end ] stop
             */

            /**
             * [tMap_3 end ] start
             */

            currentComponent = "tMap_3";

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

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

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

            /**
             * [tMap_3 end ] stop
             */

            /**
             * [tSortRow_3_SortOut end ] start
             */

            currentComponent = "tSortRow_3_SortOut";

            barcode_wNameStruct[] array_tSortRow_3_SortOut = list_tSortRow_3_SortOut
                    .toArray(new Comparablebarcode_wNameStruct[0]);

            java.util.Arrays.sort(array_tSortRow_3_SortOut);

            globalMap.put("tSortRow_3", array_tSortRow_3_SortOut);

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

            /**
             * [tSortRow_3_SortOut end ] stop
             */

            /**
             * [tFileOutputDelimited_7 begin ] start
             */

            ok_Hash.put("tFileOutputDelimited_7", false);
            start_Hash.put("tFileOutputDelimited_7", System.currentTimeMillis());
            currentComponent = "tFileOutputDelimited_7";

            int tos_count_tFileOutputDelimited_7 = 0;

            String fileName_tFileOutputDelimited_7 = "";
            fileName_tFileOutputDelimited_7 = (new java.io.File("../temp/location/barcode_no_obj_yet_txt."
                    + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".txt")).getAbsolutePath()
                            .replace("\\", "/");
            String fullName_tFileOutputDelimited_7 = null;
            String extension_tFileOutputDelimited_7 = null;
            String directory_tFileOutputDelimited_7 = null;
            if ((fileName_tFileOutputDelimited_7.indexOf("/") != -1)) {
                if (fileName_tFileOutputDelimited_7.lastIndexOf(".") < fileName_tFileOutputDelimited_7
                        .lastIndexOf("/")) {
                    fullName_tFileOutputDelimited_7 = fileName_tFileOutputDelimited_7;
                    extension_tFileOutputDelimited_7 = "";
                } else {
                    fullName_tFileOutputDelimited_7 = fileName_tFileOutputDelimited_7.substring(0,
                            fileName_tFileOutputDelimited_7.lastIndexOf("."));
                    extension_tFileOutputDelimited_7 = fileName_tFileOutputDelimited_7
                            .substring(fileName_tFileOutputDelimited_7.lastIndexOf("."));
                }
                directory_tFileOutputDelimited_7 = fileName_tFileOutputDelimited_7.substring(0,
                        fileName_tFileOutputDelimited_7.lastIndexOf("/"));
            } else {
                if (fileName_tFileOutputDelimited_7.lastIndexOf(".") != -1) {
                    fullName_tFileOutputDelimited_7 = fileName_tFileOutputDelimited_7.substring(0,
                            fileName_tFileOutputDelimited_7.lastIndexOf("."));
                    extension_tFileOutputDelimited_7 = fileName_tFileOutputDelimited_7
                            .substring(fileName_tFileOutputDelimited_7.lastIndexOf("."));
                } else {
                    fullName_tFileOutputDelimited_7 = fileName_tFileOutputDelimited_7;
                    extension_tFileOutputDelimited_7 = "";
                }
                directory_tFileOutputDelimited_7 = "";
            }
            boolean isFileGenerated_tFileOutputDelimited_7 = true;
            java.io.File filetFileOutputDelimited_7 = new java.io.File(fileName_tFileOutputDelimited_7);
            globalMap.put("tFileOutputDelimited_7_FILE_NAME", fileName_tFileOutputDelimited_7);

            int nb_line_tFileOutputDelimited_7 = 0;
            int splitEvery_tFileOutputDelimited_7 = 1000;
            int splitedFileNo_tFileOutputDelimited_7 = 0;
            int currentRow_tFileOutputDelimited_7 = 0;

            final String OUT_DELIM_tFileOutputDelimited_7 = /**
                                                            * Start field
                                                            * tFileOutputDelimited_7:FIELDSEPARATOR
                                                            */
                    ";"/** End field tFileOutputDelimited_7:FIELDSEPARATOR */
            ;

            final String OUT_DELIM_ROWSEP_tFileOutputDelimited_7 = /**
                                                                   * Start
                                                                   * field tFileOutputDelimited_7:ROWSEPARATOR
                                                                   */
                    "\n"/** End field tFileOutputDelimited_7:ROWSEPARATOR */
            ;

            // create directory only if not exists
            if (directory_tFileOutputDelimited_7 != null
                    && directory_tFileOutputDelimited_7.trim().length() != 0) {
                java.io.File dir_tFileOutputDelimited_7 = new java.io.File(directory_tFileOutputDelimited_7);
                if (!dir_tFileOutputDelimited_7.exists()) {
                    dir_tFileOutputDelimited_7.mkdirs();
                }
            }

            // routines.system.Row
            java.io.Writer outtFileOutputDelimited_7 = null;
            try {
                outtFileOutputDelimited_7 = new java.io.BufferedWriter(new java.io.OutputStreamWriter(
                        new java.io.FileOutputStream(fileName_tFileOutputDelimited_7, false), "ISO-8859-15"));

                if (filetFileOutputDelimited_7.length() == 0) {

                    outtFileOutputDelimited_7.write("reason_for_move");

                    outtFileOutputDelimited_7.write(OUT_DELIM_tFileOutputDelimited_7);

                    outtFileOutputDelimited_7.write("person_scanning");

                    outtFileOutputDelimited_7.write(OUT_DELIM_tFileOutputDelimited_7);

                    outtFileOutputDelimited_7.write("date_time");

                    outtFileOutputDelimited_7.write(OUT_DELIM_tFileOutputDelimited_7);

                    outtFileOutputDelimited_7.write("current_crate");

                    outtFileOutputDelimited_7.write(OUT_DELIM_tFileOutputDelimited_7);

                    outtFileOutputDelimited_7.write("new_location");

                    outtFileOutputDelimited_7.write(OUT_DELIM_tFileOutputDelimited_7);

                    outtFileOutputDelimited_7.write("person_refname");

                    outtFileOutputDelimited_7.write(OUT_DELIM_tFileOutputDelimited_7);

                    outtFileOutputDelimited_7.write("crate_refname");

                    outtFileOutputDelimited_7.write(OUT_DELIM_tFileOutputDelimited_7);

                    outtFileOutputDelimited_7.write("loc_refname");

                    outtFileOutputDelimited_7.write(OUT_DELIM_tFileOutputDelimited_7);

                    outtFileOutputDelimited_7.write("moveID");

                    outtFileOutputDelimited_7.write(OUT_DELIM_tFileOutputDelimited_7);

                    outtFileOutputDelimited_7.write("move_CSID");

                    outtFileOutputDelimited_7.write(OUT_DELIM_tFileOutputDelimited_7);

                    outtFileOutputDelimited_7.write("datetimeTZ");

                    outtFileOutputDelimited_7.write(OUT_DELIM_ROWSEP_tFileOutputDelimited_7);
                    outtFileOutputDelimited_7.flush();
                }

                /**
                 * [tFileOutputDelimited_7 begin ] stop
                 */

                /**
                 * [tAdvancedFileOutputXML_4 begin ] start
                 */

                ok_Hash.put("tAdvancedFileOutputXML_4", false);
                start_Hash.put("tAdvancedFileOutputXML_4", System.currentTimeMillis());
                currentComponent = "tAdvancedFileOutputXML_4";

                int tos_count_tAdvancedFileOutputXML_4 = 0;

                int nb_line_tAFOX_4 = 0;

                boolean needRoot_tAFOX_4 = true;

                String fileName_tAFOX_4 = "../temp/location/barcodeMvCrate." + TalendDate.getDate("CCYY-MM-DD")
                        + "-" + context.infile_min + ".xml";
                Boolean alreadyExistsFile_tAFOX_4 = new java.io.File(fileName_tAFOX_4).exists();
                fileName_tAFOX_4 = new java.io.File(fileName_tAFOX_4).getAbsolutePath().replace("\\", "/");
                String file_tAFOX_4 = "";

                if (fileName_tAFOX_4.indexOf("/") < 0) {
                    throw new IllegalArgumentException("not a correct file name.");
                } else {
                    String tail_tAFOX_4 = fileName_tAFOX_4.substring(fileName_tAFOX_4.lastIndexOf("/"));
                    file_tAFOX_4 = tail_tAFOX_4.lastIndexOf(".") > 0
                            ? fileName_tAFOX_4.substring(0, fileName_tAFOX_4.lastIndexOf("."))
                            : fileName_tAFOX_4;
                }
                java.io.File createFiletAFOX_4 = new java.io.File(fileName_tAFOX_4);

                if (!createFiletAFOX_4.exists()) {
                    (new java.io.File(fileName_tAFOX_4.substring(0, fileName_tAFOX_4.lastIndexOf("/"))))
                            .mkdirs();
                    needRoot_tAFOX_4 = true;
                }

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

                class NestXMLTool_tAFOX_4 {
                    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 (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) {
                            boolean isDefaultNameSpaceAtRoot = ""
                                    .equals(nestRoot.getQName().getNamespace().getPrefix());
                            for (org.dom4j.Element tmp : (java.util.List<org.dom4j.Element>) nestRoot
                                    .elements()) {
                                if (("").equals(tmp.getQName().getNamespace().getURI())
                                        && ("").equals(tmp.getQName().getNamespace().getPrefix())
                                        && isDefaultNameSpaceAtRoot) {
                                    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);
                                }
                            }
                        }
                    }

                    /**
                     * remove the whiteSpace Node between the elements when
                     * appending the source file under dom4j
                     * 
                     * @param root
                     */
                    public void removeWhiteSpaceTextNode(org.dom4j.Element root) {
                        if (root != null) {
                            List<org.dom4j.Node> textNodes = new java.util.ArrayList<org.dom4j.Node>();
                            for (int i = 0; i < root.nodeCount(); i++) {
                                if (root.node(i).getNodeType() == org.dom4j.Node.ELEMENT_NODE) {
                                    removeWhiteSpaceTextNode((org.dom4j.Element) root.node(i));
                                } else if (root.node(i).getNodeType() == org.dom4j.Node.TEXT_NODE) {
                                    textNodes.add(root.node(i));
                                }
                            }
                            if (root.nodeCount() > 1) { // when
                                // root.nodeCount==1,
                                // that means the
                                // text node is the
                                // content of the
                                // element
                                for (org.dom4j.Node textNode : textNodes) {
                                    if (textNode.getText() == null || "".equals(textNode.getText().trim())) {
                                        root.remove(textNode);
                                    }
                                }
                            }
                        }
                    }
                }

                NestXMLTool_tAFOX_4 nestXMLTool_tAFOX_4 = new NestXMLTool_tAFOX_4();
                // sort group root element for judgement of group
                java.util.List<org.dom4j.Element> groupElementList_tAFOX_4 = new java.util.ArrayList<org.dom4j.Element>();
                org.dom4j.Element root4Group_tAFOX_4 = null;
                org.dom4j.Document doc_tAFOX_4 = null;

                doc_tAFOX_4 = org.dom4j.DocumentHelper.createDocument();

                org.dom4j.io.OutputFormat format_tAFOX_4 = org.dom4j.io.OutputFormat.createPrettyPrint();

                format_tAFOX_4.setTrimText(false);
                format_tAFOX_4.setEncoding("UTF-8");

                int[] orders_tAFOX_4 = new int[1];

                /**
                 * [tAdvancedFileOutputXML_4 begin ] stop
                 */

                /**
                 * [tFileOutputDelimited_8 begin ] start
                 */

                ok_Hash.put("tFileOutputDelimited_8", false);
                start_Hash.put("tFileOutputDelimited_8", System.currentTimeMillis());
                currentComponent = "tFileOutputDelimited_8";

                int tos_count_tFileOutputDelimited_8 = 0;

                String fileName_tFileOutputDelimited_8 = "";
                fileName_tFileOutputDelimited_8 = (new java.io.File("../temp/location/barcodeMvCrate_CSID."
                        + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".txt"))
                                .getAbsolutePath().replace("\\", "/");
                String fullName_tFileOutputDelimited_8 = null;
                String extension_tFileOutputDelimited_8 = null;
                String directory_tFileOutputDelimited_8 = null;
                if ((fileName_tFileOutputDelimited_8.indexOf("/") != -1)) {
                    if (fileName_tFileOutputDelimited_8.lastIndexOf(".") < fileName_tFileOutputDelimited_8
                            .lastIndexOf("/")) {
                        fullName_tFileOutputDelimited_8 = fileName_tFileOutputDelimited_8;
                        extension_tFileOutputDelimited_8 = "";
                    } else {
                        fullName_tFileOutputDelimited_8 = fileName_tFileOutputDelimited_8.substring(0,
                                fileName_tFileOutputDelimited_8.lastIndexOf("."));
                        extension_tFileOutputDelimited_8 = fileName_tFileOutputDelimited_8
                                .substring(fileName_tFileOutputDelimited_8.lastIndexOf("."));
                    }
                    directory_tFileOutputDelimited_8 = fileName_tFileOutputDelimited_8.substring(0,
                            fileName_tFileOutputDelimited_8.lastIndexOf("/"));
                } else {
                    if (fileName_tFileOutputDelimited_8.lastIndexOf(".") != -1) {
                        fullName_tFileOutputDelimited_8 = fileName_tFileOutputDelimited_8.substring(0,
                                fileName_tFileOutputDelimited_8.lastIndexOf("."));
                        extension_tFileOutputDelimited_8 = fileName_tFileOutputDelimited_8
                                .substring(fileName_tFileOutputDelimited_8.lastIndexOf("."));
                    } else {
                        fullName_tFileOutputDelimited_8 = fileName_tFileOutputDelimited_8;
                        extension_tFileOutputDelimited_8 = "";
                    }
                    directory_tFileOutputDelimited_8 = "";
                }
                boolean isFileGenerated_tFileOutputDelimited_8 = true;
                java.io.File filetFileOutputDelimited_8 = new java.io.File(fileName_tFileOutputDelimited_8);
                globalMap.put("tFileOutputDelimited_8_FILE_NAME", fileName_tFileOutputDelimited_8);

                int nb_line_tFileOutputDelimited_8 = 0;
                int splitEvery_tFileOutputDelimited_8 = 1000;
                int splitedFileNo_tFileOutputDelimited_8 = 0;
                int currentRow_tFileOutputDelimited_8 = 0;

                final String OUT_DELIM_tFileOutputDelimited_8 = /**
                                                                * Start
                                                                * field tFileOutputDelimited_8:FIELDSEPARATOR
                                                                */
                        ";"/** End field tFileOutputDelimited_8:FIELDSEPARATOR */
                ;

                final String OUT_DELIM_ROWSEP_tFileOutputDelimited_8 = /**
                                                                       * 
                                                                       * Start field tFileOutputDelimited_8:ROWSEPARATOR
                                                                       */
                        "\n"/** End field tFileOutputDelimited_8:ROWSEPARATOR */
                ;

                // create directory only if not exists
                if (directory_tFileOutputDelimited_8 != null
                        && directory_tFileOutputDelimited_8.trim().length() != 0) {
                    java.io.File dir_tFileOutputDelimited_8 = new java.io.File(
                            directory_tFileOutputDelimited_8);
                    if (!dir_tFileOutputDelimited_8.exists()) {
                        dir_tFileOutputDelimited_8.mkdirs();
                    }
                }

                // routines.system.Row
                java.io.Writer outtFileOutputDelimited_8 = null;
                try {
                    outtFileOutputDelimited_8 = new java.io.BufferedWriter(new java.io.OutputStreamWriter(
                            new java.io.FileOutputStream(fileName_tFileOutputDelimited_8, false), "UTF-8"));

                    /**
                     * [tFileOutputDelimited_8 begin ] stop
                     */

                    /**
                     * [tAdvancedHash_barcode_no_obj_yet begin ] start
                     */

                    ok_Hash.put("tAdvancedHash_barcode_no_obj_yet", false);
                    start_Hash.put("tAdvancedHash_barcode_no_obj_yet", System.currentTimeMillis());
                    currentComponent = "tAdvancedHash_barcode_no_obj_yet";

                    int tos_count_tAdvancedHash_barcode_no_obj_yet = 0;

                    // connection name:barcode_no_obj_yet
                    // source node:tMap_5 -
                    // inputs:(barcode,person_displayname,crateinfo,locinfo)
                    // outputs:(barcode_no_obj_yet,barcode_no_obj_yet_txt,mvCrate_XML,mvCrate_CSID,barcode_no_obj_yet)
                    // | target node:tAdvancedHash_barcode_no_obj_yet -
                    // inputs:(barcode_no_obj_yet) outputs:()
                    // linked node: tMap_1 -
                    // inputs:(obj_IDs,barcode_no_obj_yet)
                    // outputs:(ID,unmatch_loc,move2obj_XML,obj2move_XML)

                    org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE matchingModeEnum_barcode_no_obj_yet = org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE.ALL_MATCHES;

                    org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<barcode_no_obj_yetStruct> tHash_Lookup_barcode_no_obj_yet = org.talend.designer.components.lookup.memory.AdvancedMemoryLookup
                            .<barcode_no_obj_yetStruct>getLookup(matchingModeEnum_barcode_no_obj_yet);

                    globalMap.put("tHash_Lookup_barcode_no_obj_yet", tHash_Lookup_barcode_no_obj_yet);

                    /**
                     * [tAdvancedHash_barcode_no_obj_yet begin ] stop
                     */

                    /**
                     * [tMap_5 begin ] start
                     */

                    ok_Hash.put("tMap_5", false);
                    start_Hash.put("tMap_5", System.currentTimeMillis());
                    currentComponent = "tMap_5";

                    int tos_count_tMap_5 = 0;

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

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

                    person_displaynameStruct person_displaynameHashKey = new person_displaynameStruct();
                    person_displaynameStruct person_displaynameDefault = new person_displaynameStruct();

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

                    crateinfoStruct crateinfoHashKey = new crateinfoStruct();
                    crateinfoStruct crateinfoDefault = new crateinfoStruct();

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

                    locinfoStruct locinfoHashKey = new locinfoStruct();
                    locinfoStruct locinfoDefault = new locinfoStruct();
                    // ###############################

                    // ###############################
                    // # Vars initialization
                    class Var__tMap_5__Struct {
                        String moveID;
                        String move_CSID;
                        java.util.Date Talend_date;
                        String date;
                        String datetime;
                        String datetimeTZ;
                        String reason4move;
                        String computedSummary;
                    }
                    Var__tMap_5__Struct Var__tMap_5 = new Var__tMap_5__Struct();
                    // ###############################

                    // ###############################
                    // # Outputs initialization
                    barcode_no_obj_yetStruct barcode_no_obj_yet_tmp = new barcode_no_obj_yetStruct();
                    barcode_no_obj_yet_txtStruct barcode_no_obj_yet_txt_tmp = new barcode_no_obj_yet_txtStruct();
                    mvCrate_XMLStruct mvCrate_XML_tmp = new mvCrate_XMLStruct();
                    mvCrate_CSIDStruct mvCrate_CSID_tmp = new mvCrate_CSIDStruct();
                    // ###############################

                    /**
                     * [tMap_5 begin ] stop
                     */

                    /**
                     * [tUniqRow_1 begin ] start
                     */

                    ok_Hash.put("tUniqRow_1", false);
                    start_Hash.put("tUniqRow_1", System.currentTimeMillis());
                    currentComponent = "tUniqRow_1";

                    int tos_count_tUniqRow_1 = 0;

                    class KeyStruct_tUniqRow_1 {

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

                        String reason_for_move;
                        String person_scanning;
                        String date_time;
                        String current_crate;
                        String new_location;

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

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

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

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

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

                                result = prime * result
                                        + ((this.new_location == null) ? 0 : this.new_location.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 KeyStruct_tUniqRow_1 other = (KeyStruct_tUniqRow_1) obj;

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

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

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

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

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

                            return true;
                        }

                    }

                    int nb_uniques_tUniqRow_1 = 0;
                    int nb_duplicates_tUniqRow_1 = 0;
                    KeyStruct_tUniqRow_1 finder_tUniqRow_1 = new KeyStruct_tUniqRow_1();
                    java.util.Set<KeyStruct_tUniqRow_1> keystUniqRow_1 = new java.util.HashSet<KeyStruct_tUniqRow_1>();
                    java.util.Set<KeyStruct_tUniqRow_1> keysForDuplicatedtUniqRow_1 = new java.util.HashSet<KeyStruct_tUniqRow_1>();

                    /**
                     * [tUniqRow_1 begin ] stop
                     */

                    /**
                     * [tSortRow_3_SortIn begin ] start
                     */

                    ok_Hash.put("tSortRow_3_SortIn", false);
                    start_Hash.put("tSortRow_3_SortIn", System.currentTimeMillis());
                    currentComponent = "tSortRow_3_SortIn";

                    int tos_count_tSortRow_3_SortIn = 0;

                    barcode_wNameStruct[] array_tSortRow_3_SortIn = (barcode_wNameStruct[]) globalMap
                            .get("tSortRow_3");

                    int nb_line_tSortRow_3_SortIn = 0;

                    barcode_wNameStruct current_tSortRow_3_SortIn = null;

                    for (int i_tSortRow_3_SortIn = 0; i_tSortRow_3_SortIn < array_tSortRow_3_SortIn.length; i_tSortRow_3_SortIn++) {
                        current_tSortRow_3_SortIn = array_tSortRow_3_SortIn[i_tSortRow_3_SortIn];
                        row2.reason_for_move = current_tSortRow_3_SortIn.reason_for_move;
                        row2.person_scanning = current_tSortRow_3_SortIn.person_scanning;
                        row2.date_time = current_tSortRow_3_SortIn.date_time;
                        row2.current_crate = current_tSortRow_3_SortIn.current_crate;
                        row2.new_location = current_tSortRow_3_SortIn.new_location;
                        // increase number of line sorted
                        nb_line_tSortRow_3_SortIn++;

                        /**
                         * [tSortRow_3_SortIn begin ] stop
                         */
                        /**
                         * [tSortRow_3_SortIn main ] start
                         */

                        currentComponent = "tSortRow_3_SortIn";

                        tos_count_tSortRow_3_SortIn++;

                        /**
                         * [tSortRow_3_SortIn main ] stop
                         */

                        /**
                         * [tUniqRow_1 main ] start
                         */

                        currentComponent = "tUniqRow_1";

                        barcode = null;
                        if (row2.reason_for_move == null) {
                            finder_tUniqRow_1.reason_for_move = null;
                        } else {
                            finder_tUniqRow_1.reason_for_move = row2.reason_for_move.toLowerCase();
                        }
                        if (row2.person_scanning == null) {
                            finder_tUniqRow_1.person_scanning = null;
                        } else {
                            finder_tUniqRow_1.person_scanning = row2.person_scanning.toLowerCase();
                        }
                        if (row2.date_time == null) {
                            finder_tUniqRow_1.date_time = null;
                        } else {
                            finder_tUniqRow_1.date_time = row2.date_time.toLowerCase();
                        }
                        if (row2.current_crate == null) {
                            finder_tUniqRow_1.current_crate = null;
                        } else {
                            finder_tUniqRow_1.current_crate = row2.current_crate.toLowerCase();
                        }
                        if (row2.new_location == null) {
                            finder_tUniqRow_1.new_location = null;
                        } else {
                            finder_tUniqRow_1.new_location = row2.new_location.toLowerCase();
                        }
                        finder_tUniqRow_1.hashCodeDirty = true;
                        if (!keystUniqRow_1.contains(finder_tUniqRow_1)) {
                            KeyStruct_tUniqRow_1 new_tUniqRow_1 = new KeyStruct_tUniqRow_1();

                            if (row2.reason_for_move == null) {
                                new_tUniqRow_1.reason_for_move = null;
                            } else {
                                new_tUniqRow_1.reason_for_move = row2.reason_for_move.toLowerCase();
                            }
                            if (row2.person_scanning == null) {
                                new_tUniqRow_1.person_scanning = null;
                            } else {
                                new_tUniqRow_1.person_scanning = row2.person_scanning.toLowerCase();
                            }
                            if (row2.date_time == null) {
                                new_tUniqRow_1.date_time = null;
                            } else {
                                new_tUniqRow_1.date_time = row2.date_time.toLowerCase();
                            }
                            if (row2.current_crate == null) {
                                new_tUniqRow_1.current_crate = null;
                            } else {
                                new_tUniqRow_1.current_crate = row2.current_crate.toLowerCase();
                            }
                            if (row2.new_location == null) {
                                new_tUniqRow_1.new_location = null;
                            } else {
                                new_tUniqRow_1.new_location = row2.new_location.toLowerCase();
                            }

                            keystUniqRow_1.add(new_tUniqRow_1);
                            if (barcode == null) {
                                barcode = new barcodeStruct();
                            }
                            barcode.reason_for_move = row2.reason_for_move;
                            barcode.person_scanning = row2.person_scanning;
                            barcode.date_time = row2.date_time;
                            barcode.current_crate = row2.current_crate;
                            barcode.new_location = row2.new_location;
                            nb_uniques_tUniqRow_1++;
                        } else {
                            nb_duplicates_tUniqRow_1++;
                        }

                        tos_count_tUniqRow_1++;

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

                            /**
                             * [tMap_5 main ] start
                             */

                            currentComponent = "tMap_5";

                            boolean hasCasePrimitiveKeyWithNull_tMap_5 = false;

                            // ###############################
                            // # Input tables (lookups)
                            boolean rejectedInnerJoin_tMap_5 = false;
                            boolean mainRowRejected_tMap_5 = false;

                            // /////////////////////////////////////////////
                            // Starting Lookup Table "person_displayname"
                            // /////////////////////////////////////////////

                            boolean forceLoopperson_displayname = false;

                            person_displaynameStruct person_displaynameObjectFromLookup = null;

                            if (!rejectedInnerJoin_tMap_5) { // G_TM_M_020

                                hasCasePrimitiveKeyWithNull_tMap_5 = false;

                                person_displaynameHashKey.displayName = barcode.person_scanning;

                                person_displaynameHashKey.hashCodeDirty = true;

                                tHash_Lookup_person_displayname.lookup(person_displaynameHashKey);

                            } // G_TM_M_020

                            if (tHash_Lookup_person_displayname != null && tHash_Lookup_person_displayname
                                    .getCount(person_displaynameHashKey) > 1) { // G
                                // 071

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

                            person_displaynameStruct person_displayname = null;

                            person_displaynameStruct fromLookup_person_displayname = null;
                            person_displayname = person_displaynameDefault;

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

                                fromLookup_person_displayname = tHash_Lookup_person_displayname.next();

                            } // G 099

                            if (fromLookup_person_displayname != null) {
                                person_displayname = fromLookup_person_displayname;
                            }

                            // /////////////////////////////////////////////
                            // Starting Lookup Table "crateinfo"
                            // /////////////////////////////////////////////

                            boolean forceLoopcrateinfo = false;

                            crateinfoStruct crateinfoObjectFromLookup = null;

                            if (!rejectedInnerJoin_tMap_5) { // G_TM_M_020

                                hasCasePrimitiveKeyWithNull_tMap_5 = false;

                                crateinfoHashKey.crate_displayname = barcode.current_crate;

                                crateinfoHashKey.hashCodeDirty = true;

                                tHash_Lookup_crateinfo.lookup(crateinfoHashKey);

                            } // G_TM_M_020

                            if (tHash_Lookup_crateinfo != null
                                    && tHash_Lookup_crateinfo.getCount(crateinfoHashKey) > 1) { // G
                                // 071

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

                            crateinfoStruct crateinfo = null;

                            crateinfoStruct fromLookup_crateinfo = null;
                            crateinfo = crateinfoDefault;

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

                                fromLookup_crateinfo = tHash_Lookup_crateinfo.next();

                            } // G 099

                            if (fromLookup_crateinfo != null) {
                                crateinfo = fromLookup_crateinfo;
                            }

                            // /////////////////////////////////////////////
                            // Starting Lookup Table "locinfo"
                            // /////////////////////////////////////////////

                            boolean forceLooplocinfo = false;

                            locinfoStruct locinfoObjectFromLookup = null;

                            if (!rejectedInnerJoin_tMap_5) { // G_TM_M_020

                                hasCasePrimitiveKeyWithNull_tMap_5 = false;

                                locinfoHashKey.loc_displayname = barcode.new_location;

                                locinfoHashKey.hashCodeDirty = true;

                                tHash_Lookup_locinfo.lookup(locinfoHashKey);

                            } // G_TM_M_020

                            if (tHash_Lookup_locinfo != null
                                    && tHash_Lookup_locinfo.getCount(locinfoHashKey) > 1) { // G
                                // 071

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

                            locinfoStruct locinfo = null;

                            locinfoStruct fromLookup_locinfo = null;
                            locinfo = locinfoDefault;

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

                                fromLookup_locinfo = tHash_Lookup_locinfo.next();

                            } // G 099

                            if (fromLookup_locinfo != null) {
                                locinfo = fromLookup_locinfo;
                            }

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

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

                                Var__tMap_5__Struct Var = Var__tMap_5;
                                Var.moveID = "Barcode." + TalendDate.getDate("CCYYMMDD-hhmm") + "-"
                                        + StringHandling.TRIM(barcode.reason_for_move) + "."
                                        + String.format("%04d", Numeric.sequence("", 1, 1));
                                Var.move_CSID = Guid.getUUID();
                                Var.Talend_date = (barcode.date_time == null || barcode.date_time.equals(""))
                                        ? null
                                        : (TalendDate.addDate(
                                                TalendDate.parseDate("MM/dd/yyyy HH:mm", barcode.date_time), 0,
                                                "HH"));
                                Var.date = Relational.ISNULL(Var.Talend_date) ? ""
                                        : TalendDate.formatDate("yyyy-MM-dd", Var.Talend_date);
                                Var.datetime = Relational.ISNULL(Var.Talend_date) ? ""
                                        : TalendDate.formatDate("yyyy-MM-dd HH:mm:ss", Var.Talend_date);
                                Var.datetimeTZ = Var.datetime.equals("") ? ""
                                        : Var.datetime.substring(0, 10) + "T" + Var.datetime.substring(11)
                                                + "Z";
                                Var.reason4move = StringHandling.UPCASE(barcode.reason_for_move).equals("R")
                                        ? "Object relocation"
                                        : "";
                                Var.computedSummary = Relational.NOT(Relational.ISNULL(Var.reason4move))
                                        ? (Var.reason4move == "(not entered)"
                                                || Var.reason4move.equals("(not entered)"))
                                                        ? (Var.date + " " + Var.reason4move)
                                                        : (Var.date + " (" + Var.reason4move + ")")
                                        : null;// ###############################
                                // ###############################
                                // # Output tables

                                barcode_no_obj_yet = null;
                                barcode_no_obj_yet_txt = null;
                                mvCrate_XML = null;
                                mvCrate_CSID = null;

                                // # Output table : 'barcode_no_obj_yet'
                                barcode_no_obj_yet_tmp.reason_for_move = barcode.reason_for_move;
                                barcode_no_obj_yet_tmp.person_scanning = barcode.person_scanning;
                                barcode_no_obj_yet_tmp.date_time = barcode.date_time;
                                barcode_no_obj_yet_tmp.current_crate = barcode.current_crate;
                                barcode_no_obj_yet_tmp.new_location = barcode.new_location;
                                barcode_no_obj_yet_tmp.person_refname = person_displayname.person_refname;
                                barcode_no_obj_yet_tmp.crate_refname = crateinfo.crate_refname;
                                barcode_no_obj_yet_tmp.loc_refname = locinfo.loc_refname;
                                barcode_no_obj_yet_tmp.datetimeTZ = Var.datetimeTZ;
                                barcode_no_obj_yet_tmp.moveID = Var.moveID;
                                barcode_no_obj_yet_tmp.move_CSID = Var.move_CSID;
                                barcode_no_obj_yet = barcode_no_obj_yet_tmp;

                                // # Output table : 'barcode_no_obj_yet_txt'
                                barcode_no_obj_yet_txt_tmp.reason_for_move = barcode.reason_for_move;
                                barcode_no_obj_yet_txt_tmp.person_scanning = barcode.person_scanning;
                                barcode_no_obj_yet_txt_tmp.date_time = barcode.date_time;
                                barcode_no_obj_yet_txt_tmp.current_crate = barcode.current_crate;
                                barcode_no_obj_yet_txt_tmp.new_location = barcode.new_location;
                                barcode_no_obj_yet_txt_tmp.person_refname = person_displayname.person_refname;
                                barcode_no_obj_yet_txt_tmp.crate_refname = crateinfo.crate_refname;
                                barcode_no_obj_yet_txt_tmp.loc_refname = locinfo.loc_refname;
                                barcode_no_obj_yet_txt_tmp.moveID = Var.moveID;
                                barcode_no_obj_yet_txt_tmp.move_CSID = Var.move_CSID;
                                barcode_no_obj_yet_txt_tmp.datetimeTZ = Var.datetimeTZ;
                                barcode_no_obj_yet_txt = barcode_no_obj_yet_txt_tmp;

                                // # Output table : 'mvCrate_XML'
                                mvCrate_XML_tmp.loc_refname = locinfo.loc_refname;
                                mvCrate_XML_tmp.loc_displayname = locinfo.loc_displayname;
                                mvCrate_XML_tmp.crate_refname = crateinfo.crate_refname;
                                mvCrate_XML_tmp.crate_displayname = crateinfo.crate_displayname;
                                mvCrate_XML_tmp.loc_handler = person_displayname.person_refname;
                                mvCrate_XML_tmp.Capture_timestamp = Var.datetimeTZ;
                                mvCrate_XML_tmp.reason4move = Var.reason4move;
                                mvCrate_XML_tmp.computedSummary = Var.computedSummary;
                                mvCrate_XML_tmp.moveID = Var.moveID;
                                mvCrate_XML_tmp.moveCSID = Var.move_CSID;
                                mvCrate_XML = mvCrate_XML_tmp;

                                // # Output table : 'mvCrate_CSID'
                                mvCrate_CSID_tmp.moveCSID = Var.move_CSID;
                                mvCrate_CSID = mvCrate_CSID_tmp;
                                // ###############################

                            } // end of Var scope

                            rejectedInnerJoin_tMap_5 = false;

                            tos_count_tMap_5++;

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

                                /**
                                 * [tFileOutputDelimited_7 main ] start
                                 */

                                currentComponent = "tFileOutputDelimited_7";

                                StringBuilder sb_tFileOutputDelimited_7 = new StringBuilder();

                                if (barcode_no_obj_yet_txt.reason_for_move != null) {

                                    sb_tFileOutputDelimited_7.append(

                                            barcode_no_obj_yet_txt.reason_for_move

                                    );

                                }

                                sb_tFileOutputDelimited_7.append(OUT_DELIM_tFileOutputDelimited_7);

                                if (barcode_no_obj_yet_txt.person_scanning != null) {

                                    sb_tFileOutputDelimited_7.append(

                                            barcode_no_obj_yet_txt.person_scanning

                                    );

                                }

                                sb_tFileOutputDelimited_7.append(OUT_DELIM_tFileOutputDelimited_7);

                                if (barcode_no_obj_yet_txt.date_time != null) {

                                    sb_tFileOutputDelimited_7.append(

                                            barcode_no_obj_yet_txt.date_time

                                    );

                                }

                                sb_tFileOutputDelimited_7.append(OUT_DELIM_tFileOutputDelimited_7);

                                if (barcode_no_obj_yet_txt.current_crate != null) {

                                    sb_tFileOutputDelimited_7.append(

                                            barcode_no_obj_yet_txt.current_crate

                                    );

                                }

                                sb_tFileOutputDelimited_7.append(OUT_DELIM_tFileOutputDelimited_7);

                                if (barcode_no_obj_yet_txt.new_location != null) {

                                    sb_tFileOutputDelimited_7.append(

                                            barcode_no_obj_yet_txt.new_location

                                    );

                                }

                                sb_tFileOutputDelimited_7.append(OUT_DELIM_tFileOutputDelimited_7);

                                if (barcode_no_obj_yet_txt.person_refname != null) {

                                    sb_tFileOutputDelimited_7.append(

                                            barcode_no_obj_yet_txt.person_refname

                                    );

                                }

                                sb_tFileOutputDelimited_7.append(OUT_DELIM_tFileOutputDelimited_7);

                                if (barcode_no_obj_yet_txt.crate_refname != null) {

                                    sb_tFileOutputDelimited_7.append(

                                            barcode_no_obj_yet_txt.crate_refname

                                    );

                                }

                                sb_tFileOutputDelimited_7.append(OUT_DELIM_tFileOutputDelimited_7);

                                if (barcode_no_obj_yet_txt.loc_refname != null) {

                                    sb_tFileOutputDelimited_7.append(

                                            barcode_no_obj_yet_txt.loc_refname

                                    );

                                }

                                sb_tFileOutputDelimited_7.append(OUT_DELIM_tFileOutputDelimited_7);

                                if (barcode_no_obj_yet_txt.moveID != null) {

                                    sb_tFileOutputDelimited_7.append(

                                            barcode_no_obj_yet_txt.moveID

                                    );

                                }

                                sb_tFileOutputDelimited_7.append(OUT_DELIM_tFileOutputDelimited_7);

                                if (barcode_no_obj_yet_txt.move_CSID != null) {

                                    sb_tFileOutputDelimited_7.append(

                                            barcode_no_obj_yet_txt.move_CSID

                                    );

                                }

                                sb_tFileOutputDelimited_7.append(OUT_DELIM_tFileOutputDelimited_7);

                                if (barcode_no_obj_yet_txt.datetimeTZ != null) {

                                    sb_tFileOutputDelimited_7.append(

                                            barcode_no_obj_yet_txt.datetimeTZ

                                    );

                                }

                                sb_tFileOutputDelimited_7.append(OUT_DELIM_ROWSEP_tFileOutputDelimited_7);

                                nb_line_tFileOutputDelimited_7++;

                                outtFileOutputDelimited_7.write(sb_tFileOutputDelimited_7.toString());

                                tos_count_tFileOutputDelimited_7++;

                                /**
                                 * [tFileOutputDelimited_7 main ] stop
                                 */

                            } // End of branch "barcode_no_obj_yet_txt"

                            // Start of branch "mvCrate_XML"
                            if (mvCrate_XML != null) {

                                /**
                                 * [tAdvancedFileOutputXML_4 main ] start
                                 */

                                currentComponent = "tAdvancedFileOutputXML_4";

                                nb_line_tAFOX_4++;
                                valueMap_tAFOX_4.clear();
                                valueMap_tAFOX_4.put("loc_refname",
                                        (mvCrate_XML.loc_refname != null ? mvCrate_XML.loc_refname.toString()
                                                : null));
                                valueMap_tAFOX_4.put("loc_displayname",
                                        (mvCrate_XML.loc_displayname != null
                                                ? mvCrate_XML.loc_displayname.toString()
                                                : null));
                                valueMap_tAFOX_4.put("crate_refname",
                                        (mvCrate_XML.crate_refname != null
                                                ? mvCrate_XML.crate_refname.toString()
                                                : null));
                                valueMap_tAFOX_4.put("crate_displayname",
                                        (mvCrate_XML.crate_displayname != null
                                                ? mvCrate_XML.crate_displayname.toString()
                                                : null));
                                valueMap_tAFOX_4.put("loc_handler",
                                        (mvCrate_XML.loc_handler != null ? mvCrate_XML.loc_handler.toString()
                                                : null));
                                valueMap_tAFOX_4.put("Capture_timestamp",
                                        (mvCrate_XML.Capture_timestamp != null
                                                ? mvCrate_XML.Capture_timestamp.toString()
                                                : null));
                                valueMap_tAFOX_4.put("reason4move",
                                        (mvCrate_XML.reason4move != null ? mvCrate_XML.reason4move.toString()
                                                : null));
                                valueMap_tAFOX_4.put("computedSummary",
                                        (mvCrate_XML.computedSummary != null
                                                ? mvCrate_XML.computedSummary.toString()
                                                : null));
                                valueMap_tAFOX_4.put("moveID", (mvCrate_XML.moveID.toString()));
                                valueMap_tAFOX_4.put("moveCSID", (mvCrate_XML.moveCSID.toString()));
                                org.dom4j.Element subTreeRootParent_tAFOX_4 = null;

                                // build root xml tree
                                if (needRoot_tAFOX_4) {
                                    needRoot_tAFOX_4 = false;
                                    if (orders_tAFOX_4.length > 0) {
                                        orders_tAFOX_4[0] = 0;
                                    }
                                    org.dom4j.Element root_tAFOX_4 = doc_tAFOX_4.addElement("imports");
                                    subTreeRootParent_tAFOX_4 = root_tAFOX_4;
                                    root4Group_tAFOX_4 = subTreeRootParent_tAFOX_4;
                                } else {
                                    subTreeRootParent_tAFOX_4 = root4Group_tAFOX_4;
                                }
                                // build group xml tree
                                // build loop xml tree
                                org.dom4j.Element loop_tAFOX_4 = org.dom4j.DocumentHelper
                                        .createElement("import");
                                if (orders_tAFOX_4[0] == 0) {
                                    orders_tAFOX_4[0] = 0;
                                }
                                if (1 < orders_tAFOX_4.length) {
                                    orders_tAFOX_4[1] = 0;
                                }
                                subTreeRootParent_tAFOX_4.elements().add(orders_tAFOX_4[0]++, loop_tAFOX_4);
                                loop_tAFOX_4.addAttribute("service", "Movements");
                                loop_tAFOX_4.addAttribute("type", "Movement");
                                if (valueMap_tAFOX_4.get("moveCSID") != null) {
                                    loop_tAFOX_4.addAttribute("CSID", valueMap_tAFOX_4.get("moveCSID"));
                                }
                                org.dom4j.Element loop_0_tAFOX_4 = loop_tAFOX_4.addElement("schema");
                                loop_0_tAFOX_4.addNamespace("movements_common", TalendString
                                        .replaceSpecialCharForXML("http://collectionspace.org/movement/"));
                                loop_0_tAFOX_4.addAttribute("name", "movements_common");
                                org.dom4j.Element loop_0_0_tAFOX_4;
                                if (loop_0_tAFOX_4.getNamespaceForPrefix("movements_common") == null) {
                                    loop_0_0_tAFOX_4 = loop_0_tAFOX_4.addElement("movementNote");
                                } else {
                                    loop_0_0_tAFOX_4 = loop_0_tAFOX_4
                                            .addElement("movements_common:movementNote");
                                }
                                loop_0_0_tAFOX_4.setName("movements_common:movementNote");
                                org.dom4j.Element loop_0_1_tAFOX_4;
                                if (loop_0_tAFOX_4.getNamespaceForPrefix("movements_common") == null) {
                                    loop_0_1_tAFOX_4 = loop_0_tAFOX_4.addElement("removalDate");
                                } else {
                                    loop_0_1_tAFOX_4 = loop_0_tAFOX_4
                                            .addElement("movements_common:removalDate");
                                }
                                loop_0_1_tAFOX_4.setName("movements_common:removalDate");
                                org.dom4j.Element loop_0_2_tAFOX_4;
                                if (loop_0_tAFOX_4.getNamespaceForPrefix("movements_common") == null) {
                                    loop_0_2_tAFOX_4 = loop_0_tAFOX_4.addElement("reasonForMove");
                                } else {
                                    loop_0_2_tAFOX_4 = loop_0_tAFOX_4
                                            .addElement("movements_common:reasonForMove");
                                }
                                if (valueMap_tAFOX_4.get("reason4move") != null) {
                                    nestXMLTool_tAFOX_4.setText(loop_0_2_tAFOX_4,
                                            valueMap_tAFOX_4.get("reason4move"));
                                }
                                loop_0_2_tAFOX_4.setName("movements_common:reasonForMove");
                                org.dom4j.Element loop_0_3_tAFOX_4;
                                if (loop_0_tAFOX_4.getNamespaceForPrefix("movements_common") == null) {
                                    loop_0_3_tAFOX_4 = loop_0_tAFOX_4.addElement("movementMethods");
                                } else {
                                    loop_0_3_tAFOX_4 = loop_0_tAFOX_4
                                            .addElement("movements_common:movementMethods");
                                }
                                loop_0_3_tAFOX_4.setName("movements_common:movementMethods");
                                org.dom4j.Element loop_0_3_0_tAFOX_4 = loop_0_3_tAFOX_4
                                        .addElement("movementMethod");
                                org.dom4j.Element loop_0_4_tAFOX_4;
                                if (loop_0_tAFOX_4.getNamespaceForPrefix("movements_common") == null) {
                                    loop_0_4_tAFOX_4 = loop_0_tAFOX_4.addElement("plannedRemovalDate");
                                } else {
                                    loop_0_4_tAFOX_4 = loop_0_tAFOX_4
                                            .addElement("movements_common:plannedRemovalDate");
                                }
                                loop_0_4_tAFOX_4.setName("movements_common:plannedRemovalDate");
                                org.dom4j.Element loop_0_5_tAFOX_4;
                                if (loop_0_tAFOX_4.getNamespaceForPrefix("movements_common") == null) {
                                    loop_0_5_tAFOX_4 = loop_0_tAFOX_4.addElement("movementContact");
                                } else {
                                    loop_0_5_tAFOX_4 = loop_0_tAFOX_4
                                            .addElement("movements_common:movementContact");
                                }
                                loop_0_5_tAFOX_4.setName("movements_common:movementContact");
                                org.dom4j.Element loop_0_6_tAFOX_4;
                                if (loop_0_tAFOX_4.getNamespaceForPrefix("movements_common") == null) {
                                    loop_0_6_tAFOX_4 = loop_0_tAFOX_4.addElement("normalLocation");
                                } else {
                                    loop_0_6_tAFOX_4 = loop_0_tAFOX_4
                                            .addElement("movements_common:normalLocation");
                                }
                                loop_0_6_tAFOX_4.setName("movements_common:normalLocation");
                                org.dom4j.Element loop_0_7_tAFOX_4;
                                if (loop_0_tAFOX_4.getNamespaceForPrefix("movements_common") == null) {
                                    loop_0_7_tAFOX_4 = loop_0_tAFOX_4.addElement("currentLocationFitness");
                                } else {
                                    loop_0_7_tAFOX_4 = loop_0_tAFOX_4
                                            .addElement("movements_common:currentLocationFitness");
                                }
                                loop_0_7_tAFOX_4.setName("movements_common:currentLocationFitness");
                                org.dom4j.Element loop_0_8_tAFOX_4;
                                if (loop_0_tAFOX_4.getNamespaceForPrefix("movements_common") == null) {
                                    loop_0_8_tAFOX_4 = loop_0_tAFOX_4.addElement("currentLocation");
                                } else {
                                    loop_0_8_tAFOX_4 = loop_0_tAFOX_4
                                            .addElement("movements_common:currentLocation");
                                }
                                if (valueMap_tAFOX_4.get("loc_refname") != null) {
                                    nestXMLTool_tAFOX_4.setText(loop_0_8_tAFOX_4,
                                            valueMap_tAFOX_4.get("loc_refname"));
                                }
                                loop_0_8_tAFOX_4.setName("movements_common:currentLocation");
                                org.dom4j.Element loop_0_9_tAFOX_4;
                                if (loop_0_tAFOX_4.getNamespaceForPrefix("movements_common") == null) {
                                    loop_0_9_tAFOX_4 = loop_0_tAFOX_4.addElement("locationDate");
                                } else {
                                    loop_0_9_tAFOX_4 = loop_0_tAFOX_4
                                            .addElement("movements_common:locationDate");
                                }
                                if (valueMap_tAFOX_4.get("Capture_timestamp") != null) {
                                    nestXMLTool_tAFOX_4.setText(loop_0_9_tAFOX_4,
                                            valueMap_tAFOX_4.get("Capture_timestamp"));
                                }
                                loop_0_9_tAFOX_4.setName("movements_common:locationDate");
                                org.dom4j.Element loop_0_10_tAFOX_4;
                                if (loop_0_tAFOX_4.getNamespaceForPrefix("movements_common") == null) {
                                    loop_0_10_tAFOX_4 = loop_0_tAFOX_4.addElement("currentLocationNote");
                                } else {
                                    loop_0_10_tAFOX_4 = loop_0_tAFOX_4
                                            .addElement("movements_common:currentLocationNote");
                                }
                                loop_0_10_tAFOX_4.setName("movements_common:currentLocationNote");
                                org.dom4j.Element loop_0_11_tAFOX_4;
                                if (loop_0_tAFOX_4.getNamespaceForPrefix("movements_common") == null) {
                                    loop_0_11_tAFOX_4 = loop_0_tAFOX_4.addElement("movementReferenceNumber");
                                } else {
                                    loop_0_11_tAFOX_4 = loop_0_tAFOX_4
                                            .addElement("movements_common:movementReferenceNumber");
                                }
                                if (valueMap_tAFOX_4.get("moveID") != null) {
                                    nestXMLTool_tAFOX_4.setText(loop_0_11_tAFOX_4,
                                            valueMap_tAFOX_4.get("moveID"));
                                }
                                loop_0_11_tAFOX_4.setName("movements_common:movementReferenceNumber");
                                org.dom4j.Element loop_1_tAFOX_4 = loop_tAFOX_4.addElement("schema2");
                                loop_1_tAFOX_4.addNamespace("movements_anthropology",
                                        TalendString.replaceSpecialCharForXML(
                                                "http://collectionspace.org/services/movement/domain/anthropology"));
                                loop_1_tAFOX_4.addAttribute("name", "movements_anthropology");
                                org.dom4j.Element loop_1_0_tAFOX_4;
                                if (loop_1_tAFOX_4.getNamespaceForPrefix("movements_anthropology") == null) {
                                    loop_1_0_tAFOX_4 = loop_1_tAFOX_4.addElement("locationHandlers");
                                } else {
                                    loop_1_0_tAFOX_4 = loop_1_tAFOX_4
                                            .addElement("movements_anthropology:locationHandlers");
                                }
                                loop_1_0_tAFOX_4.setName("movements_anthropology:locationHandlers");
                                org.dom4j.Element loop_1_0_0_tAFOX_4 = loop_1_0_tAFOX_4
                                        .addElement("locationHandler");
                                if (valueMap_tAFOX_4.get("loc_handler") != null) {
                                    nestXMLTool_tAFOX_4.setText(loop_1_0_0_tAFOX_4,
                                            valueMap_tAFOX_4.get("loc_handler"));
                                }
                                org.dom4j.Element loop_1_1_tAFOX_4;
                                if (loop_1_tAFOX_4.getNamespaceForPrefix("movements_anthropology") == null) {
                                    loop_1_1_tAFOX_4 = loop_1_tAFOX_4.addElement("crate");
                                } else {
                                    loop_1_1_tAFOX_4 = loop_1_tAFOX_4
                                            .addElement("movements_anthropology:crate");
                                }
                                if (valueMap_tAFOX_4.get("crate_refname") != null) {
                                    nestXMLTool_tAFOX_4.setText(loop_1_1_tAFOX_4,
                                            valueMap_tAFOX_4.get("crate_refname"));
                                }
                                loop_1_1_tAFOX_4.setName("movements_anthropology:crate");
                                org.dom4j.Element loop_1_2_tAFOX_4;
                                if (loop_1_tAFOX_4.getNamespaceForPrefix("movements_anthropology") == null) {
                                    loop_1_2_tAFOX_4 = loop_1_tAFOX_4.addElement("computedSummary");
                                } else {
                                    loop_1_2_tAFOX_4 = loop_1_tAFOX_4
                                            .addElement("movements_anthropology:computedSummary");
                                }
                                if (valueMap_tAFOX_4.get("computedSummary") != null) {
                                    nestXMLTool_tAFOX_4.setText(loop_1_2_tAFOX_4,
                                            valueMap_tAFOX_4.get("computedSummary"));
                                }
                                loop_1_2_tAFOX_4.setName("movements_anthropology:computedSummary");

                                tos_count_tAdvancedFileOutputXML_4++;

                                /**
                                 * [tAdvancedFileOutputXML_4 main ] stop
                                 */

                            } // End of branch "mvCrate_XML"

                            // Start of branch "mvCrate_CSID"
                            if (mvCrate_CSID != null) {

                                /**
                                 * [tFileOutputDelimited_8 main ] start
                                 */

                                currentComponent = "tFileOutputDelimited_8";

                                StringBuilder sb_tFileOutputDelimited_8 = new StringBuilder();

                                if (mvCrate_CSID.moveCSID != null) {

                                    sb_tFileOutputDelimited_8.append(

                                            mvCrate_CSID.moveCSID

                                    );

                                }

                                sb_tFileOutputDelimited_8.append(OUT_DELIM_ROWSEP_tFileOutputDelimited_8);

                                nb_line_tFileOutputDelimited_8++;

                                outtFileOutputDelimited_8.write(sb_tFileOutputDelimited_8.toString());

                                tos_count_tFileOutputDelimited_8++;

                                /**
                                 * [tFileOutputDelimited_8 main ] stop
                                 */

                            } // End of branch "mvCrate_CSID"

                            // Start of branch "barcode_no_obj_yet"
                            if (barcode_no_obj_yet != null) {

                                /**
                                 * [tAdvancedHash_barcode_no_obj_yet main ]
                                 * start
                                 */

                                currentComponent = "tAdvancedHash_barcode_no_obj_yet";

                                barcode_no_obj_yetStruct barcode_no_obj_yet_HashRow = new barcode_no_obj_yetStruct();

                                barcode_no_obj_yet_HashRow.reason_for_move = barcode_no_obj_yet.reason_for_move;

                                barcode_no_obj_yet_HashRow.person_scanning = barcode_no_obj_yet.person_scanning;

                                barcode_no_obj_yet_HashRow.date_time = barcode_no_obj_yet.date_time;

                                barcode_no_obj_yet_HashRow.current_crate = barcode_no_obj_yet.current_crate;

                                barcode_no_obj_yet_HashRow.new_location = barcode_no_obj_yet.new_location;

                                barcode_no_obj_yet_HashRow.person_refname = barcode_no_obj_yet.person_refname;

                                barcode_no_obj_yet_HashRow.crate_refname = barcode_no_obj_yet.crate_refname;

                                barcode_no_obj_yet_HashRow.loc_refname = barcode_no_obj_yet.loc_refname;

                                barcode_no_obj_yet_HashRow.datetimeTZ = barcode_no_obj_yet.datetimeTZ;

                                barcode_no_obj_yet_HashRow.moveID = barcode_no_obj_yet.moveID;

                                barcode_no_obj_yet_HashRow.move_CSID = barcode_no_obj_yet.move_CSID;

                                tHash_Lookup_barcode_no_obj_yet.put(barcode_no_obj_yet_HashRow);

                                tos_count_tAdvancedHash_barcode_no_obj_yet++;

                                /**
                                 * [tAdvancedHash_barcode_no_obj_yet main ]
                                 * stop
                                 */

                            } // End of branch "barcode_no_obj_yet"

                        } // End of branch "barcode"

                        /**
                         * [tSortRow_3_SortIn end ] start
                         */

                        currentComponent = "tSortRow_3_SortIn";

                    }

                    globalMap.put("tSortRow_3_SortIn_NB_LINE", nb_line_tSortRow_3_SortIn);

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

                    /**
                     * [tSortRow_3_SortIn end ] stop
                     */

                    /**
                     * [tUniqRow_1 end ] start
                     */

                    currentComponent = "tUniqRow_1";

                    globalMap.put("tUniqRow_1_NB_UNIQUES", nb_uniques_tUniqRow_1);
                    globalMap.put("tUniqRow_1_NB_DUPLICATES", nb_duplicates_tUniqRow_1);

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

                    /**
                     * [tUniqRow_1 end ] stop
                     */

                    /**
                     * [tMap_5 end ] start
                     */

                    currentComponent = "tMap_5";

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

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

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

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

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

                    /**
                     * [tMap_5 end ] stop
                     */

                    /**
                     * [tAdvancedHash_barcode_no_obj_yet end ] start
                     */

                    currentComponent = "tAdvancedHash_barcode_no_obj_yet";

                    tHash_Lookup_barcode_no_obj_yet.endPut();

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

                    /**
                     * [tAdvancedHash_barcode_no_obj_yet end ] stop
                     */

                    /**
                     * [tFileOutputDelimited_8 end ] start
                     */

                    currentComponent = "tFileOutputDelimited_8";

                } finally {
                    if (outtFileOutputDelimited_8 != null) {
                        outtFileOutputDelimited_8.flush();
                        outtFileOutputDelimited_8.close();
                    }
                    globalMap.put("tFileOutputDelimited_8_NB_LINE", nb_line_tFileOutputDelimited_8);
                    globalMap.put("tFileOutputDelimited_8_FILE_NAME", fileName_tFileOutputDelimited_8);
                } // finally

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

                /**
                 * [tFileOutputDelimited_8 end ] stop
                 */

                /**
                 * [tAdvancedFileOutputXML_4 end ] start
                 */

                currentComponent = "tAdvancedFileOutputXML_4";

                java.io.FileOutputStream stream_tAFOX_4 = new java.io.FileOutputStream(fileName_tAFOX_4);
                org.dom4j.io.XMLWriter output_tAFOX_4 = new org.dom4j.io.XMLWriter(stream_tAFOX_4,
                        format_tAFOX_4);
                if (doc_tAFOX_4.getRootElement() != null) {
                    nestXMLTool_tAFOX_4.replaceDefaultNameSpace(doc_tAFOX_4.getRootElement());
                    output_tAFOX_4.write(doc_tAFOX_4);
                }
                output_tAFOX_4.close();
                globalMap.put("tAdvancedFileOutputXML_4_NB_LINE", nb_line_tAFOX_4);

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

                /**
                 * [tAdvancedFileOutputXML_4 end ] stop
                 */

                /**
                 * [tFileOutputDelimited_7 end ] start
                 */

                currentComponent = "tFileOutputDelimited_7";

            } finally {
                if (outtFileOutputDelimited_7 != null) {
                    outtFileOutputDelimited_7.flush();
                    outtFileOutputDelimited_7.close();
                }
                globalMap.put("tFileOutputDelimited_7_NB_LINE", nb_line_tFileOutputDelimited_7);
                globalMap.put("tFileOutputDelimited_7_FILE_NAME", fileName_tFileOutputDelimited_7);
            } // finally

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

            /**
             * [tFileOutputDelimited_7 end ] stop
             */

        } // end the resume

    } catch (Exception e) {

        throw new TalendException(e, currentComponent, globalMap);

    } catch (java.lang.Error error) {

        throw new java.lang.Error(error);

    } finally {
        // free memory for "tMap_5"
        globalMap.put("tHash_Lookup_person_displayname", null);

        // free memory for "tMap_5"
        globalMap.put("tHash_Lookup_crateinfo", null);

        // free memory for "tMap_5"
        globalMap.put("tHash_Lookup_locinfo", null);

        // free memory for "tSortRow_3_SortIn"
        globalMap.put("tSortRow_3", null);

        // free memory for "tMap_3"
        globalMap.put("tHash_Lookup_handler_list", null);

    }

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

From source file:simpel.FileHelper.java

License:GNU General Public License

public static String buildPLFileContents(Process proc, Map<String, ServiceDetails> plMap,
        Map<String, ImportDetails> nsMap) {
    if (proc.getImports().size() == 0)
        return null;
    Namespace plnk, wsdl;//  ww  w. java  2 s .c o m
    Document doc = DocumentHelper.createDocument();
    Element root = doc.addElement("definitions").addAttribute("targetNamespace", "http://tempuri.org/plks")
            .addNamespace("tns", "http://tempuri.org/plks")
            .addNamespace("plnk", "http://docs.oasis-open.org/wsbpel/2.0/plnktype")
            .addNamespace("pns", "http://www.uatx.mx/uri").addNamespace("", "http://schemas.xmlsoap.org/wsdl/")
            .addNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/");

    wsdl = root.getNamespaceForPrefix("wsdl");
    plnk = root.getNamespaceForPrefix("plnk");

    LinkedList<Element> imports = new LinkedList<Element>();
    LinkedList<Element> plnks = new LinkedList<Element>();

    for (ServiceDetails sd : plMap.values()) {
        String prefix = sd.porttype.getQName().getPrefix();
        String localpart = sd.porttype.getQName().getLocalPart();
        String uri = sd.porttype.getQName().getNamespaceURI();
        String location = nsMap.get(prefix).location;

        root.addNamespace(prefix, uri);

        Element imp = DocumentHelper.createElement(new QName("import", wsdl)).addAttribute("namespace", uri)
                .addAttribute("location", location);
        imports.add(imp);

        Element plnkt = DocumentHelper.createElement(new QName("partnerLinkType", plnk)).addAttribute("name",
                sd.partnerlink.getName() + "Type");

        Element role = plnkt.addElement(new QName("role", plnk));
        if (sd.partnerlink.getMyRole() != null)
            role.addAttribute("name", sd.partnerlink.getMyRole().getName());
        else
            role.addAttribute("name", sd.partnerlink.getPartnerRole().getName());

        role.addAttribute("portType", prefix + ":" + localpart);
        plnks.add(plnkt);
    }

    for (Element imp : imports)
        root.add(imp);
    for (Element plnkt : plnks)
        root.add(plnkt);

    StringWriter out = new StringWriter();
    OutputFormat format = OutputFormat.createPrettyPrint();
    XMLWriter writer = new XMLWriter(out, format);

    try {
        writer.write(doc);
    } catch (IOException e) {
        e.printStackTrace();
    }

    return out.toString();
}