Example usage for org.dom4j Element remove

List of usage examples for org.dom4j Element remove

Introduction

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

Prototype

boolean remove(Text text);

Source Link

Document

Removes the given Text if the node is an immediate child of this element.

Usage

From source file:pahma_etl.tmslocation_barcode_5fld_1_1.TMSlocation_barcode_5fld.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  . ja  va 2 s.  c  o m

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

            tFileInputDelimited_5Process(globalMap);
            tFileInputDelimited_2Process(globalMap);
            tFileInputDelimited_3Process(globalMap);
            tFileInputDelimited_4Process(globalMap);

            barcode_fileStruct barcode_file = new barcode_fileStruct();
            barcode_wNameStruct barcode_wName = new barcode_wNameStruct();
            row2Struct row2 = new row2Struct();
            obj_locStruct obj_loc = new obj_locStruct();
            out_moveXMLStruct out_moveXML = new out_moveXMLStruct();
            moveCSIDStruct moveCSID = new moveCSIDStruct();
            IDStruct ID = new IDStruct();
            unmatch_locStruct unmatch_loc = new unmatch_locStruct();
            move2obj_XMLStruct move2obj_XML = new move2obj_XMLStruct();
            row3Struct row3 = new row3Struct();
            obj2move_XMLStruct obj2move_XML = new obj2move_XMLStruct();
            row1Struct row1 = new row1Struct();

            /**
             * [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.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.objectNumber == null && other.objectNumber != null) {
                        return -1;

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

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

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

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

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

            /**
             * [tSortRow_3_SortOut begin ] stop
             */

            /**
             * [tMap_6 begin ] start
             */

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

            int tos_count_tMap_6 = 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_6__Struct {
            }
            Var__tMap_6__Struct Var__tMap_6 = new Var__tMap_6__Struct();
            // ###############################

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

            /**
             * [tMap_6 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, barcode_fileStruct barcode_file) throws Exception {

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

                        barcode_file.reason_for_move = null;

                        barcode_file.person_scanning = null;

                        barcode_file.objectNumber = null;

                        barcode_file.location = null;

                        barcode_file.date_time = null;

                    } else {

                        if (0 < row.length) {

                            barcode_file.reason_for_move = row[0];

                        } else {
                            barcode_file.reason_for_move = null;
                        }

                        if (1 < row.length) {

                            barcode_file.person_scanning = row[1];

                        } else {
                            barcode_file.person_scanning = null;
                        }

                        if (2 < row.length) {

                            barcode_file.objectNumber = row[2];

                        } else {
                            barcode_file.objectNumber = null;
                        }

                        if (3 < row.length) {

                            barcode_file.location = row[3];

                        } else {
                            barcode_file.location = null;
                        }

                        if (4 < row.length) {

                            barcode_file.date_time = row[4];

                        } else {
                            barcode_file.date_time = 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/Process5_" + 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;
                    }

                    barcode_file = null;

                    boolean whetherReject_tFileInputDelimited_1 = false;
                    barcode_file = new barcode_fileStruct();
                    try {

                        rowHelper_tFileInputDelimited_1.valueToConn(rowtFileInputDelimited_1, barcode_file);

                    } catch (Exception e) {
                        whetherReject_tFileInputDelimited_1 = true;

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

                    }

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

                    currentComponent = "tFileInputDelimited_1";

                    tos_count_tFileInputDelimited_1++;

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

                        /**
                         * [tMap_6 main ] start
                         */

                        currentComponent = "tMap_6";

                        boolean hasCasePrimitiveKeyWithNull_tMap_6 = false;

                        // ###############################
                        // # Input tables (lookups)
                        boolean rejectedInnerJoin_tMap_6 = false;
                        boolean mainRowRejected_tMap_6 = false;

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

                        boolean forceLoophandler_list = false;

                        handler_listStruct handler_listObjectFromLookup = null;

                        if (!rejectedInnerJoin_tMap_6) { // G_TM_M_020

                            hasCasePrimitiveKeyWithNull_tMap_6 = false;

                            handler_listHashKey.handler_code = barcode_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_6__Struct Var = Var__tMap_6;// ###############################
                            // ###############################
                            // # Output tables

                            barcode_wName = null;

                            // # Output table : 'barcode_wName'
                            barcode_wName_tmp.reason_for_move = barcode_file.reason_for_move;
                            barcode_wName_tmp.person_scanning = handler_list.handler_displname;
                            barcode_wName_tmp.objectNumber = barcode_file.objectNumber;
                            barcode_wName_tmp.location = barcode_file.location;
                            barcode_wName_tmp.date_time = barcode_file.date_time;
                            barcode_wName = barcode_wName_tmp;
                            // ###############################

                        } // end of Var scope

                        rejectedInnerJoin_tMap_6 = false;

                        tos_count_tMap_6++;

                        /**
                         * [tMap_6 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.objectNumber = barcode_wName.objectNumber;
                            arrayRowtSortRow_3_SortOut.location = barcode_wName.location;
                            arrayRowtSortRow_3_SortOut.date_time = barcode_wName.date_time;
                            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 "barcode_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_6 end ] start
             */

            currentComponent = "tMap_6";

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

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

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

            /**
             * [tMap_6 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
             */

            /**
             * [tAdvancedFileOutputXML_1 begin ] start
             */

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

            int tos_count_tAdvancedFileOutputXML_1 = 0;

            int nb_line_tAFOX_1 = 0;

            boolean needRoot_tAFOX_1 = true;

            String fileName_tAFOX_1 = "../temp/location/barcode5." + TalendDate.getDate("CCYY-MM-DD") + "-"
                    + context.infile_min + ".xml";
            Boolean alreadyExistsFile_tAFOX_1 = new java.io.File(fileName_tAFOX_1).exists();
            fileName_tAFOX_1 = new java.io.File(fileName_tAFOX_1).getAbsolutePath().replace("\\", "/");
            String file_tAFOX_1 = "";

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

            if (!createFiletAFOX_1.exists()) {
                (new java.io.File(fileName_tAFOX_1.substring(0, fileName_tAFOX_1.lastIndexOf("/")))).mkdirs();
                needRoot_tAFOX_1 = true;
            }

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

            class NestXMLTool_tAFOX_1 {
                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_1 nestXMLTool_tAFOX_1 = new NestXMLTool_tAFOX_1();
            // sort group root element for judgement of group
            java.util.List<org.dom4j.Element> groupElementList_tAFOX_1 = new java.util.ArrayList<org.dom4j.Element>();
            org.dom4j.Element root4Group_tAFOX_1 = null;
            org.dom4j.Document doc_tAFOX_1 = null;

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

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

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

            int[] orders_tAFOX_1 = new int[1];

            /**
             * [tAdvancedFileOutputXML_1 begin ] stop
             */

            /**
             * [tFileOutputDelimited_1 begin ] start
             */

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

            int tos_count_tFileOutputDelimited_1 = 0;

            String fileName_tFileOutputDelimited_1 = "";
            fileName_tFileOutputDelimited_1 = (new java.io.File("../temp/location/barcode5_CSID."
                    + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".txt")).getAbsolutePath()
                            .replace("\\", "/");
            String fullName_tFileOutputDelimited_1 = null;
            String extension_tFileOutputDelimited_1 = null;
            String directory_tFileOutputDelimited_1 = null;
            if ((fileName_tFileOutputDelimited_1.indexOf("/") != -1)) {
                if (fileName_tFileOutputDelimited_1.lastIndexOf(".") < fileName_tFileOutputDelimited_1
                        .lastIndexOf("/")) {
                    fullName_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1;
                    extension_tFileOutputDelimited_1 = "";
                } else {
                    fullName_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1.substring(0,
                            fileName_tFileOutputDelimited_1.lastIndexOf("."));
                    extension_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1
                            .substring(fileName_tFileOutputDelimited_1.lastIndexOf("."));
                }
                directory_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1.substring(0,
                        fileName_tFileOutputDelimited_1.lastIndexOf("/"));
            } else {
                if (fileName_tFileOutputDelimited_1.lastIndexOf(".") != -1) {
                    fullName_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1.substring(0,
                            fileName_tFileOutputDelimited_1.lastIndexOf("."));
                    extension_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1
                            .substring(fileName_tFileOutputDelimited_1.lastIndexOf("."));
                } else {
                    fullName_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1;
                    extension_tFileOutputDelimited_1 = "";
                }
                directory_tFileOutputDelimited_1 = "";
            }
            boolean isFileGenerated_tFileOutputDelimited_1 = true;
            java.io.File filetFileOutputDelimited_1 = new java.io.File(fileName_tFileOutputDelimited_1);
            globalMap.put("tFileOutputDelimited_1_FILE_NAME", fileName_tFileOutputDelimited_1);

            int nb_line_tFileOutputDelimited_1 = 0;
            int splitEvery_tFileOutputDelimited_1 = 1000;
            int splitedFileNo_tFileOutputDelimited_1 = 0;
            int currentRow_tFileOutputDelimited_1 = 0;

            final String OUT_DELIM_tFileOutputDelimited_1 = /**
                                                            * Start field
                                                            * tFileOutputDelimited_1:FIELDSEPARATOR
                                                            */
                    ";"/** End field tFileOutputDelimited_1:FIELDSEPARATOR */
            ;

            final String OUT_DELIM_ROWSEP_tFileOutputDelimited_1 = /**
                                                                   * Start
                                                                   * field tFileOutputDelimited_1:ROWSEPARATOR
                                                                   */
                    "\n"/** End field tFileOutputDelimited_1:ROWSEPARATOR */
            ;

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

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

                /**
                 * [tFileOutputDelimited_1 begin ] stop
                 */

                /**
                 * [tFileOutputDelimited_5 begin ] start
                 */

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

                int tos_count_tFileOutputDelimited_5 = 0;

                String fileName_tFileOutputDelimited_5 = "";
                fileName_tFileOutputDelimited_5 = (new java.io.File("../temp/location/barcode5_ID."
                        + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".txt"))
                                .getAbsolutePath().replace("\\", "/");
                String fullName_tFileOutputDelimited_5 = null;
                String extension_tFileOutputDelimited_5 = null;
                String directory_tFileOutputDelimited_5 = null;
                if ((fileName_tFileOutputDelimited_5.indexOf("/") != -1)) {
                    if (fileName_tFileOutputDelimited_5.lastIndexOf(".") < fileName_tFileOutputDelimited_5
                            .lastIndexOf("/")) {
                        fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5;
                        extension_tFileOutputDelimited_5 = "";
                    } else {
                        fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5.substring(0,
                                fileName_tFileOutputDelimited_5.lastIndexOf("."));
                        extension_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5
                                .substring(fileName_tFileOutputDelimited_5.lastIndexOf("."));
                    }
                    directory_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5.substring(0,
                            fileName_tFileOutputDelimited_5.lastIndexOf("/"));
                } else {
                    if (fileName_tFileOutputDelimited_5.lastIndexOf(".") != -1) {
                        fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5.substring(0,
                                fileName_tFileOutputDelimited_5.lastIndexOf("."));
                        extension_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5
                                .substring(fileName_tFileOutputDelimited_5.lastIndexOf("."));
                    } else {
                        fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5;
                        extension_tFileOutputDelimited_5 = "";
                    }
                    directory_tFileOutputDelimited_5 = "";
                }
                boolean isFileGenerated_tFileOutputDelimited_5 = true;
                java.io.File filetFileOutputDelimited_5 = new java.io.File(fileName_tFileOutputDelimited_5);
                globalMap.put("tFileOutputDelimited_5_FILE_NAME", fileName_tFileOutputDelimited_5);

                int nb_line_tFileOutputDelimited_5 = 0;
                int splitEvery_tFileOutputDelimited_5 = 1000;
                int splitedFileNo_tFileOutputDelimited_5 = 0;
                int currentRow_tFileOutputDelimited_5 = 0;

                final String OUT_DELIM_tFileOutputDelimited_5 = /**
                                                                * Start
                                                                * field tFileOutputDelimited_5:FIELDSEPARATOR
                                                                */
                        ";"/** End field tFileOutputDelimited_5:FIELDSEPARATOR */
                ;

                final String OUT_DELIM_ROWSEP_tFileOutputDelimited_5 = /**
                                                                       * 
                                                                       * Start field tFileOutputDelimited_5:ROWSEPARATOR
                                                                       */
                        "\n"/** End field tFileOutputDelimited_5:ROWSEPARATOR */
                ;

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

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

                    /**
                     * [tFileOutputDelimited_5 begin ] stop
                     */

                    /**
                     * [tFileOutputDelimited_4 begin ] start
                     */

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

                    int tos_count_tFileOutputDelimited_4 = 0;

                    String fileName_tFileOutputDelimited_4 = "";
                    fileName_tFileOutputDelimited_4 = (new java.io.File("../temp/location/barcode5_unmatched."
                            + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".txt"))
                                    .getAbsolutePath().replace("\\", "/");
                    String fullName_tFileOutputDelimited_4 = null;
                    String extension_tFileOutputDelimited_4 = null;
                    String directory_tFileOutputDelimited_4 = null;
                    if ((fileName_tFileOutputDelimited_4.indexOf("/") != -1)) {
                        if (fileName_tFileOutputDelimited_4.lastIndexOf(".") < fileName_tFileOutputDelimited_4
                                .lastIndexOf("/")) {
                            fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4;
                            extension_tFileOutputDelimited_4 = "";
                        } else {
                            fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4.substring(0,
                                    fileName_tFileOutputDelimited_4.lastIndexOf("."));
                            extension_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4
                                    .substring(fileName_tFileOutputDelimited_4.lastIndexOf("."));
                        }
                        directory_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4.substring(0,
                                fileName_tFileOutputDelimited_4.lastIndexOf("/"));
                    } else {
                        if (fileName_tFileOutputDelimited_4.lastIndexOf(".") != -1) {
                            fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4.substring(0,
                                    fileName_tFileOutputDelimited_4.lastIndexOf("."));
                            extension_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4
                                    .substring(fileName_tFileOutputDelimited_4.lastIndexOf("."));
                        } else {
                            fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4;
                            extension_tFileOutputDelimited_4 = "";
                        }
                        directory_tFileOutputDelimited_4 = "";
                    }
                    boolean isFileGenerated_tFileOutputDelimited_4 = true;
                    java.io.File filetFileOutputDelimited_4 = new java.io.File(fileName_tFileOutputDelimited_4);
                    globalMap.put("tFileOutputDelimited_4_FILE_NAME", fileName_tFileOutputDelimited_4);

                    int nb_line_tFileOutputDelimited_4 = 0;
                    int splitEvery_tFileOutputDelimited_4 = 1000;
                    int splitedFileNo_tFileOutputDelimited_4 = 0;
                    int currentRow_tFileOutputDelimited_4 = 0;

                    final String OUT_DELIM_tFileOutputDelimited_4 = /**
                                                                    * Start
                                                                    * field tFileOutputDelimited_4:FIELDSEPARATOR
                                                                    */
                            ";"/** End field tFileOutputDelimited_4:FIELDSEPARATOR */
                    ;

                    final String OUT_DELIM_ROWSEP_tFileOutputDelimited_4 = /**
                                                                           * 
                                                                           * Start field tFileOutputDelimited_4:ROWSEPARATOR
                                                                           */
                            "\n"/** End field tFileOutputDelimited_4:ROWSEPARATOR */
                    ;

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

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

                        /**
                         * [tFileOutputDelimited_4 begin ] stop
                         */

                        /**
                         * [tSortRow_5_SortOut begin ] start
                         */

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

                        int tos_count_tSortRow_5_SortOut = 0;

                        class Comparablemove2obj_XMLStruct extends move2obj_XMLStruct
                                implements Comparable<Comparablemove2obj_XMLStruct> {

                            public int compareTo(Comparablemove2obj_XMLStruct other) {

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

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

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

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

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

                        java.util.List<Comparablemove2obj_XMLStruct> list_tSortRow_5_SortOut = new java.util.ArrayList<Comparablemove2obj_XMLStruct>();

                        /**
                         * [tSortRow_5_SortOut begin ] stop
                         */

                        /**
                         * [tSortRow_4_SortOut begin ] start
                         */

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

                        int tos_count_tSortRow_4_SortOut = 0;

                        class Comparableobj2move_XMLStruct extends obj2move_XMLStruct
                                implements Comparable<Comparableobj2move_XMLStruct> {

                            public int compareTo(Comparableobj2move_XMLStruct other) {

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

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

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

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

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

                        java.util.List<Comparableobj2move_XMLStruct> list_tSortRow_4_SortOut = new java.util.ArrayList<Comparableobj2move_XMLStruct>();

                        /**
                         * [tSortRow_4_SortOut begin ] stop
                         */

                        /**
                         * [tMap_1 begin ] start
                         */

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

                        int tos_count_tMap_1 = 0;

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

                        org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<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();

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

                        person_ID_displayNameStruct person_ID_displayNameHashKey = new person_ID_displayNameStruct();
                        person_ID_displayNameStruct person_ID_displayNameDefault = new person_ID_displayNameStruct();

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

                        obj_IDsStruct obj_IDsHashKey = new obj_IDsStruct();
                        obj_IDsStruct obj_IDsDefault = new obj_IDsStruct();
                        // ###############################

                        // ###############################
                        // # Vars initialization
                        class Var__tMap_1__Struct {
                            String moveID;
                            String move_CSID;
                            java.util.Date Talend_date;
                            String date;
                            String datetime;
                            String datetimeTZ;
                            String trim_locrefname;
                            String item_locref;
                            boolean loc_reject;
                            boolean handler_reject;
                            boolean obj_reject;
                            String move2obj_CSID;
                            String obj2move_CSID;
                            String reason4move;
                            String computedSummary;
                            String move_uri;
                            String move_refname;
                            String obj_uri;
                            String obj_refname;
                            String rel_m2o_uri;
                            String rel_m2o_refname;
                            String rel_o2m_uri;
                            String rel_o2m_refname;
                        }
                        Var__tMap_1__Struct Var__tMap_1 = new Var__tMap_1__Struct();
                        // ###############################

                        // ###############################
                        // # Outputs initialization
                        out_moveXMLStruct out_moveXML_tmp = new out_moveXMLStruct();
                        moveCSIDStruct moveCSID_tmp = new moveCSIDStruct();
                        IDStruct ID_tmp = new IDStruct();
                        unmatch_locStruct unmatch_loc_tmp = new unmatch_locStruct();
                        move2obj_XMLStruct move2obj_XML_tmp = new move2obj_XMLStruct();
                        obj2move_XMLStruct obj2move_XML_tmp = new obj2move_XMLStruct();
                        // ###############################

                        /**
                         * [tMap_1 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 objectNumber;
                            String location;
                            String date_time;

                            @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.objectNumber == null) ? 0 : this.objectNumber.hashCode());

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

                                    result = prime * result
                                            + ((this.date_time == null) ? 0 : this.date_time.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.objectNumber == null) {
                                    if (other.objectNumber != null)
                                        return false;
                                } else if (!this.objectNumber.equals(other.objectNumber))
                                    return false;

                                if (this.location == null) {
                                    if (other.location != null)
                                        return false;
                                } else if (!this.location.equals(other.location))
                                    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;

                                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.objectNumber = current_tSortRow_3_SortIn.objectNumber;
                            row2.location = current_tSortRow_3_SortIn.location;
                            row2.date_time = current_tSortRow_3_SortIn.date_time;
                            // 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";

                            obj_loc = 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.objectNumber == null) {
                                finder_tUniqRow_1.objectNumber = null;
                            } else {
                                finder_tUniqRow_1.objectNumber = row2.objectNumber.toLowerCase();
                            }
                            if (row2.location == null) {
                                finder_tUniqRow_1.location = null;
                            } else {
                                finder_tUniqRow_1.location = row2.location.toLowerCase();
                            }
                            if (row2.date_time == null) {
                                finder_tUniqRow_1.date_time = null;
                            } else {
                                finder_tUniqRow_1.date_time = row2.date_time.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.objectNumber == null) {
                                    new_tUniqRow_1.objectNumber = null;
                                } else {
                                    new_tUniqRow_1.objectNumber = row2.objectNumber.toLowerCase();
                                }
                                if (row2.location == null) {
                                    new_tUniqRow_1.location = null;
                                } else {
                                    new_tUniqRow_1.location = row2.location.toLowerCase();
                                }
                                if (row2.date_time == null) {
                                    new_tUniqRow_1.date_time = null;
                                } else {
                                    new_tUniqRow_1.date_time = row2.date_time.toLowerCase();
                                }

                                keystUniqRow_1.add(new_tUniqRow_1);
                                if (obj_loc == null) {
                                    obj_loc = new obj_locStruct();
                                }
                                obj_loc.reason_for_move = row2.reason_for_move;
                                obj_loc.person_scanning = row2.person_scanning;
                                obj_loc.objectNumber = row2.objectNumber;
                                obj_loc.location = row2.location;
                                obj_loc.date_time = row2.date_time;
                                nb_uniques_tUniqRow_1++;
                            } else {
                                nb_duplicates_tUniqRow_1++;
                            }

                            tos_count_tUniqRow_1++;

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

                                /**
                                 * [tMap_1 main ] start
                                 */

                                currentComponent = "tMap_1";

                                boolean hasCasePrimitiveKeyWithNull_tMap_1 = false;

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

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

                                boolean forceLooplocinfo = false;

                                locinfoStruct locinfoObjectFromLookup = null;

                                if (!rejectedInnerJoin_tMap_1) { // G_TM_M_020

                                    hasCasePrimitiveKeyWithNull_tMap_1 = false;

                                    locinfoHashKey.loc_displayname = StringHandling.TRIM(obj_loc.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;
                                }

                                // /////////////////////////////////////////////
                                // Starting Lookup Table
                                // "person_ID_displayName"
                                // /////////////////////////////////////////////

                                boolean forceLoopperson_ID_displayName = false;

                                person_ID_displayNameStruct person_ID_displayNameObjectFromLookup = null;

                                if (!rejectedInnerJoin_tMap_1) { // G_TM_M_020

                                    hasCasePrimitiveKeyWithNull_tMap_1 = false;

                                    person_ID_displayNameHashKey.displayName = obj_loc.person_scanning;

                                    person_ID_displayNameHashKey.hashCodeDirty = true;

                                    tHash_Lookup_person_ID_displayName.lookup(person_ID_displayNameHashKey);

                                } // G_TM_M_020

                                if (tHash_Lookup_person_ID_displayName != null
                                        && tHash_Lookup_person_ID_displayName
                                                .getCount(person_ID_displayNameHashKey) > 1) { // G
                                    // 071

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

                                person_ID_displayNameStruct person_ID_displayName = null;

                                person_ID_displayNameStruct fromLookup_person_ID_displayName = null;
                                person_ID_displayName = person_ID_displayNameDefault;

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

                                    fromLookup_person_ID_displayName = tHash_Lookup_person_ID_displayName
                                            .next();

                                } // G 099

                                if (fromLookup_person_ID_displayName != null) {
                                    person_ID_displayName = fromLookup_person_ID_displayName;
                                }

                                // /////////////////////////////////////////////
                                // Starting Lookup Table "obj_IDs"
                                // /////////////////////////////////////////////

                                boolean forceLoopobj_IDs = false;

                                obj_IDsStruct obj_IDsObjectFromLookup = null;

                                if (!rejectedInnerJoin_tMap_1) { // G_TM_M_020

                                    hasCasePrimitiveKeyWithNull_tMap_1 = false;

                                    obj_IDsHashKey.objectNumber = StringHandling.TRIM(obj_loc.objectNumber);

                                    obj_IDsHashKey.hashCodeDirty = true;

                                    tHash_Lookup_obj_IDs.lookup(obj_IDsHashKey);

                                } // G_TM_M_020

                                if (tHash_Lookup_obj_IDs != null
                                        && tHash_Lookup_obj_IDs.getCount(obj_IDsHashKey) > 1) { // G
                                    // 071

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

                                obj_IDsStruct obj_IDs = null;

                                obj_IDsStruct fromLookup_obj_IDs = null;
                                obj_IDs = obj_IDsDefault;

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

                                    fromLookup_obj_IDs = tHash_Lookup_obj_IDs.next();

                                } // G 099

                                if (fromLookup_obj_IDs != null) {
                                    obj_IDs = fromLookup_obj_IDs;
                                }

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

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

                                    Var__tMap_1__Struct Var = Var__tMap_1;
                                    Var.moveID = "Barcode." + TalendDate.getDate("CCYYMMDD-hhmm") + "-"
                                            + StringHandling.TRIM(obj_loc.reason_for_move) + "."
                                            + Numeric.sequence("", 1, 1);
                                    Var.move_CSID = Guid.getUUID();
                                    Var.Talend_date = (obj_loc.date_time == null
                                            || obj_loc.date_time.equals("")) ? null
                                                    : (TalendDate.addDate(TalendDate.parseDate(
                                                            "MM/dd/yyyy HH:mm", obj_loc.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.trim_locrefname = StringHandling.TRIM(locinfo.loc_refname);
                                    Var.item_locref = StringHandling.TRIM(obj_loc.objectNumber) + "->"
                                            + StringHandling.TRIM(locinfo.loc_refname);
                                    Var.loc_reject = Relational.ISNULL(locinfo.loc_refname);
                                    Var.handler_reject = Relational.ISNULL(person_ID_displayName.displayName);
                                    Var.obj_reject = Relational.ISNULL(obj_IDs.obj_CSID);
                                    Var.move2obj_CSID = Guid.getUUID();
                                    Var.obj2move_CSID = Guid.getUUID();
                                    Var.reason4move = StringHandling.UPCASE(obj_loc.reason_for_move).equals("I")
                                            ? "Inventory"
                                            : (StringHandling.UPCASE(obj_loc.reason_for_move).equals("M")
                                                    ? "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

                                    ;
                                    Var.move_uri = "/movements/" + Var.move_CSID;
                                    Var.move_refname = "urn:cspace:pahma.cspace.berkeley.edu:movements:id("
                                            + Var.move_CSID + ")";
                                    Var.obj_uri = "/collectionobjects/" + obj_IDs.obj_CSID;
                                    Var.obj_refname = "urn:cspace:pahma.cspace.berkeley.edu:collectionobjects:id("
                                            + obj_IDs.obj_CSID + ")'" + obj_IDs.objectNumber + "'";
                                    Var.rel_m2o_uri = "/relations/" + Var.move2obj_CSID;
                                    Var.rel_m2o_refname = "urn:cspace:pahma.cspace.berkeley.edu:collectionobjects:id("
                                            + Var.move2obj_CSID + ")";
                                    Var.rel_o2m_uri = "/relations/" + Var.obj2move_CSID;
                                    Var.rel_o2m_refname = "urn:cspace:pahma.cspace.berkeley.edu:collectionobjects:id("
                                            + Var.obj2move_CSID + ")";// ###############################
                                    // ###############################
                                    // # Output tables

                                    out_moveXML = null;
                                    moveCSID = null;
                                    ID = null;
                                    unmatch_loc = null;
                                    move2obj_XML = null;
                                    obj2move_XML = null;

                                    // # Output table : 'out_moveXML'
                                    out_moveXML_tmp.Item_Num = StringHandling.TRIM(obj_loc.objectNumber);
                                    out_moveXML_tmp.locations_refname = locinfo.loc_refname;
                                    out_moveXML_tmp.locations_displayname = StringHandling
                                            .TRIM(obj_loc.location);
                                    out_moveXML_tmp.loc_handler = person_ID_displayName.person_refname;
                                    out_moveXML_tmp.Capture_timestamp = Var.datetimeTZ;
                                    out_moveXML_tmp.reason4move = Var.reason4move;
                                    out_moveXML_tmp.computedSummary = Var.computedSummary;
                                    out_moveXML_tmp.moveID = Var.moveID;
                                    out_moveXML_tmp.moveCSID = Var.move_CSID;
                                    out_moveXML_tmp.move_uri = Var.move_uri;
                                    out_moveXML_tmp.move_refname = Var.move_refname;
                                    out_moveXML = out_moveXML_tmp;

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

                                    // # Output table : 'ID'
                                    ID_tmp.Item_Num = StringHandling.TRIM(obj_loc.objectNumber);
                                    ID_tmp.moveID = Var.moveID;
                                    ID_tmp.null_loc = Var.loc_reject;
                                    ID_tmp.null_handler = Var.handler_reject;
                                    ID_tmp.null_obj = Var.obj_reject;
                                    ID_tmp.locations_refname = locinfo.loc_refname;
                                    ID_tmp.loc_handler_refname = person_ID_displayName.person_refname;
                                    ID_tmp.capture_datetime = Var.datetimeTZ;
                                    ID_tmp.moveCSID = Var.move_CSID;
                                    ID_tmp.move2obj_CSID = Var.move2obj_CSID;
                                    ID_tmp.obj2move_CSID = Var.obj2move_CSID;
                                    ID_tmp.move_uri = Var.move_uri;
                                    ID_tmp.move_refname = Var.move_refname;
                                    ID_tmp.obj_uri = Var.obj_uri;
                                    ID_tmp.obj_refname = Var.obj_refname;
                                    ID = ID_tmp;

                                    // # Output table : 'unmatch_loc'
                                    // # Filter conditions
                                    if (

                                    Var.loc_reject || Var.obj_reject || Var.handler_reject

                                    ) {
                                        unmatch_loc_tmp.Item_Num = StringHandling.TRIM(obj_loc.objectNumber);
                                        unmatch_loc_tmp.moveID = Var.moveID;
                                        unmatch_loc_tmp.reject_loc = Var.loc_reject;
                                        unmatch_loc_tmp.reject_handler = Var.handler_reject;
                                        unmatch_loc_tmp.reject_obj = Var.obj_reject;
                                        unmatch_loc_tmp.Location = obj_loc.location;
                                        unmatch_loc_tmp.locations_refname = locinfo.loc_refname;
                                        unmatch_loc_tmp.loc_handler = obj_loc.person_scanning;
                                        unmatch_loc_tmp.loc_handler_refname = person_ID_displayName.person_refname;
                                        unmatch_loc_tmp.Capture_timestamp = obj_loc.date_time;
                                        unmatch_loc = unmatch_loc_tmp;
                                    } // closing filter/reject

                                    // # Output table : 'move2obj_XML'
                                    move2obj_XML_tmp.objectNum = StringHandling.TRIM(obj_loc.objectNumber);
                                    move2obj_XML_tmp.obj_CSID = obj_IDs.obj_CSID;
                                    move2obj_XML_tmp.objectDocType = "CollectionObject";
                                    move2obj_XML_tmp.moveID = Var.moveID;
                                    move2obj_XML_tmp.move_CSID = Var.move_CSID;
                                    move2obj_XML_tmp.move_URI = "/movements/" + Var.move_CSID;
                                    move2obj_XML_tmp.subjectDocType = "Movement";
                                    move2obj_XML_tmp.loc_refName = Var.trim_locrefname;
                                    move2obj_XML_tmp.move_timestamp = Var.datetimeTZ;
                                    move2obj_XML_tmp.move2obj_CSID = Var.move2obj_CSID;
                                    move2obj_XML_tmp.move_refname = Var.move_refname;
                                    move2obj_XML_tmp.obj_uri = Var.obj_uri;
                                    move2obj_XML_tmp.obj_refname = Var.obj_refname;
                                    move2obj_XML_tmp.rel_m2o_uri = Var.rel_m2o_uri;
                                    move2obj_XML_tmp.rel_m2o_refname = Var.rel_m2o_refname;
                                    move2obj_XML_tmp.datetimeTZ = Var.datetimeTZ;
                                    move2obj_XML = move2obj_XML_tmp;

                                    // # Output table : 'obj2move_XML'
                                    obj2move_XML_tmp.objectNum = StringHandling.TRIM(obj_loc.objectNumber);
                                    obj2move_XML_tmp.obj_CSID = obj_IDs.obj_CSID;
                                    obj2move_XML_tmp.subjectDoctype = "CollectionObject";
                                    obj2move_XML_tmp.moveID = Var.moveID;
                                    obj2move_XML_tmp.move_CSID = Var.move_CSID;
                                    obj2move_XML_tmp.move_URI = "/movements/" + Var.move_CSID;
                                    obj2move_XML_tmp.objectDoctype = "Movement";
                                    obj2move_XML_tmp.loc_refName = Var.trim_locrefname;
                                    obj2move_XML_tmp.move_timestamp = Var.datetimeTZ;
                                    obj2move_XML_tmp.obj2move_CSID = Var.obj2move_CSID;
                                    obj2move_XML_tmp.move_refname = Var.move_refname;
                                    obj2move_XML_tmp.obj_uri = Var.obj_uri;
                                    obj2move_XML_tmp.obj_refname = Var.obj_refname;
                                    obj2move_XML_tmp.rel_o2m_uri = Var.rel_o2m_uri;
                                    obj2move_XML_tmp.rel_o2m_refname = Var.rel_o2m_refname;
                                    obj2move_XML_tmp.datetimeTZ = Var.datetimeTZ;
                                    obj2move_XML = obj2move_XML_tmp;
                                    // ###############################

                                } // end of Var scope

                                rejectedInnerJoin_tMap_1 = false;

                                tos_count_tMap_1++;

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

                                    /**
                                     * [tAdvancedFileOutputXML_1 main ]
                                     * start
                                     */

                                    currentComponent = "tAdvancedFileOutputXML_1";

                                    nb_line_tAFOX_1++;
                                    valueMap_tAFOX_1.clear();
                                    valueMap_tAFOX_1.put("Item_Num", (out_moveXML.Item_Num.toString()));
                                    valueMap_tAFOX_1.put("locations_refname",
                                            (out_moveXML.locations_refname != null
                                                    ? out_moveXML.locations_refname.toString()
                                                    : null));
                                    valueMap_tAFOX_1.put("locations_displayname",
                                            (out_moveXML.locations_displayname.toString()));
                                    valueMap_tAFOX_1.put("loc_handler",
                                            (out_moveXML.loc_handler != null
                                                    ? out_moveXML.loc_handler.toString()
                                                    : null));
                                    valueMap_tAFOX_1.put("Capture_timestamp",
                                            (out_moveXML.Capture_timestamp != null
                                                    ? out_moveXML.Capture_timestamp.toString()
                                                    : null));
                                    valueMap_tAFOX_1.put("reason4move",
                                            (out_moveXML.reason4move != null
                                                    ? out_moveXML.reason4move.toString()
                                                    : null));
                                    valueMap_tAFOX_1.put("computedSummary",
                                            (out_moveXML.computedSummary.toString()));
                                    valueMap_tAFOX_1.put("moveID", (out_moveXML.moveID.toString()));
                                    valueMap_tAFOX_1.put("moveCSID", (out_moveXML.moveCSID.toString()));
                                    valueMap_tAFOX_1.put("move_uri", (out_moveXML.move_uri.toString()));
                                    valueMap_tAFOX_1.put("move_refname", (out_moveXML.move_refname.toString()));
                                    org.dom4j.Element subTreeRootParent_tAFOX_1 = null;

                                    // build root xml tree
                                    if (needRoot_tAFOX_1) {
                                        needRoot_tAFOX_1 = false;
                                        if (orders_tAFOX_1.length > 0) {
                                            orders_tAFOX_1[0] = 0;
                                        }
                                        org.dom4j.Element root_tAFOX_1 = doc_tAFOX_1.addElement("imports");
                                        subTreeRootParent_tAFOX_1 = root_tAFOX_1;
                                        root4Group_tAFOX_1 = subTreeRootParent_tAFOX_1;
                                    } else {
                                        subTreeRootParent_tAFOX_1 = root4Group_tAFOX_1;
                                    }
                                    // build group xml tree
                                    // build loop xml tree
                                    org.dom4j.Element loop_tAFOX_1 = org.dom4j.DocumentHelper
                                            .createElement("import");
                                    if (orders_tAFOX_1[0] == 0) {
                                        orders_tAFOX_1[0] = 0;
                                    }
                                    if (1 < orders_tAFOX_1.length) {
                                        orders_tAFOX_1[1] = 0;
                                    }
                                    subTreeRootParent_tAFOX_1.elements().add(orders_tAFOX_1[0]++, loop_tAFOX_1);
                                    loop_tAFOX_1.addAttribute("service", "Movements");
                                    loop_tAFOX_1.addAttribute("type", "Movement");
                                    if (valueMap_tAFOX_1.get("moveCSID") != null) {
                                        loop_tAFOX_1.addAttribute("CSID", valueMap_tAFOX_1.get("moveCSID"));
                                    }
                                    org.dom4j.Element loop_0_tAFOX_1 = loop_tAFOX_1.addElement("schema");
                                    loop_0_tAFOX_1.addNamespace("movements_common", TalendString
                                            .replaceSpecialCharForXML("http://collectionspace.org/movement/"));
                                    loop_0_tAFOX_1.addAttribute("name", "movements_common");
                                    org.dom4j.Element loop_0_0_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_0_tAFOX_1 = loop_0_tAFOX_1.addElement("movementNote");
                                    } else {
                                        loop_0_0_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:movementNote");
                                    }
                                    loop_0_0_tAFOX_1.setName("movements_common:movementNote");
                                    org.dom4j.Element loop_0_1_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_1_tAFOX_1 = loop_0_tAFOX_1.addElement("removalDate");
                                    } else {
                                        loop_0_1_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:removalDate");
                                    }
                                    loop_0_1_tAFOX_1.setName("movements_common:removalDate");
                                    org.dom4j.Element loop_0_2_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_2_tAFOX_1 = loop_0_tAFOX_1.addElement("reasonForMove");
                                    } else {
                                        loop_0_2_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:reasonForMove");
                                    }
                                    if (valueMap_tAFOX_1.get("reason4move") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_0_2_tAFOX_1,
                                                valueMap_tAFOX_1.get("reason4move"));
                                    }
                                    loop_0_2_tAFOX_1.setName("movements_common:reasonForMove");
                                    org.dom4j.Element loop_0_3_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_3_tAFOX_1 = loop_0_tAFOX_1.addElement("movementMethods");
                                    } else {
                                        loop_0_3_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:movementMethods");
                                    }
                                    loop_0_3_tAFOX_1.setName("movements_common:movementMethods");
                                    org.dom4j.Element loop_0_3_0_tAFOX_1 = loop_0_3_tAFOX_1
                                            .addElement("movementMethod");
                                    org.dom4j.Element loop_0_4_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_4_tAFOX_1 = loop_0_tAFOX_1.addElement("plannedRemovalDate");
                                    } else {
                                        loop_0_4_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:plannedRemovalDate");
                                    }
                                    loop_0_4_tAFOX_1.setName("movements_common:plannedRemovalDate");
                                    org.dom4j.Element loop_0_5_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_5_tAFOX_1 = loop_0_tAFOX_1.addElement("movementContact");
                                    } else {
                                        loop_0_5_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:movementContact");
                                    }
                                    loop_0_5_tAFOX_1.setName("movements_common:movementContact");
                                    org.dom4j.Element loop_0_6_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_6_tAFOX_1 = loop_0_tAFOX_1.addElement("normalLocation");
                                    } else {
                                        loop_0_6_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:normalLocation");
                                    }
                                    loop_0_6_tAFOX_1.setName("movements_common:normalLocation");
                                    org.dom4j.Element loop_0_7_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_7_tAFOX_1 = loop_0_tAFOX_1.addElement("currentLocationFitness");
                                    } else {
                                        loop_0_7_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:currentLocationFitness");
                                    }
                                    loop_0_7_tAFOX_1.setName("movements_common:currentLocationFitness");
                                    org.dom4j.Element loop_0_8_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_8_tAFOX_1 = loop_0_tAFOX_1.addElement("currentLocation");
                                    } else {
                                        loop_0_8_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:currentLocation");
                                    }
                                    if (valueMap_tAFOX_1.get("locations_refname") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_0_8_tAFOX_1,
                                                valueMap_tAFOX_1.get("locations_refname"));
                                    }
                                    loop_0_8_tAFOX_1.setName("movements_common:currentLocation");
                                    org.dom4j.Element loop_0_9_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_9_tAFOX_1 = loop_0_tAFOX_1.addElement("locationDate");
                                    } else {
                                        loop_0_9_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:locationDate");
                                    }
                                    if (valueMap_tAFOX_1.get("Capture_timestamp") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_0_9_tAFOX_1,
                                                valueMap_tAFOX_1.get("Capture_timestamp"));
                                    }
                                    loop_0_9_tAFOX_1.setName("movements_common:locationDate");
                                    org.dom4j.Element loop_0_10_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_10_tAFOX_1 = loop_0_tAFOX_1.addElement("currentLocationNote");
                                    } else {
                                        loop_0_10_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:currentLocationNote");
                                    }
                                    if (valueMap_tAFOX_1.get("Item_Num") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_0_10_tAFOX_1,
                                                valueMap_tAFOX_1.get("Item_Num"));
                                    }
                                    loop_0_10_tAFOX_1.setName("movements_common:currentLocationNote");
                                    org.dom4j.Element loop_0_11_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_11_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movementReferenceNumber");
                                    } else {
                                        loop_0_11_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:movementReferenceNumber");
                                    }
                                    if (valueMap_tAFOX_1.get("moveID") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_0_11_tAFOX_1,
                                                valueMap_tAFOX_1.get("moveID"));
                                    }
                                    loop_0_11_tAFOX_1.setName("movements_common:movementReferenceNumber");
                                    org.dom4j.Element loop_1_tAFOX_1 = loop_tAFOX_1.addElement("schema2");
                                    loop_1_tAFOX_1.addNamespace("movements_anthropology",
                                            TalendString.replaceSpecialCharForXML(
                                                    "http://collectionspace.org/services/movement/domain/anthropology"));
                                    loop_1_tAFOX_1.addAttribute("name", "movements_anthropology");
                                    org.dom4j.Element loop_1_0_tAFOX_1;
                                    if (loop_1_tAFOX_1
                                            .getNamespaceForPrefix("movements_anthropology") == null) {
                                        loop_1_0_tAFOX_1 = loop_1_tAFOX_1.addElement("locationHandlers");
                                    } else {
                                        loop_1_0_tAFOX_1 = loop_1_tAFOX_1
                                                .addElement("movements_anthropology:locationHandlers");
                                    }
                                    loop_1_0_tAFOX_1.setName("movements_anthropology:locationHandlers");
                                    org.dom4j.Element loop_1_0_0_tAFOX_1 = loop_1_0_tAFOX_1
                                            .addElement("locationHandler");
                                    if (valueMap_tAFOX_1.get("loc_handler") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_1_0_0_tAFOX_1,
                                                valueMap_tAFOX_1.get("loc_handler"));
                                    }
                                    org.dom4j.Element loop_1_1_tAFOX_1;
                                    if (loop_1_tAFOX_1
                                            .getNamespaceForPrefix("movements_anthropology") == null) {
                                        loop_1_1_tAFOX_1 = loop_1_tAFOX_1.addElement("computedSummary");
                                    } else {
                                        loop_1_1_tAFOX_1 = loop_1_tAFOX_1
                                                .addElement("movements_anthropology:computedSummary");
                                    }
                                    if (valueMap_tAFOX_1.get("computedSummary") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_1_1_tAFOX_1,
                                                valueMap_tAFOX_1.get("computedSummary"));
                                    }
                                    loop_1_1_tAFOX_1.setName("movements_anthropology:computedSummary");
                                    org.dom4j.Element loop_2_tAFOX_1 = loop_tAFOX_1.addElement("schema0");
                                    loop_2_tAFOX_1.addNamespace("collectionspace_core",
                                            TalendString.replaceSpecialCharForXML(
                                                    "http://collectionspace.org/collectionspace_core/"));
                                    loop_2_tAFOX_1.addAttribute("name", "collectionspace_core");
                                    org.dom4j.Element loop_2_0_tAFOX_1 = loop_2_tAFOX_1.addElement("uri");
                                    if (valueMap_tAFOX_1.get("move_uri") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_2_0_tAFOX_1,
                                                valueMap_tAFOX_1.get("move_uri"));
                                    }
                                    org.dom4j.Element loop_2_1_tAFOX_1 = loop_2_tAFOX_1.addElement("refName");
                                    if (valueMap_tAFOX_1.get("move_refname") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_2_1_tAFOX_1,
                                                valueMap_tAFOX_1.get("move_refname"));
                                    }

                                    tos_count_tAdvancedFileOutputXML_1++;

                                    /**
                                     * [tAdvancedFileOutputXML_1 main ] stop
                                     */

                                } // End of branch "out_moveXML"

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

                                    /**
                                     * [tFileOutputDelimited_1 main ] start
                                     */

                                    currentComponent = "tFileOutputDelimited_1";

                                    StringBuilder sb_tFileOutputDelimited_1 = new StringBuilder();

                                    if (moveCSID.moveCSID != null) {

                                        sb_tFileOutputDelimited_1.append(

                                                moveCSID.moveCSID

                                        );

                                    }

                                    sb_tFileOutputDelimited_1.append(OUT_DELIM_ROWSEP_tFileOutputDelimited_1);

                                    nb_line_tFileOutputDelimited_1++;

                                    outtFileOutputDelimited_1.write(sb_tFileOutputDelimited_1.toString());

                                    tos_count_tFileOutputDelimited_1++;

                                    /**
                                     * [tFileOutputDelimited_1 main ] stop
                                     */

                                } // End of branch "moveCSID"

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

                                    /**
                                     * [tFileOutputDelimited_5 main ] start
                                     */

                                    currentComponent = "tFileOutputDelimited_5";

                                    StringBuilder sb_tFileOutputDelimited_5 = new StringBuilder();

                                    if (ID.Item_Num != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.Item_Num

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.moveID != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.moveID

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.null_loc != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.null_loc

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.null_handler != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.null_handler

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.null_obj != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.null_obj

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.locations_refname != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.locations_refname

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.loc_handler_refname != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.loc_handler_refname

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.capture_datetime != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.capture_datetime

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.moveCSID != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.moveCSID

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.move2obj_CSID != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.move2obj_CSID

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.obj2move_CSID != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.obj2move_CSID

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.move_uri != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.move_uri

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.move_refname != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.move_refname

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.obj_uri != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.obj_uri

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.obj_refname != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.obj_refname

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_ROWSEP_tFileOutputDelimited_5);

                                    nb_line_tFileOutputDelimited_5++;

                                    outtFileOutputDelimited_5.write(sb_tFileOutputDelimited_5.toString());

                                    tos_count_tFileOutputDelimited_5++;

                                    /**
                                     * [tFileOutputDelimited_5 main ] stop
                                     */

                                } // End of branch "ID"

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

                                    /**
                                     * [tFileOutputDelimited_4 main ] start
                                     */

                                    currentComponent = "tFileOutputDelimited_4";

                                    StringBuilder sb_tFileOutputDelimited_4 = new StringBuilder();

                                    if (unmatch_loc.Item_Num != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.Item_Num

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.moveID != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.moveID

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    sb_tFileOutputDelimited_4.append(

                                            unmatch_loc.reject_loc

                                    );

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.reject_handler != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.reject_handler

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.reject_obj != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.reject_obj

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.Location != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.Location

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.locations_refname != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.locations_refname

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.loc_handler != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.loc_handler

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.loc_handler_refname != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.loc_handler_refname

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.Capture_timestamp != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.Capture_timestamp

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_ROWSEP_tFileOutputDelimited_4);

                                    nb_line_tFileOutputDelimited_4++;

                                    outtFileOutputDelimited_4.write(sb_tFileOutputDelimited_4.toString());

                                    tos_count_tFileOutputDelimited_4++;

                                    /**
                                     * [tFileOutputDelimited_4 main ] stop
                                     */

                                } // End of branch "unmatch_loc"

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

                                    /**
                                     * [tSortRow_5_SortOut main ] start
                                     */

                                    currentComponent = "tSortRow_5_SortOut";

                                    Comparablemove2obj_XMLStruct arrayRowtSortRow_5_SortOut = new Comparablemove2obj_XMLStruct();

                                    arrayRowtSortRow_5_SortOut.objectNum = move2obj_XML.objectNum;
                                    arrayRowtSortRow_5_SortOut.obj_CSID = move2obj_XML.obj_CSID;
                                    arrayRowtSortRow_5_SortOut.objectDocType = move2obj_XML.objectDocType;
                                    arrayRowtSortRow_5_SortOut.moveID = move2obj_XML.moveID;
                                    arrayRowtSortRow_5_SortOut.move_CSID = move2obj_XML.move_CSID;
                                    arrayRowtSortRow_5_SortOut.move_URI = move2obj_XML.move_URI;
                                    arrayRowtSortRow_5_SortOut.subjectDocType = move2obj_XML.subjectDocType;
                                    arrayRowtSortRow_5_SortOut.loc_refName = move2obj_XML.loc_refName;
                                    arrayRowtSortRow_5_SortOut.move_timestamp = move2obj_XML.move_timestamp;
                                    arrayRowtSortRow_5_SortOut.move2obj_CSID = move2obj_XML.move2obj_CSID;
                                    arrayRowtSortRow_5_SortOut.move_refname = move2obj_XML.move_refname;
                                    arrayRowtSortRow_5_SortOut.obj_uri = move2obj_XML.obj_uri;
                                    arrayRowtSortRow_5_SortOut.obj_refname = move2obj_XML.obj_refname;
                                    arrayRowtSortRow_5_SortOut.rel_m2o_uri = move2obj_XML.rel_m2o_uri;
                                    arrayRowtSortRow_5_SortOut.rel_m2o_refname = move2obj_XML.rel_m2o_refname;
                                    arrayRowtSortRow_5_SortOut.datetimeTZ = move2obj_XML.datetimeTZ;
                                    list_tSortRow_5_SortOut.add(arrayRowtSortRow_5_SortOut);

                                    tos_count_tSortRow_5_SortOut++;

                                    /**
                                     * [tSortRow_5_SortOut main ] stop
                                     */

                                } // End of branch "move2obj_XML"

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

                                    /**
                                     * [tSortRow_4_SortOut main ] start
                                     */

                                    currentComponent = "tSortRow_4_SortOut";

                                    Comparableobj2move_XMLStruct arrayRowtSortRow_4_SortOut = new Comparableobj2move_XMLStruct();

                                    arrayRowtSortRow_4_SortOut.objectNum = obj2move_XML.objectNum;
                                    arrayRowtSortRow_4_SortOut.obj_CSID = obj2move_XML.obj_CSID;
                                    arrayRowtSortRow_4_SortOut.subjectDoctype = obj2move_XML.subjectDoctype;
                                    arrayRowtSortRow_4_SortOut.moveID = obj2move_XML.moveID;
                                    arrayRowtSortRow_4_SortOut.move_CSID = obj2move_XML.move_CSID;
                                    arrayRowtSortRow_4_SortOut.move_URI = obj2move_XML.move_URI;
                                    arrayRowtSortRow_4_SortOut.objectDoctype = obj2move_XML.objectDoctype;
                                    arrayRowtSortRow_4_SortOut.loc_refName = obj2move_XML.loc_refName;
                                    arrayRowtSortRow_4_SortOut.move_timestamp = obj2move_XML.move_timestamp;
                                    arrayRowtSortRow_4_SortOut.obj2move_CSID = obj2move_XML.obj2move_CSID;
                                    arrayRowtSortRow_4_SortOut.move_refname = obj2move_XML.move_refname;
                                    arrayRowtSortRow_4_SortOut.obj_uri = obj2move_XML.obj_uri;
                                    arrayRowtSortRow_4_SortOut.obj_refname = obj2move_XML.obj_refname;
                                    arrayRowtSortRow_4_SortOut.rel_o2m_uri = obj2move_XML.rel_o2m_uri;
                                    arrayRowtSortRow_4_SortOut.rel_o2m_refname = obj2move_XML.rel_o2m_refname;
                                    arrayRowtSortRow_4_SortOut.datetimeTZ = obj2move_XML.datetimeTZ;
                                    list_tSortRow_4_SortOut.add(arrayRowtSortRow_4_SortOut);

                                    tos_count_tSortRow_4_SortOut++;

                                    /**
                                     * [tSortRow_4_SortOut main ] stop
                                     */

                                } // End of branch "obj2move_XML"

                            } // End of branch "obj_loc"

                            /**
                             * [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_1 end ] start
                         */

                        currentComponent = "tMap_1";

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

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

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

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

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

                        /**
                         * [tMap_1 end ] stop
                         */

                        /**
                         * [tSortRow_4_SortOut end ] start
                         */

                        currentComponent = "tSortRow_4_SortOut";

                        obj2move_XMLStruct[] array_tSortRow_4_SortOut = list_tSortRow_4_SortOut
                                .toArray(new Comparableobj2move_XMLStruct[0]);

                        java.util.Arrays.sort(array_tSortRow_4_SortOut);

                        globalMap.put("tSortRow_4", array_tSortRow_4_SortOut);

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

                        /**
                         * [tSortRow_4_SortOut end ] stop
                         */

                        /**
                         * [tAdvancedFileOutputXML_3 begin ] start
                         */

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

                        int tos_count_tAdvancedFileOutputXML_3 = 0;

                        int nb_line_tAFOX_3 = 0;

                        boolean needRoot_tAFOX_3 = true;

                        String fileName_tAFOX_3 = "../temp/relation/barcode5_obj2move."
                                + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".xml";
                        Boolean alreadyExistsFile_tAFOX_3 = new java.io.File(fileName_tAFOX_3).exists();
                        fileName_tAFOX_3 = new java.io.File(fileName_tAFOX_3).getAbsolutePath().replace("\\",
                                "/");
                        String file_tAFOX_3 = "";

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

                        if (!createFiletAFOX_3.exists()) {
                            (new java.io.File(fileName_tAFOX_3.substring(0, fileName_tAFOX_3.lastIndexOf("/"))))
                                    .mkdirs();
                            needRoot_tAFOX_3 = true;
                        }

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

                        class NestXMLTool_tAFOX_3 {
                            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_3 nestXMLTool_tAFOX_3 = new NestXMLTool_tAFOX_3();
                        // sort group root element for judgement of group
                        java.util.List<org.dom4j.Element> groupElementList_tAFOX_3 = new java.util.ArrayList<org.dom4j.Element>();
                        org.dom4j.Element root4Group_tAFOX_3 = null;
                        org.dom4j.Document doc_tAFOX_3 = null;

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

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

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

                        int[] orders_tAFOX_3 = new int[1];

                        /**
                         * [tAdvancedFileOutputXML_3 begin ] stop
                         */

                        /**
                         * [tSortRow_4_SortIn begin ] start
                         */

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

                        int tos_count_tSortRow_4_SortIn = 0;

                        obj2move_XMLStruct[] array_tSortRow_4_SortIn = (obj2move_XMLStruct[]) globalMap
                                .get("tSortRow_4");

                        int nb_line_tSortRow_4_SortIn = 0;

                        obj2move_XMLStruct current_tSortRow_4_SortIn = null;

                        for (int i_tSortRow_4_SortIn = 0; i_tSortRow_4_SortIn < array_tSortRow_4_SortIn.length; i_tSortRow_4_SortIn++) {
                            current_tSortRow_4_SortIn = array_tSortRow_4_SortIn[i_tSortRow_4_SortIn];
                            row1.objectNum = current_tSortRow_4_SortIn.objectNum;
                            row1.obj_CSID = current_tSortRow_4_SortIn.obj_CSID;
                            row1.subjectDoctype = current_tSortRow_4_SortIn.subjectDoctype;
                            row1.moveID = current_tSortRow_4_SortIn.moveID;
                            row1.move_CSID = current_tSortRow_4_SortIn.move_CSID;
                            row1.move_URI = current_tSortRow_4_SortIn.move_URI;
                            row1.objectDoctype = current_tSortRow_4_SortIn.objectDoctype;
                            row1.loc_refName = current_tSortRow_4_SortIn.loc_refName;
                            row1.move_timestamp = current_tSortRow_4_SortIn.move_timestamp;
                            row1.obj2move_CSID = current_tSortRow_4_SortIn.obj2move_CSID;
                            row1.move_refname = current_tSortRow_4_SortIn.move_refname;
                            row1.obj_uri = current_tSortRow_4_SortIn.obj_uri;
                            row1.obj_refname = current_tSortRow_4_SortIn.obj_refname;
                            row1.rel_o2m_uri = current_tSortRow_4_SortIn.rel_o2m_uri;
                            row1.rel_o2m_refname = current_tSortRow_4_SortIn.rel_o2m_refname;
                            row1.datetimeTZ = current_tSortRow_4_SortIn.datetimeTZ;
                            // increase number of line sorted
                            nb_line_tSortRow_4_SortIn++;

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

                            currentComponent = "tSortRow_4_SortIn";

                            tos_count_tSortRow_4_SortIn++;

                            /**
                             * [tSortRow_4_SortIn main ] stop
                             */

                            /**
                             * [tAdvancedFileOutputXML_3 main ] start
                             */

                            currentComponent = "tAdvancedFileOutputXML_3";

                            nb_line_tAFOX_3++;
                            valueMap_tAFOX_3.clear();
                            valueMap_tAFOX_3.put("objectNum",
                                    (row1.objectNum != null ? row1.objectNum.toString() : null));
                            valueMap_tAFOX_3.put("obj_CSID",
                                    (row1.obj_CSID != null ? row1.obj_CSID.toString() : null));
                            valueMap_tAFOX_3.put("subjectDoctype",
                                    (row1.subjectDoctype != null ? row1.subjectDoctype.toString() : null));
                            valueMap_tAFOX_3.put("moveID",
                                    (row1.moveID != null ? row1.moveID.toString() : null));
                            valueMap_tAFOX_3.put("move_CSID",
                                    (row1.move_CSID != null ? row1.move_CSID.toString() : null));
                            valueMap_tAFOX_3.put("move_URI",
                                    (row1.move_URI != null ? row1.move_URI.toString() : null));
                            valueMap_tAFOX_3.put("objectDoctype",
                                    (row1.objectDoctype != null ? row1.objectDoctype.toString() : null));
                            valueMap_tAFOX_3.put("loc_refName",
                                    (row1.loc_refName != null ? row1.loc_refName.toString() : null));
                            valueMap_tAFOX_3.put("move_timestamp",
                                    (row1.move_timestamp != null ? row1.move_timestamp.toString() : null));
                            valueMap_tAFOX_3.put("obj2move_CSID", (row1.obj2move_CSID.toString()));
                            valueMap_tAFOX_3.put("move_refname", (row1.move_refname.toString()));
                            valueMap_tAFOX_3.put("obj_uri", (row1.obj_uri.toString()));
                            valueMap_tAFOX_3.put("obj_refname", (row1.obj_refname.toString()));
                            valueMap_tAFOX_3.put("rel_o2m_uri", (row1.rel_o2m_uri.toString()));
                            valueMap_tAFOX_3.put("rel_o2m_refname", (row1.rel_o2m_refname.toString()));
                            valueMap_tAFOX_3.put("datetimeTZ", (row1.datetimeTZ.toString()));
                            org.dom4j.Element subTreeRootParent_tAFOX_3 = null;

                            // build root xml tree
                            if (needRoot_tAFOX_3) {
                                needRoot_tAFOX_3 = false;
                                if (orders_tAFOX_3.length > 0) {
                                    orders_tAFOX_3[0] = 0;
                                }
                                org.dom4j.Element root_tAFOX_3 = doc_tAFOX_3.addElement("imports");
                                subTreeRootParent_tAFOX_3 = root_tAFOX_3;
                                root4Group_tAFOX_3 = subTreeRootParent_tAFOX_3;
                            } else {
                                subTreeRootParent_tAFOX_3 = root4Group_tAFOX_3;
                            }
                            // build group xml tree
                            // build loop xml tree
                            org.dom4j.Element loop_tAFOX_3 = org.dom4j.DocumentHelper.createElement("import");
                            if (orders_tAFOX_3[0] == 0) {
                                orders_tAFOX_3[0] = 0;
                            }
                            if (1 < orders_tAFOX_3.length) {
                                orders_tAFOX_3[1] = 0;
                            }
                            subTreeRootParent_tAFOX_3.elements().add(orders_tAFOX_3[0]++, loop_tAFOX_3);
                            loop_tAFOX_3.addAttribute("service", "Relations");
                            loop_tAFOX_3.addAttribute("type", "Relation");
                            if (valueMap_tAFOX_3.get("obj2move_CSID") != null) {
                                loop_tAFOX_3.addAttribute("CSID", valueMap_tAFOX_3.get("obj2move_CSID"));
                            }
                            org.dom4j.Element loop_0_tAFOX_3 = loop_tAFOX_3.addElement("schema");
                            loop_0_tAFOX_3.addNamespace("relations_common", TalendString
                                    .replaceSpecialCharForXML("http://collectionspace.org/relation"));
                            loop_0_tAFOX_3.addAttribute("name", "relations_common");
                            org.dom4j.Element loop_0_0_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_0_tAFOX_3 = loop_0_tAFOX_3.addElement("relationshipType");
                            } else {
                                loop_0_0_tAFOX_3 = loop_0_tAFOX_3
                                        .addElement("relations_common:relationshipType");
                            }
                            nestXMLTool_tAFOX_3.parseAndAdd(loop_0_0_tAFOX_3, "affects");

                            loop_0_0_tAFOX_3.setName("relations_common:relationshipType");
                            org.dom4j.Element loop_0_1_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_1_tAFOX_3 = loop_0_tAFOX_3.addElement("subjectCsid");
                            } else {
                                loop_0_1_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:subjectCsid");
                            }
                            if (valueMap_tAFOX_3.get("obj_CSID") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_1_tAFOX_3, valueMap_tAFOX_3.get("obj_CSID"));
                            }
                            loop_0_1_tAFOX_3.setName("relations_common:subjectCsid");
                            org.dom4j.Element loop_0_2_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_2_tAFOX_3 = loop_0_tAFOX_3.addElement("subjectDocumentType");
                            } else {
                                loop_0_2_tAFOX_3 = loop_0_tAFOX_3
                                        .addElement("relations_common:subjectDocumentType");
                            }
                            if (valueMap_tAFOX_3.get("subjectDoctype") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_2_tAFOX_3,
                                        valueMap_tAFOX_3.get("subjectDoctype"));
                            }
                            loop_0_2_tAFOX_3.setName("relations_common:subjectDocumentType");
                            org.dom4j.Element loop_0_3_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_3_tAFOX_3 = loop_0_tAFOX_3.addElement("subjectUri");
                            } else {
                                loop_0_3_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:subjectUri");
                            }
                            if (valueMap_tAFOX_3.get("obj_uri") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_3_tAFOX_3, valueMap_tAFOX_3.get("obj_uri"));
                            }
                            loop_0_3_tAFOX_3.setName("relations_common:subjectUri");
                            org.dom4j.Element loop_0_4_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_4_tAFOX_3 = loop_0_tAFOX_3.addElement("predicateDisplayName");
                            } else {
                                loop_0_4_tAFOX_3 = loop_0_tAFOX_3
                                        .addElement("relations_common:predicateDisplayName");
                            }
                            loop_0_4_tAFOX_3.setName("relations_common:predicateDisplayName");
                            org.dom4j.Element loop_0_5_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_5_tAFOX_3 = loop_0_tAFOX_3.addElement("predicate");
                            } else {
                                loop_0_5_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:predicate");
                            }
                            loop_0_5_tAFOX_3.setName("relations_common:predicate");
                            org.dom4j.Element loop_0_6_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_6_tAFOX_3 = loop_0_tAFOX_3.addElement("objectCsid");
                            } else {
                                loop_0_6_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:objectCsid");
                            }
                            if (valueMap_tAFOX_3.get("move_CSID") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_6_tAFOX_3,
                                        valueMap_tAFOX_3.get("move_CSID"));
                            }
                            loop_0_6_tAFOX_3.setName("relations_common:objectCsid");
                            org.dom4j.Element loop_0_7_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_7_tAFOX_3 = loop_0_tAFOX_3.addElement("objectUri");
                            } else {
                                loop_0_7_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:objectUri");
                            }
                            if (valueMap_tAFOX_3.get("move_URI") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_7_tAFOX_3, valueMap_tAFOX_3.get("move_URI"));
                            }
                            loop_0_7_tAFOX_3.setName("relations_common:objectUri");
                            org.dom4j.Element loop_0_8_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_8_tAFOX_3 = loop_0_tAFOX_3.addElement("objectRefName");
                            } else {
                                loop_0_8_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:objectRefName");
                            }
                            if (valueMap_tAFOX_3.get("move_refname") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_8_tAFOX_3,
                                        valueMap_tAFOX_3.get("move_refname"));
                            }
                            loop_0_8_tAFOX_3.setName("relations_common:objectRefName");
                            org.dom4j.Element loop_0_9_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_9_tAFOX_3 = loop_0_tAFOX_3.addElement("subjectRefName");
                            } else {
                                loop_0_9_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:subjectRefName");
                            }
                            if (valueMap_tAFOX_3.get("obj_refname") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_9_tAFOX_3,
                                        valueMap_tAFOX_3.get("obj_refname"));
                            }
                            loop_0_9_tAFOX_3.setName("relations_common:subjectRefName");
                            org.dom4j.Element loop_0_10_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_10_tAFOX_3 = loop_0_tAFOX_3.addElement("objectDocumentType");
                            } else {
                                loop_0_10_tAFOX_3 = loop_0_tAFOX_3
                                        .addElement("relations_common:objectDocumentType");
                            }
                            if (valueMap_tAFOX_3.get("objectDoctype") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_10_tAFOX_3,
                                        valueMap_tAFOX_3.get("objectDoctype"));
                            }
                            loop_0_10_tAFOX_3.setName("relations_common:objectDocumentType");
                            org.dom4j.Element loop_1_tAFOX_3 = loop_tAFOX_3.addElement("schema0");
                            loop_1_tAFOX_3.addNamespace("collectionspace_core",
                                    TalendString.replaceSpecialCharForXML(
                                            "http://collectionspace.org/collectionspace_core/"));
                            loop_1_tAFOX_3.addAttribute("name", "collectionspace_core");
                            org.dom4j.Element loop_1_0_tAFOX_3 = loop_1_tAFOX_3.addElement("uri");
                            if (valueMap_tAFOX_3.get("rel_o2m_uri") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_1_0_tAFOX_3,
                                        valueMap_tAFOX_3.get("rel_o2m_uri"));
                            }
                            org.dom4j.Element loop_1_1_tAFOX_3 = loop_1_tAFOX_3.addElement("refName");
                            if (valueMap_tAFOX_3.get("rel_o2m_refname") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_1_1_tAFOX_3,
                                        valueMap_tAFOX_3.get("rel_o2m_refname"));
                            }

                            tos_count_tAdvancedFileOutputXML_3++;

                            /**
                             * [tAdvancedFileOutputXML_3 main ] stop
                             */

                            /**
                             * [tSortRow_4_SortIn end ] start
                             */

                            currentComponent = "tSortRow_4_SortIn";

                        }

                        globalMap.put("tSortRow_4_SortIn_NB_LINE", nb_line_tSortRow_4_SortIn);

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

                        /**
                         * [tSortRow_4_SortIn end ] stop
                         */

                        /**
                         * [tAdvancedFileOutputXML_3 end ] start
                         */

                        currentComponent = "tAdvancedFileOutputXML_3";

                        java.io.FileOutputStream stream_tAFOX_3 = new java.io.FileOutputStream(
                                fileName_tAFOX_3);
                        org.dom4j.io.XMLWriter output_tAFOX_3 = new org.dom4j.io.XMLWriter(stream_tAFOX_3,
                                format_tAFOX_3);
                        if (doc_tAFOX_3.getRootElement() != null) {
                            nestXMLTool_tAFOX_3.replaceDefaultNameSpace(doc_tAFOX_3.getRootElement());
                            output_tAFOX_3.write(doc_tAFOX_3);
                        }
                        output_tAFOX_3.close();
                        globalMap.put("tAdvancedFileOutputXML_3_NB_LINE", nb_line_tAFOX_3);

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

                        /**
                         * [tAdvancedFileOutputXML_3 end ] stop
                         */

                        /**
                         * [tSortRow_5_SortOut end ] start
                         */

                        currentComponent = "tSortRow_5_SortOut";

                        move2obj_XMLStruct[] array_tSortRow_5_SortOut = list_tSortRow_5_SortOut
                                .toArray(new Comparablemove2obj_XMLStruct[0]);

                        java.util.Arrays.sort(array_tSortRow_5_SortOut);

                        globalMap.put("tSortRow_5", array_tSortRow_5_SortOut);

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

                        /**
                         * [tSortRow_5_SortOut end ] stop
                         */

                        /**
                         * [tAdvancedFileOutputXML_2 begin ] start
                         */

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

                        int tos_count_tAdvancedFileOutputXML_2 = 0;

                        int nb_line_tAFOX_2 = 0;

                        boolean needRoot_tAFOX_2 = true;

                        String fileName_tAFOX_2 = "../temp/relation/barcode5_move2obj."
                                + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".xml";
                        Boolean alreadyExistsFile_tAFOX_2 = new java.io.File(fileName_tAFOX_2).exists();
                        fileName_tAFOX_2 = new java.io.File(fileName_tAFOX_2).getAbsolutePath().replace("\\",
                                "/");
                        String file_tAFOX_2 = "";

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

                        if (!createFiletAFOX_2.exists()) {
                            (new java.io.File(fileName_tAFOX_2.substring(0, fileName_tAFOX_2.lastIndexOf("/"))))
                                    .mkdirs();
                            needRoot_tAFOX_2 = true;
                        }

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

                        class NestXMLTool_tAFOX_2 {
                            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_2 nestXMLTool_tAFOX_2 = new NestXMLTool_tAFOX_2();
                        // sort group root element for judgement of group
                        java.util.List<org.dom4j.Element> groupElementList_tAFOX_2 = new java.util.ArrayList<org.dom4j.Element>();
                        org.dom4j.Element root4Group_tAFOX_2 = null;
                        org.dom4j.Document doc_tAFOX_2 = null;

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

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

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

                        int[] orders_tAFOX_2 = new int[1];

                        /**
                         * [tAdvancedFileOutputXML_2 begin ] stop
                         */

                        /**
                         * [tSortRow_5_SortIn begin ] start
                         */

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

                        int tos_count_tSortRow_5_SortIn = 0;

                        move2obj_XMLStruct[] array_tSortRow_5_SortIn = (move2obj_XMLStruct[]) globalMap
                                .get("tSortRow_5");

                        int nb_line_tSortRow_5_SortIn = 0;

                        move2obj_XMLStruct current_tSortRow_5_SortIn = null;

                        for (int i_tSortRow_5_SortIn = 0; i_tSortRow_5_SortIn < array_tSortRow_5_SortIn.length; i_tSortRow_5_SortIn++) {
                            current_tSortRow_5_SortIn = array_tSortRow_5_SortIn[i_tSortRow_5_SortIn];
                            row3.objectNum = current_tSortRow_5_SortIn.objectNum;
                            row3.obj_CSID = current_tSortRow_5_SortIn.obj_CSID;
                            row3.objectDocType = current_tSortRow_5_SortIn.objectDocType;
                            row3.moveID = current_tSortRow_5_SortIn.moveID;
                            row3.move_CSID = current_tSortRow_5_SortIn.move_CSID;
                            row3.move_URI = current_tSortRow_5_SortIn.move_URI;
                            row3.subjectDocType = current_tSortRow_5_SortIn.subjectDocType;
                            row3.loc_refName = current_tSortRow_5_SortIn.loc_refName;
                            row3.move_timestamp = current_tSortRow_5_SortIn.move_timestamp;
                            row3.move2obj_CSID = current_tSortRow_5_SortIn.move2obj_CSID;
                            row3.move_refname = current_tSortRow_5_SortIn.move_refname;
                            row3.obj_uri = current_tSortRow_5_SortIn.obj_uri;
                            row3.obj_refname = current_tSortRow_5_SortIn.obj_refname;
                            row3.rel_m2o_uri = current_tSortRow_5_SortIn.rel_m2o_uri;
                            row3.rel_m2o_refname = current_tSortRow_5_SortIn.rel_m2o_refname;
                            row3.datetimeTZ = current_tSortRow_5_SortIn.datetimeTZ;
                            // increase number of line sorted
                            nb_line_tSortRow_5_SortIn++;

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

                            currentComponent = "tSortRow_5_SortIn";

                            tos_count_tSortRow_5_SortIn++;

                            /**
                             * [tSortRow_5_SortIn main ] stop
                             */

                            /**
                             * [tAdvancedFileOutputXML_2 main ] start
                             */

                            currentComponent = "tAdvancedFileOutputXML_2";

                            nb_line_tAFOX_2++;
                            valueMap_tAFOX_2.clear();
                            valueMap_tAFOX_2.put("objectNum",
                                    (row3.objectNum != null ? row3.objectNum.toString() : null));
                            valueMap_tAFOX_2.put("obj_CSID",
                                    (row3.obj_CSID != null ? row3.obj_CSID.toString() : null));
                            valueMap_tAFOX_2.put("objectDocType",
                                    (row3.objectDocType != null ? row3.objectDocType.toString() : null));
                            valueMap_tAFOX_2.put("moveID",
                                    (row3.moveID != null ? row3.moveID.toString() : null));
                            valueMap_tAFOX_2.put("move_CSID",
                                    (row3.move_CSID != null ? row3.move_CSID.toString() : null));
                            valueMap_tAFOX_2.put("move_URI",
                                    (row3.move_URI != null ? row3.move_URI.toString() : null));
                            valueMap_tAFOX_2.put("subjectDocType",
                                    (row3.subjectDocType != null ? row3.subjectDocType.toString() : null));
                            valueMap_tAFOX_2.put("loc_refName",
                                    (row3.loc_refName != null ? row3.loc_refName.toString() : null));
                            valueMap_tAFOX_2.put("move_timestamp",
                                    (row3.move_timestamp != null ? row3.move_timestamp.toString() : null));
                            valueMap_tAFOX_2.put("move2obj_CSID", (row3.move2obj_CSID.toString()));
                            valueMap_tAFOX_2.put("move_refname", (row3.move_refname.toString()));
                            valueMap_tAFOX_2.put("obj_uri", (row3.obj_uri.toString()));
                            valueMap_tAFOX_2.put("obj_refname", (row3.obj_refname.toString()));
                            valueMap_tAFOX_2.put("rel_m2o_uri", (row3.rel_m2o_uri.toString()));
                            valueMap_tAFOX_2.put("rel_m2o_refname", (row3.rel_m2o_refname.toString()));
                            valueMap_tAFOX_2.put("datetimeTZ", (row3.datetimeTZ.toString()));
                            org.dom4j.Element subTreeRootParent_tAFOX_2 = null;

                            // build root xml tree
                            if (needRoot_tAFOX_2) {
                                needRoot_tAFOX_2 = false;
                                if (orders_tAFOX_2.length > 0) {
                                    orders_tAFOX_2[0] = 0;
                                }
                                org.dom4j.Element root_tAFOX_2 = doc_tAFOX_2.addElement("imports");
                                subTreeRootParent_tAFOX_2 = root_tAFOX_2;
                                root4Group_tAFOX_2 = subTreeRootParent_tAFOX_2;
                            } else {
                                subTreeRootParent_tAFOX_2 = root4Group_tAFOX_2;
                            }
                            // build group xml tree
                            // build loop xml tree
                            org.dom4j.Element loop_tAFOX_2 = org.dom4j.DocumentHelper.createElement("import");
                            if (orders_tAFOX_2[0] == 0) {
                                orders_tAFOX_2[0] = 0;
                            }
                            if (1 < orders_tAFOX_2.length) {
                                orders_tAFOX_2[1] = 0;
                            }
                            subTreeRootParent_tAFOX_2.elements().add(orders_tAFOX_2[0]++, loop_tAFOX_2);
                            loop_tAFOX_2.addAttribute("service", "Relations");
                            loop_tAFOX_2.addAttribute("type", "Relation");
                            if (valueMap_tAFOX_2.get("move2obj_CSID") != null) {
                                loop_tAFOX_2.addAttribute("CSID", valueMap_tAFOX_2.get("move2obj_CSID"));
                            }
                            org.dom4j.Element loop_0_tAFOX_2 = loop_tAFOX_2.addElement("schema");
                            loop_0_tAFOX_2.addNamespace("relations_common", TalendString
                                    .replaceSpecialCharForXML("http://collectionspace.org/relation"));
                            loop_0_tAFOX_2.addAttribute("name", "relations_common");
                            org.dom4j.Element loop_0_0_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_0_tAFOX_2 = loop_0_tAFOX_2.addElement("relationshipType");
                            } else {
                                loop_0_0_tAFOX_2 = loop_0_tAFOX_2
                                        .addElement("relations_common:relationshipType");
                            }
                            nestXMLTool_tAFOX_2.parseAndAdd(loop_0_0_tAFOX_2, "affects");

                            loop_0_0_tAFOX_2.setName("relations_common:relationshipType");
                            org.dom4j.Element loop_0_1_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_1_tAFOX_2 = loop_0_tAFOX_2.addElement("subjectCsid");
                            } else {
                                loop_0_1_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:subjectCsid");
                            }
                            if (valueMap_tAFOX_2.get("move_CSID") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_1_tAFOX_2,
                                        valueMap_tAFOX_2.get("move_CSID"));
                            }
                            loop_0_1_tAFOX_2.setName("relations_common:subjectCsid");
                            org.dom4j.Element loop_0_2_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_2_tAFOX_2 = loop_0_tAFOX_2.addElement("subjectDocumentType");
                            } else {
                                loop_0_2_tAFOX_2 = loop_0_tAFOX_2
                                        .addElement("relations_common:subjectDocumentType");
                            }
                            if (valueMap_tAFOX_2.get("subjectDocType") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_2_tAFOX_2,
                                        valueMap_tAFOX_2.get("subjectDocType"));
                            }
                            loop_0_2_tAFOX_2.setName("relations_common:subjectDocumentType");
                            org.dom4j.Element loop_0_3_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_3_tAFOX_2 = loop_0_tAFOX_2.addElement("subjectUri");
                            } else {
                                loop_0_3_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:subjectUri");
                            }
                            if (valueMap_tAFOX_2.get("move_URI") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_3_tAFOX_2, valueMap_tAFOX_2.get("move_URI"));
                            }
                            loop_0_3_tAFOX_2.setName("relations_common:subjectUri");
                            org.dom4j.Element loop_0_4_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_4_tAFOX_2 = loop_0_tAFOX_2.addElement("predicateDisplayName");
                            } else {
                                loop_0_4_tAFOX_2 = loop_0_tAFOX_2
                                        .addElement("relations_common:predicateDisplayName");
                            }
                            loop_0_4_tAFOX_2.setName("relations_common:predicateDisplayName");
                            org.dom4j.Element loop_0_5_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_5_tAFOX_2 = loop_0_tAFOX_2.addElement("predicate");
                            } else {
                                loop_0_5_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:predicate");
                            }
                            loop_0_5_tAFOX_2.setName("relations_common:predicate");
                            org.dom4j.Element loop_0_6_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_6_tAFOX_2 = loop_0_tAFOX_2.addElement("objectCsid");
                            } else {
                                loop_0_6_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:objectCsid");
                            }
                            if (valueMap_tAFOX_2.get("obj_CSID") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_6_tAFOX_2, valueMap_tAFOX_2.get("obj_CSID"));
                            }
                            loop_0_6_tAFOX_2.setName("relations_common:objectCsid");
                            org.dom4j.Element loop_0_7_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_7_tAFOX_2 = loop_0_tAFOX_2.addElement("objectUri");
                            } else {
                                loop_0_7_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:objectUri");
                            }
                            if (valueMap_tAFOX_2.get("obj_uri") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_7_tAFOX_2, valueMap_tAFOX_2.get("obj_uri"));
                            }
                            loop_0_7_tAFOX_2.setName("relations_common:objectUri");
                            org.dom4j.Element loop_0_8_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_8_tAFOX_2 = loop_0_tAFOX_2.addElement("objectRefName");
                            } else {
                                loop_0_8_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:objectRefName");
                            }
                            if (valueMap_tAFOX_2.get("obj_refname") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_8_tAFOX_2,
                                        valueMap_tAFOX_2.get("obj_refname"));
                            }
                            loop_0_8_tAFOX_2.setName("relations_common:objectRefName");
                            org.dom4j.Element loop_0_9_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_9_tAFOX_2 = loop_0_tAFOX_2.addElement("subjectRefName");
                            } else {
                                loop_0_9_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:subjectRefName");
                            }
                            if (valueMap_tAFOX_2.get("move_refname") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_9_tAFOX_2,
                                        valueMap_tAFOX_2.get("move_refname"));
                            }
                            loop_0_9_tAFOX_2.setName("relations_common:subjectRefName");
                            org.dom4j.Element loop_0_10_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_10_tAFOX_2 = loop_0_tAFOX_2.addElement("objectDocumentType");
                            } else {
                                loop_0_10_tAFOX_2 = loop_0_tAFOX_2
                                        .addElement("relations_common:objectDocumentType");
                            }
                            if (valueMap_tAFOX_2.get("objectDocType") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_10_tAFOX_2,
                                        valueMap_tAFOX_2.get("objectDocType"));
                            }
                            loop_0_10_tAFOX_2.setName("relations_common:objectDocumentType");
                            org.dom4j.Element loop_1_tAFOX_2 = loop_tAFOX_2.addElement("schema0");
                            loop_1_tAFOX_2.addNamespace("collectionspace_core",
                                    TalendString.replaceSpecialCharForXML(
                                            "http://collectionspace.org/collectionspace_core/"));
                            loop_1_tAFOX_2.addAttribute("name", "collectionspace_core");
                            org.dom4j.Element loop_1_0_tAFOX_2 = loop_1_tAFOX_2.addElement("uri");
                            if (valueMap_tAFOX_2.get("rel_m2o_uri") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_1_0_tAFOX_2,
                                        valueMap_tAFOX_2.get("rel_m2o_uri"));
                            }
                            org.dom4j.Element loop_1_1_tAFOX_2 = loop_1_tAFOX_2.addElement("refName");
                            if (valueMap_tAFOX_2.get("rel_m2o_refname") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_1_1_tAFOX_2,
                                        valueMap_tAFOX_2.get("rel_m2o_refname"));
                            }

                            tos_count_tAdvancedFileOutputXML_2++;

                            /**
                             * [tAdvancedFileOutputXML_2 main ] stop
                             */

                            /**
                             * [tSortRow_5_SortIn end ] start
                             */

                            currentComponent = "tSortRow_5_SortIn";

                        }

                        globalMap.put("tSortRow_5_SortIn_NB_LINE", nb_line_tSortRow_5_SortIn);

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

                        /**
                         * [tSortRow_5_SortIn end ] stop
                         */

                        /**
                         * [tAdvancedFileOutputXML_2 end ] start
                         */

                        currentComponent = "tAdvancedFileOutputXML_2";

                        java.io.FileOutputStream stream_tAFOX_2 = new java.io.FileOutputStream(
                                fileName_tAFOX_2);
                        org.dom4j.io.XMLWriter output_tAFOX_2 = new org.dom4j.io.XMLWriter(stream_tAFOX_2,
                                format_tAFOX_2);
                        if (doc_tAFOX_2.getRootElement() != null) {
                            nestXMLTool_tAFOX_2.replaceDefaultNameSpace(doc_tAFOX_2.getRootElement());
                            output_tAFOX_2.write(doc_tAFOX_2);
                        }
                        output_tAFOX_2.close();
                        globalMap.put("tAdvancedFileOutputXML_2_NB_LINE", nb_line_tAFOX_2);

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

                        /**
                         * [tAdvancedFileOutputXML_2 end ] stop
                         */

                        /**
                         * [tFileOutputDelimited_4 end ] start
                         */

                        currentComponent = "tFileOutputDelimited_4";

                    } finally {
                        if (outtFileOutputDelimited_4 != null) {
                            outtFileOutputDelimited_4.flush();
                            outtFileOutputDelimited_4.close();
                        }
                        globalMap.put("tFileOutputDelimited_4_NB_LINE", nb_line_tFileOutputDelimited_4);
                        globalMap.put("tFileOutputDelimited_4_FILE_NAME", fileName_tFileOutputDelimited_4);
                    } // finally

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

                    /**
                     * [tFileOutputDelimited_4 end ] stop
                     */

                    /**
                     * [tFileOutputDelimited_5 end ] start
                     */

                    currentComponent = "tFileOutputDelimited_5";

                } finally {
                    if (outtFileOutputDelimited_5 != null) {
                        outtFileOutputDelimited_5.flush();
                        outtFileOutputDelimited_5.close();
                    }
                    globalMap.put("tFileOutputDelimited_5_NB_LINE", nb_line_tFileOutputDelimited_5);
                    globalMap.put("tFileOutputDelimited_5_FILE_NAME", fileName_tFileOutputDelimited_5);
                } // finally

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

                /**
                 * [tFileOutputDelimited_5 end ] stop
                 */

                /**
                 * [tFileOutputDelimited_1 end ] start
                 */

                currentComponent = "tFileOutputDelimited_1";

            } finally {
                if (outtFileOutputDelimited_1 != null) {
                    outtFileOutputDelimited_1.flush();
                    outtFileOutputDelimited_1.close();
                }
                globalMap.put("tFileOutputDelimited_1_NB_LINE", nb_line_tFileOutputDelimited_1);
                globalMap.put("tFileOutputDelimited_1_FILE_NAME", fileName_tFileOutputDelimited_1);
            } // finally

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

            /**
             * [tFileOutputDelimited_1 end ] stop
             */

            /**
             * [tAdvancedFileOutputXML_1 end ] start
             */

            currentComponent = "tAdvancedFileOutputXML_1";

            java.io.FileOutputStream stream_tAFOX_1 = new java.io.FileOutputStream(fileName_tAFOX_1);
            org.dom4j.io.XMLWriter output_tAFOX_1 = new org.dom4j.io.XMLWriter(stream_tAFOX_1, format_tAFOX_1);
            if (doc_tAFOX_1.getRootElement() != null) {
                nestXMLTool_tAFOX_1.replaceDefaultNameSpace(doc_tAFOX_1.getRootElement());
                output_tAFOX_1.write(doc_tAFOX_1);
            }
            output_tAFOX_1.close();
            globalMap.put("tAdvancedFileOutputXML_1_NB_LINE", nb_line_tAFOX_1);

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

            /**
             * [tAdvancedFileOutputXML_1 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 "tSortRow_5_SortIn"
        globalMap.put("tSortRow_5", null);

        // free memory for "tSortRow_4_SortIn"
        globalMap.put("tSortRow_4", null);

        // free memory for "tMap_1"
        globalMap.put("tHash_Lookup_person_ID_displayName", null);

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

        // free memory for "tMap_1"
        globalMap.put("tHash_Lookup_obj_IDs", null);

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

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

    }

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

From source file:pahma_etl.tmslocation_barcode_6fld_1_1.TMSlocation_barcode_6fld.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 {/*from ww w  . j  a v  a 2s .  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_5Process(globalMap);
            tFileInputDelimited_6Process(globalMap);
            tFileInputDelimited_7Process(globalMap);

            batcode_fileStruct batcode_file = new batcode_fileStruct();
            barcode_wNameStruct barcode_wName = new barcode_wNameStruct();
            row2Struct row2 = new row2Struct();
            obj_locStruct obj_loc = new obj_locStruct();
            out_moveXMLStruct out_moveXML = new out_moveXMLStruct();
            moveCSIDStruct moveCSID = new moveCSIDStruct();
            IDStruct ID = new IDStruct();
            unmatch_locStruct unmatch_loc = new unmatch_locStruct();
            move2obj_XMLStruct move2obj_XML = new move2obj_XMLStruct();
            row3Struct row3 = new row3Struct();
            obj2move_XMLStruct obj2move_XML = new obj2move_XMLStruct();
            row1Struct row1 = new row1Struct();

            /**
             * [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.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.objectNumber == null && other.objectNumber != null) {
                        return -1;

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

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

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

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

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

                    } else if (this.location != null && other.location != null) {
                        if (!this.location.equals(other.location)) {
                            return this.location.compareTo(other.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.objectNumber = null;

                        batcode_file.crate = null;

                        batcode_file.location = null;

                    } else {

                        if (0 < row.length) {

                            batcode_file.reason_for_move = row[0];

                        } else {
                            batcode_file.reason_for_move = null;
                        }

                        if (1 < row.length) {

                            batcode_file.person_scanning = row[1];

                        } else {
                            batcode_file.person_scanning = null;
                        }

                        if (2 < row.length) {

                            batcode_file.date_time = row[2];

                        } else {
                            batcode_file.date_time = null;
                        }

                        if (3 < row.length) {

                            batcode_file.objectNumber = row[3];

                        } else {
                            batcode_file.objectNumber = null;
                        }

                        if (4 < row.length) {

                            batcode_file.crate = row[4];

                        } else {
                            batcode_file.crate = null;
                        }

                        if (5 < row.length) {

                            batcode_file.location = row[5];

                        } else {
                            batcode_file.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/Process6_" + 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.objectNumber = batcode_file.objectNumber;
                            barcode_wName_tmp.crate = batcode_file.crate;
                            barcode_wName_tmp.location = batcode_file.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.objectNumber = barcode_wName.objectNumber;
                            arrayRowtSortRow_3_SortOut.crate = barcode_wName.crate;
                            arrayRowtSortRow_3_SortOut.location = barcode_wName.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
             */

            /**
             * [tAdvancedFileOutputXML_1 begin ] start
             */

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

            int tos_count_tAdvancedFileOutputXML_1 = 0;

            int nb_line_tAFOX_1 = 0;

            boolean needRoot_tAFOX_1 = true;

            String fileName_tAFOX_1 = "../temp/location/barcode6." + TalendDate.getDate("CCYY-MM-DD") + "-"
                    + context.infile_min + ".xml";
            Boolean alreadyExistsFile_tAFOX_1 = new java.io.File(fileName_tAFOX_1).exists();
            fileName_tAFOX_1 = new java.io.File(fileName_tAFOX_1).getAbsolutePath().replace("\\", "/");
            String file_tAFOX_1 = "";

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

            if (!createFiletAFOX_1.exists()) {
                (new java.io.File(fileName_tAFOX_1.substring(0, fileName_tAFOX_1.lastIndexOf("/")))).mkdirs();
                needRoot_tAFOX_1 = true;
            }

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

            class NestXMLTool_tAFOX_1 {
                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_1 nestXMLTool_tAFOX_1 = new NestXMLTool_tAFOX_1();
            // sort group root element for judgement of group
            java.util.List<org.dom4j.Element> groupElementList_tAFOX_1 = new java.util.ArrayList<org.dom4j.Element>();
            org.dom4j.Element root4Group_tAFOX_1 = null;
            org.dom4j.Document doc_tAFOX_1 = null;

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

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

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

            int[] orders_tAFOX_1 = new int[1];

            /**
             * [tAdvancedFileOutputXML_1 begin ] stop
             */

            /**
             * [tFileOutputDelimited_1 begin ] start
             */

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

            int tos_count_tFileOutputDelimited_1 = 0;

            String fileName_tFileOutputDelimited_1 = "";
            fileName_tFileOutputDelimited_1 = (new java.io.File("../temp/location/barcode6_CSID."
                    + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".txt")).getAbsolutePath()
                            .replace("\\", "/");
            String fullName_tFileOutputDelimited_1 = null;
            String extension_tFileOutputDelimited_1 = null;
            String directory_tFileOutputDelimited_1 = null;
            if ((fileName_tFileOutputDelimited_1.indexOf("/") != -1)) {
                if (fileName_tFileOutputDelimited_1.lastIndexOf(".") < fileName_tFileOutputDelimited_1
                        .lastIndexOf("/")) {
                    fullName_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1;
                    extension_tFileOutputDelimited_1 = "";
                } else {
                    fullName_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1.substring(0,
                            fileName_tFileOutputDelimited_1.lastIndexOf("."));
                    extension_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1
                            .substring(fileName_tFileOutputDelimited_1.lastIndexOf("."));
                }
                directory_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1.substring(0,
                        fileName_tFileOutputDelimited_1.lastIndexOf("/"));
            } else {
                if (fileName_tFileOutputDelimited_1.lastIndexOf(".") != -1) {
                    fullName_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1.substring(0,
                            fileName_tFileOutputDelimited_1.lastIndexOf("."));
                    extension_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1
                            .substring(fileName_tFileOutputDelimited_1.lastIndexOf("."));
                } else {
                    fullName_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1;
                    extension_tFileOutputDelimited_1 = "";
                }
                directory_tFileOutputDelimited_1 = "";
            }
            boolean isFileGenerated_tFileOutputDelimited_1 = true;
            java.io.File filetFileOutputDelimited_1 = new java.io.File(fileName_tFileOutputDelimited_1);
            globalMap.put("tFileOutputDelimited_1_FILE_NAME", fileName_tFileOutputDelimited_1);

            int nb_line_tFileOutputDelimited_1 = 0;
            int splitEvery_tFileOutputDelimited_1 = 1000;
            int splitedFileNo_tFileOutputDelimited_1 = 0;
            int currentRow_tFileOutputDelimited_1 = 0;

            final String OUT_DELIM_tFileOutputDelimited_1 = /**
                                                            * Start field
                                                            * tFileOutputDelimited_1:FIELDSEPARATOR
                                                            */
                    ";"/** End field tFileOutputDelimited_1:FIELDSEPARATOR */
            ;

            final String OUT_DELIM_ROWSEP_tFileOutputDelimited_1 = /**
                                                                   * Start
                                                                   * field tFileOutputDelimited_1:ROWSEPARATOR
                                                                   */
                    "\n"/** End field tFileOutputDelimited_1:ROWSEPARATOR */
            ;

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

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

                /**
                 * [tFileOutputDelimited_1 begin ] stop
                 */

                /**
                 * [tFileOutputDelimited_5 begin ] start
                 */

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

                int tos_count_tFileOutputDelimited_5 = 0;

                String fileName_tFileOutputDelimited_5 = "";
                fileName_tFileOutputDelimited_5 = (new java.io.File("../temp/location/barcode6_ID."
                        + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".txt"))
                                .getAbsolutePath().replace("\\", "/");
                String fullName_tFileOutputDelimited_5 = null;
                String extension_tFileOutputDelimited_5 = null;
                String directory_tFileOutputDelimited_5 = null;
                if ((fileName_tFileOutputDelimited_5.indexOf("/") != -1)) {
                    if (fileName_tFileOutputDelimited_5.lastIndexOf(".") < fileName_tFileOutputDelimited_5
                            .lastIndexOf("/")) {
                        fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5;
                        extension_tFileOutputDelimited_5 = "";
                    } else {
                        fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5.substring(0,
                                fileName_tFileOutputDelimited_5.lastIndexOf("."));
                        extension_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5
                                .substring(fileName_tFileOutputDelimited_5.lastIndexOf("."));
                    }
                    directory_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5.substring(0,
                            fileName_tFileOutputDelimited_5.lastIndexOf("/"));
                } else {
                    if (fileName_tFileOutputDelimited_5.lastIndexOf(".") != -1) {
                        fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5.substring(0,
                                fileName_tFileOutputDelimited_5.lastIndexOf("."));
                        extension_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5
                                .substring(fileName_tFileOutputDelimited_5.lastIndexOf("."));
                    } else {
                        fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5;
                        extension_tFileOutputDelimited_5 = "";
                    }
                    directory_tFileOutputDelimited_5 = "";
                }
                boolean isFileGenerated_tFileOutputDelimited_5 = true;
                java.io.File filetFileOutputDelimited_5 = new java.io.File(fileName_tFileOutputDelimited_5);
                globalMap.put("tFileOutputDelimited_5_FILE_NAME", fileName_tFileOutputDelimited_5);

                int nb_line_tFileOutputDelimited_5 = 0;
                int splitEvery_tFileOutputDelimited_5 = 1000;
                int splitedFileNo_tFileOutputDelimited_5 = 0;
                int currentRow_tFileOutputDelimited_5 = 0;

                final String OUT_DELIM_tFileOutputDelimited_5 = /**
                                                                * Start
                                                                * field tFileOutputDelimited_5:FIELDSEPARATOR
                                                                */
                        ";"/** End field tFileOutputDelimited_5:FIELDSEPARATOR */
                ;

                final String OUT_DELIM_ROWSEP_tFileOutputDelimited_5 = /**
                                                                       * 
                                                                       * Start field tFileOutputDelimited_5:ROWSEPARATOR
                                                                       */
                        "\n"/** End field tFileOutputDelimited_5:ROWSEPARATOR */
                ;

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

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

                    /**
                     * [tFileOutputDelimited_5 begin ] stop
                     */

                    /**
                     * [tFileOutputDelimited_4 begin ] start
                     */

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

                    int tos_count_tFileOutputDelimited_4 = 0;

                    String fileName_tFileOutputDelimited_4 = "";
                    fileName_tFileOutputDelimited_4 = (new java.io.File("../temp/location/barcode6_unmatched."
                            + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".txt"))
                                    .getAbsolutePath().replace("\\", "/");
                    String fullName_tFileOutputDelimited_4 = null;
                    String extension_tFileOutputDelimited_4 = null;
                    String directory_tFileOutputDelimited_4 = null;
                    if ((fileName_tFileOutputDelimited_4.indexOf("/") != -1)) {
                        if (fileName_tFileOutputDelimited_4.lastIndexOf(".") < fileName_tFileOutputDelimited_4
                                .lastIndexOf("/")) {
                            fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4;
                            extension_tFileOutputDelimited_4 = "";
                        } else {
                            fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4.substring(0,
                                    fileName_tFileOutputDelimited_4.lastIndexOf("."));
                            extension_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4
                                    .substring(fileName_tFileOutputDelimited_4.lastIndexOf("."));
                        }
                        directory_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4.substring(0,
                                fileName_tFileOutputDelimited_4.lastIndexOf("/"));
                    } else {
                        if (fileName_tFileOutputDelimited_4.lastIndexOf(".") != -1) {
                            fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4.substring(0,
                                    fileName_tFileOutputDelimited_4.lastIndexOf("."));
                            extension_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4
                                    .substring(fileName_tFileOutputDelimited_4.lastIndexOf("."));
                        } else {
                            fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4;
                            extension_tFileOutputDelimited_4 = "";
                        }
                        directory_tFileOutputDelimited_4 = "";
                    }
                    boolean isFileGenerated_tFileOutputDelimited_4 = true;
                    java.io.File filetFileOutputDelimited_4 = new java.io.File(fileName_tFileOutputDelimited_4);
                    globalMap.put("tFileOutputDelimited_4_FILE_NAME", fileName_tFileOutputDelimited_4);

                    int nb_line_tFileOutputDelimited_4 = 0;
                    int splitEvery_tFileOutputDelimited_4 = 1000;
                    int splitedFileNo_tFileOutputDelimited_4 = 0;
                    int currentRow_tFileOutputDelimited_4 = 0;

                    final String OUT_DELIM_tFileOutputDelimited_4 = /**
                                                                    * Start
                                                                    * field tFileOutputDelimited_4:FIELDSEPARATOR
                                                                    */
                            ";"/** End field tFileOutputDelimited_4:FIELDSEPARATOR */
                    ;

                    final String OUT_DELIM_ROWSEP_tFileOutputDelimited_4 = /**
                                                                           * 
                                                                           * Start field tFileOutputDelimited_4:ROWSEPARATOR
                                                                           */
                            "\n"/** End field tFileOutputDelimited_4:ROWSEPARATOR */
                    ;

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

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

                        /**
                         * [tFileOutputDelimited_4 begin ] stop
                         */

                        /**
                         * [tSortRow_6_SortOut begin ] start
                         */

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

                        int tos_count_tSortRow_6_SortOut = 0;

                        class Comparablemove2obj_XMLStruct extends move2obj_XMLStruct
                                implements Comparable<Comparablemove2obj_XMLStruct> {

                            public int compareTo(Comparablemove2obj_XMLStruct other) {

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

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

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

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

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

                        java.util.List<Comparablemove2obj_XMLStruct> list_tSortRow_6_SortOut = new java.util.ArrayList<Comparablemove2obj_XMLStruct>();

                        /**
                         * [tSortRow_6_SortOut begin ] stop
                         */

                        /**
                         * [tSortRow_5_SortOut begin ] start
                         */

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

                        int tos_count_tSortRow_5_SortOut = 0;

                        class Comparableobj2move_XMLStruct extends obj2move_XMLStruct
                                implements Comparable<Comparableobj2move_XMLStruct> {

                            public int compareTo(Comparableobj2move_XMLStruct other) {

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

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

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

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

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

                        java.util.List<Comparableobj2move_XMLStruct> list_tSortRow_5_SortOut = new java.util.ArrayList<Comparableobj2move_XMLStruct>();

                        /**
                         * [tSortRow_5_SortOut begin ] stop
                         */

                        /**
                         * [tMap_1 begin ] start
                         */

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

                        int tos_count_tMap_1 = 0;

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

                        org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<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();

                        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<person_ID_displayNameStruct> tHash_Lookup_person_ID_displayName = (org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<person_ID_displayNameStruct>) ((org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<person_ID_displayNameStruct>) globalMap
                                .get("tHash_Lookup_person_ID_displayName"));

                        person_ID_displayNameStruct person_ID_displayNameHashKey = new person_ID_displayNameStruct();
                        person_ID_displayNameStruct person_ID_displayNameDefault = new person_ID_displayNameStruct();

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

                        obj_IDsStruct obj_IDsHashKey = new obj_IDsStruct();
                        obj_IDsStruct obj_IDsDefault = new obj_IDsStruct();
                        // ###############################

                        // ###############################
                        // # Vars initialization
                        class Var__tMap_1__Struct {
                            String moveID;
                            String move_CSID;
                            java.util.Date Talend_date;
                            String date;
                            String datetime;
                            String datetimeTZ;
                            String trim_locrefname;
                            String item_locref;
                            String trim_craterefname;
                            boolean loc_reject;
                            boolean handler_reject;
                            boolean obj_reject;
                            String move2obj_CSID;
                            String obj2move_CSID;
                            String reason4move;
                            String computedSummary;
                            String move_uri;
                            String move_refname;
                            String obj_uri;
                            String obj_refname;
                            String rel_m2o_uri;
                            String rel_m2o_refname;
                            String rel_o2m_uri;
                            String rel_o2m_refname;
                        }
                        Var__tMap_1__Struct Var__tMap_1 = new Var__tMap_1__Struct();
                        // ###############################

                        // ###############################
                        // # Outputs initialization
                        out_moveXMLStruct out_moveXML_tmp = new out_moveXMLStruct();
                        moveCSIDStruct moveCSID_tmp = new moveCSIDStruct();
                        IDStruct ID_tmp = new IDStruct();
                        unmatch_locStruct unmatch_loc_tmp = new unmatch_locStruct();
                        move2obj_XMLStruct move2obj_XML_tmp = new move2obj_XMLStruct();
                        obj2move_XMLStruct obj2move_XML_tmp = new obj2move_XMLStruct();
                        // ###############################

                        /**
                         * [tMap_1 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 date_time;
                            String objectNumber;
                            String 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.date_time == null) ? 0 : this.date_time.hashCode());

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

                                    result = prime * result
                                            + ((this.location == null) ? 0 : this.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.date_time == null) {
                                    if (other.date_time != null)
                                        return false;
                                } else if (!this.date_time.equals(other.date_time))
                                    return false;

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

                                if (this.location == null) {
                                    if (other.location != null)
                                        return false;
                                } else if (!this.location.equals(other.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.objectNumber = current_tSortRow_3_SortIn.objectNumber;
                            row2.crate = current_tSortRow_3_SortIn.crate;
                            row2.location = current_tSortRow_3_SortIn.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";

                            obj_loc = 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.date_time == null) {
                                finder_tUniqRow_1.date_time = null;
                            } else {
                                finder_tUniqRow_1.date_time = row2.date_time.toLowerCase();
                            }
                            if (row2.objectNumber == null) {
                                finder_tUniqRow_1.objectNumber = null;
                            } else {
                                finder_tUniqRow_1.objectNumber = row2.objectNumber.toLowerCase();
                            }
                            if (row2.location == null) {
                                finder_tUniqRow_1.location = null;
                            } else {
                                finder_tUniqRow_1.location = row2.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.date_time == null) {
                                    new_tUniqRow_1.date_time = null;
                                } else {
                                    new_tUniqRow_1.date_time = row2.date_time.toLowerCase();
                                }
                                if (row2.objectNumber == null) {
                                    new_tUniqRow_1.objectNumber = null;
                                } else {
                                    new_tUniqRow_1.objectNumber = row2.objectNumber.toLowerCase();
                                }
                                if (row2.location == null) {
                                    new_tUniqRow_1.location = null;
                                } else {
                                    new_tUniqRow_1.location = row2.location.toLowerCase();
                                }

                                keystUniqRow_1.add(new_tUniqRow_1);
                                if (obj_loc == null) {
                                    obj_loc = new obj_locStruct();
                                }
                                obj_loc.reason_for_move = row2.reason_for_move;
                                obj_loc.person_scanning = row2.person_scanning;
                                obj_loc.date_time = row2.date_time;
                                obj_loc.objectNumber = row2.objectNumber;
                                obj_loc.crate = row2.crate;
                                obj_loc.location = row2.location;
                                nb_uniques_tUniqRow_1++;
                            } else {
                                nb_duplicates_tUniqRow_1++;
                            }

                            tos_count_tUniqRow_1++;

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

                                /**
                                 * [tMap_1 main ] start
                                 */

                                currentComponent = "tMap_1";

                                boolean hasCasePrimitiveKeyWithNull_tMap_1 = false;

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

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

                                boolean forceLooplocinfo = false;

                                locinfoStruct locinfoObjectFromLookup = null;

                                if (!rejectedInnerJoin_tMap_1) { // G_TM_M_020

                                    hasCasePrimitiveKeyWithNull_tMap_1 = false;

                                    locinfoHashKey.loc_displayname = StringHandling.TRIM(obj_loc.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;
                                }

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

                                boolean forceLoopcrateinfo = false;

                                crateinfoStruct crateinfoObjectFromLookup = null;

                                if (!rejectedInnerJoin_tMap_1) { // G_TM_M_020

                                    hasCasePrimitiveKeyWithNull_tMap_1 = false;

                                    crateinfoHashKey.crate_displayname = StringHandling.TRIM(obj_loc.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
                                // "person_ID_displayName"
                                // /////////////////////////////////////////////

                                boolean forceLoopperson_ID_displayName = false;

                                person_ID_displayNameStruct person_ID_displayNameObjectFromLookup = null;

                                if (!rejectedInnerJoin_tMap_1) { // G_TM_M_020

                                    hasCasePrimitiveKeyWithNull_tMap_1 = false;

                                    person_ID_displayNameHashKey.displayName = obj_loc.person_scanning;

                                    person_ID_displayNameHashKey.hashCodeDirty = true;

                                    tHash_Lookup_person_ID_displayName.lookup(person_ID_displayNameHashKey);

                                } // G_TM_M_020

                                if (tHash_Lookup_person_ID_displayName != null
                                        && tHash_Lookup_person_ID_displayName
                                                .getCount(person_ID_displayNameHashKey) > 1) { // G
                                    // 071

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

                                person_ID_displayNameStruct person_ID_displayName = null;

                                person_ID_displayNameStruct fromLookup_person_ID_displayName = null;
                                person_ID_displayName = person_ID_displayNameDefault;

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

                                    fromLookup_person_ID_displayName = tHash_Lookup_person_ID_displayName
                                            .next();

                                } // G 099

                                if (fromLookup_person_ID_displayName != null) {
                                    person_ID_displayName = fromLookup_person_ID_displayName;
                                }

                                // /////////////////////////////////////////////
                                // Starting Lookup Table "obj_IDs"
                                // /////////////////////////////////////////////

                                boolean forceLoopobj_IDs = false;

                                obj_IDsStruct obj_IDsObjectFromLookup = null;

                                if (!rejectedInnerJoin_tMap_1) { // G_TM_M_020

                                    hasCasePrimitiveKeyWithNull_tMap_1 = false;

                                    obj_IDsHashKey.objectNumber = StringHandling.TRIM(obj_loc.objectNumber);

                                    obj_IDsHashKey.hashCodeDirty = true;

                                    tHash_Lookup_obj_IDs.lookup(obj_IDsHashKey);

                                } // G_TM_M_020

                                if (tHash_Lookup_obj_IDs != null
                                        && tHash_Lookup_obj_IDs.getCount(obj_IDsHashKey) > 1) { // G
                                    // 071

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

                                obj_IDsStruct obj_IDs = null;

                                obj_IDsStruct fromLookup_obj_IDs = null;
                                obj_IDs = obj_IDsDefault;

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

                                    fromLookup_obj_IDs = tHash_Lookup_obj_IDs.next();

                                } // G 099

                                if (fromLookup_obj_IDs != null) {
                                    obj_IDs = fromLookup_obj_IDs;
                                }

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

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

                                    Var__tMap_1__Struct Var = Var__tMap_1;
                                    Var.moveID = "Barcode." + TalendDate.getDate("CCYYMMDD-hhmm") + "-"
                                            + StringHandling.TRIM(obj_loc.reason_for_move) + "."
                                            + Numeric.sequence("", 1, 1);
                                    Var.move_CSID = Guid.getUUID();
                                    Var.Talend_date = (obj_loc.date_time == null
                                            || obj_loc.date_time.equals("")) ? null
                                                    : (TalendDate.addDate(TalendDate.parseDate(
                                                            "MM/dd/yyyy HH:mm", obj_loc.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.trim_locrefname = StringHandling.TRIM(locinfo.loc_refname);
                                    Var.item_locref = StringHandling.TRIM(obj_loc.objectNumber) + "->"
                                            + StringHandling.TRIM(locinfo.loc_refname) + " : "
                                            + crateinfo.crate_refname;
                                    Var.trim_craterefname = StringHandling.TRIM(crateinfo.crate_refname);
                                    Var.loc_reject = Relational.ISNULL(locinfo.loc_refname)
                                            || Relational.ISNULL(crateinfo.crate_refname);
                                    Var.handler_reject = Relational.ISNULL(person_ID_displayName.displayName);
                                    Var.obj_reject = Relational.ISNULL(obj_IDs.obj_CSID);
                                    Var.move2obj_CSID = Guid.getUUID();
                                    Var.obj2move_CSID = Guid.getUUID();
                                    Var.reason4move = StringHandling.UPCASE(obj_loc.reason_for_move).equals("K")
                                            ? "Inventory"
                                            : (StringHandling.UPCASE(obj_loc.reason_for_move).equals("C")
                                                    ? "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;
                                    Var.move_uri = "/movements/" + Var.move_CSID;
                                    Var.move_refname = "urn:cspace:pahma.cspace.berkeley.edu:movements:id("
                                            + Var.move_CSID + ")";
                                    Var.obj_uri = "/collectionobjects/" + obj_IDs.obj_CSID;
                                    Var.obj_refname = "urn:cspace:pahma.cspace.berkeley.edu:collectionobjects:id("
                                            + obj_IDs.obj_CSID + ")'" + obj_IDs.objectNumber + "'";
                                    Var.rel_m2o_uri = "/relations/" + Var.move2obj_CSID;
                                    Var.rel_m2o_refname = "urn:cspace:pahma.cspace.berkeley.edu:collectionobjects:id("
                                            + Var.move2obj_CSID + ")";
                                    Var.rel_o2m_uri = "/relations/" + Var.obj2move_CSID;
                                    Var.rel_o2m_refname = "urn:cspace:pahma.cspace.berkeley.edu:collectionobjects:id("
                                            + Var.obj2move_CSID + ")";// ###############################
                                    // ###############################
                                    // # Output tables

                                    out_moveXML = null;
                                    moveCSID = null;
                                    ID = null;
                                    unmatch_loc = null;
                                    move2obj_XML = null;
                                    obj2move_XML = null;

                                    // # Output table : 'out_moveXML'
                                    out_moveXML_tmp.Item_Num = StringHandling.TRIM(obj_loc.objectNumber);
                                    out_moveXML_tmp.loc_refname = locinfo.loc_refname;
                                    out_moveXML_tmp.loc_displayname = StringHandling.TRIM(obj_loc.location);
                                    out_moveXML_tmp.crate_refname = crateinfo.crate_refname;
                                    out_moveXML_tmp.crate_displayname = crateinfo.crate_displayname;
                                    out_moveXML_tmp.loc_handler = person_ID_displayName.person_refname;
                                    out_moveXML_tmp.Capture_timestamp = Var.datetimeTZ;
                                    out_moveXML_tmp.reason4move = Var.reason4move;
                                    out_moveXML_tmp.computedSummary = Var.computedSummary;
                                    out_moveXML_tmp.moveID = Var.moveID;
                                    out_moveXML_tmp.moveCSID = Var.move_CSID;
                                    out_moveXML_tmp.move_uri = Var.move_uri;
                                    out_moveXML_tmp.move_refname = Var.move_refname;
                                    out_moveXML = out_moveXML_tmp;

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

                                    // # Output table : 'ID'
                                    ID_tmp.Item_Num = StringHandling.TRIM(obj_loc.objectNumber);
                                    ID_tmp.moveID = Var.moveID;
                                    ID_tmp.loc_reject = Var.loc_reject;
                                    ID_tmp.handler_reject = Var.handler_reject;
                                    ID_tmp.obj_reject = Var.obj_reject;
                                    ID_tmp.loc_refname = locinfo.loc_refname;
                                    ID_tmp.crate_refname = crateinfo.crate_refname;
                                    ID_tmp.loc_handler_refname = person_ID_displayName.person_refname;
                                    ID_tmp.capture_datetime = Var.datetimeTZ;
                                    ID_tmp.moveCSID = Var.move_CSID;
                                    ID_tmp.move2obj_CSID = Var.move2obj_CSID;
                                    ID_tmp.obj2move_CSID = Var.obj2move_CSID;
                                    ID_tmp.move_uri = Var.move_uri;
                                    ID_tmp.move_refname = Var.move_refname;
                                    ID_tmp.obj_uri = Var.obj_uri;
                                    ID_tmp.obj_refname = Var.obj_refname;
                                    ID = ID_tmp;

                                    // # Output table : 'unmatch_loc'
                                    // # Filter conditions
                                    if (

                                    Var.loc_reject || Var.obj_reject || Var.handler_reject

                                    ) {
                                        unmatch_loc_tmp.Item_Num = StringHandling.TRIM(obj_loc.objectNumber);
                                        unmatch_loc_tmp.moveID = Var.moveID;
                                        unmatch_loc_tmp.reject_loc = Var.loc_reject;
                                        unmatch_loc_tmp.reject_handler = Var.handler_reject;
                                        unmatch_loc_tmp.reject_obj = Var.obj_reject;
                                        unmatch_loc_tmp.Location = obj_loc.location;
                                        unmatch_loc_tmp.crate = obj_loc.crate;
                                        unmatch_loc_tmp.loc_refname = locinfo.loc_refname;
                                        unmatch_loc_tmp.crate_refname = crateinfo.crate_refname;
                                        unmatch_loc_tmp.loc_handler = obj_loc.person_scanning;
                                        unmatch_loc_tmp.loc_handler_refname = person_ID_displayName.person_refname;
                                        unmatch_loc_tmp.Capture_timestamp = obj_loc.date_time;
                                        unmatch_loc = unmatch_loc_tmp;
                                    } // closing filter/reject

                                    // # Output table : 'move2obj_XML'
                                    move2obj_XML_tmp.objectNum = StringHandling.TRIM(obj_loc.objectNumber);
                                    move2obj_XML_tmp.obj_CSID = obj_IDs.obj_CSID;
                                    move2obj_XML_tmp.objectDocType = "CollectionObject";
                                    move2obj_XML_tmp.moveID = Var.moveID;
                                    move2obj_XML_tmp.move_CSID = Var.move_CSID;
                                    move2obj_XML_tmp.move_URI = "/movements/" + Var.move_CSID;
                                    move2obj_XML_tmp.subjectDocType = "Movement";
                                    move2obj_XML_tmp.loc_refName = Var.trim_locrefname;
                                    move2obj_XML_tmp.move_timestamp = Var.datetimeTZ;
                                    move2obj_XML_tmp.move2obj_CSID = Var.move2obj_CSID;
                                    move2obj_XML_tmp.move_refname = Var.move_refname;
                                    move2obj_XML_tmp.obj_uri = Var.obj_uri;
                                    move2obj_XML_tmp.obj_refname = Var.obj_refname;
                                    move2obj_XML_tmp.rel_m2o_uri = Var.rel_m2o_uri;
                                    move2obj_XML_tmp.rel_m2o_refname = Var.rel_m2o_refname;
                                    move2obj_XML_tmp.datetimeTZ = Var.datetimeTZ;
                                    move2obj_XML = move2obj_XML_tmp;

                                    // # Output table : 'obj2move_XML'
                                    obj2move_XML_tmp.objectNum = StringHandling.TRIM(obj_loc.objectNumber);
                                    obj2move_XML_tmp.obj_CSID = obj_IDs.obj_CSID;
                                    obj2move_XML_tmp.subjectDoctype = "CollectionObject";
                                    obj2move_XML_tmp.moveID = Var.moveID;
                                    obj2move_XML_tmp.move_CSID = Var.move_CSID;
                                    obj2move_XML_tmp.move_URI = "/movements/" + Var.move_CSID;
                                    obj2move_XML_tmp.objectDoctype = "Movement";
                                    obj2move_XML_tmp.loc_refName = Var.trim_locrefname;
                                    obj2move_XML_tmp.move_timestamp = Var.datetimeTZ;
                                    obj2move_XML_tmp.obj2move_CSID = Var.obj2move_CSID;
                                    obj2move_XML_tmp.move_refname = Var.move_refname;
                                    obj2move_XML_tmp.obj_uri = Var.obj_uri;
                                    obj2move_XML_tmp.obj_refname = Var.obj_refname;
                                    obj2move_XML_tmp.rel_o2m_uri = Var.rel_o2m_uri;
                                    obj2move_XML_tmp.rel_o2m_refname = Var.rel_o2m_refname;
                                    obj2move_XML_tmp.datetimeTZ = Var.datetimeTZ;
                                    obj2move_XML = obj2move_XML_tmp;
                                    // ###############################

                                } // end of Var scope

                                rejectedInnerJoin_tMap_1 = false;

                                tos_count_tMap_1++;

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

                                    /**
                                     * [tAdvancedFileOutputXML_1 main ]
                                     * start
                                     */

                                    currentComponent = "tAdvancedFileOutputXML_1";

                                    nb_line_tAFOX_1++;
                                    valueMap_tAFOX_1.clear();
                                    valueMap_tAFOX_1.put("Item_Num", (out_moveXML.Item_Num.toString()));
                                    valueMap_tAFOX_1.put("loc_refname",
                                            (out_moveXML.loc_refname != null
                                                    ? out_moveXML.loc_refname.toString()
                                                    : null));
                                    valueMap_tAFOX_1.put("loc_displayname",
                                            (out_moveXML.loc_displayname.toString()));
                                    valueMap_tAFOX_1.put("crate_refname",
                                            (out_moveXML.crate_refname != null
                                                    ? out_moveXML.crate_refname.toString()
                                                    : null));
                                    valueMap_tAFOX_1.put("crate_displayname",
                                            (out_moveXML.crate_displayname != null
                                                    ? out_moveXML.crate_displayname.toString()
                                                    : null));
                                    valueMap_tAFOX_1.put("loc_handler",
                                            (out_moveXML.loc_handler != null
                                                    ? out_moveXML.loc_handler.toString()
                                                    : null));
                                    valueMap_tAFOX_1.put("Capture_timestamp",
                                            (out_moveXML.Capture_timestamp != null
                                                    ? out_moveXML.Capture_timestamp.toString()
                                                    : null));
                                    valueMap_tAFOX_1.put("reason4move",
                                            (out_moveXML.reason4move != null
                                                    ? out_moveXML.reason4move.toString()
                                                    : null));
                                    valueMap_tAFOX_1.put("computedSummary",
                                            (out_moveXML.computedSummary.toString()));
                                    valueMap_tAFOX_1.put("moveID", (out_moveXML.moveID.toString()));
                                    valueMap_tAFOX_1.put("moveCSID", (out_moveXML.moveCSID.toString()));
                                    valueMap_tAFOX_1.put("move_uri", (out_moveXML.move_uri.toString()));
                                    valueMap_tAFOX_1.put("move_refname", (out_moveXML.move_refname.toString()));
                                    org.dom4j.Element subTreeRootParent_tAFOX_1 = null;

                                    // build root xml tree
                                    if (needRoot_tAFOX_1) {
                                        needRoot_tAFOX_1 = false;
                                        if (orders_tAFOX_1.length > 0) {
                                            orders_tAFOX_1[0] = 0;
                                        }
                                        org.dom4j.Element root_tAFOX_1 = doc_tAFOX_1.addElement("imports");
                                        subTreeRootParent_tAFOX_1 = root_tAFOX_1;
                                        root4Group_tAFOX_1 = subTreeRootParent_tAFOX_1;
                                    } else {
                                        subTreeRootParent_tAFOX_1 = root4Group_tAFOX_1;
                                    }
                                    // build group xml tree
                                    // build loop xml tree
                                    org.dom4j.Element loop_tAFOX_1 = org.dom4j.DocumentHelper
                                            .createElement("import");
                                    if (orders_tAFOX_1[0] == 0) {
                                        orders_tAFOX_1[0] = 0;
                                    }
                                    if (1 < orders_tAFOX_1.length) {
                                        orders_tAFOX_1[1] = 0;
                                    }
                                    subTreeRootParent_tAFOX_1.elements().add(orders_tAFOX_1[0]++, loop_tAFOX_1);
                                    loop_tAFOX_1.addAttribute("service", "Movements");
                                    loop_tAFOX_1.addAttribute("type", "Movement");
                                    if (valueMap_tAFOX_1.get("moveCSID") != null) {
                                        loop_tAFOX_1.addAttribute("CSID", valueMap_tAFOX_1.get("moveCSID"));
                                    }
                                    org.dom4j.Element loop_0_tAFOX_1 = loop_tAFOX_1.addElement("schema");
                                    loop_0_tAFOX_1.addNamespace("movements_common", TalendString
                                            .replaceSpecialCharForXML("http://collectionspace.org/movement/"));
                                    loop_0_tAFOX_1.addAttribute("name", "movements_common");
                                    org.dom4j.Element loop_0_0_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_0_tAFOX_1 = loop_0_tAFOX_1.addElement("movementNote");
                                    } else {
                                        loop_0_0_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:movementNote");
                                    }
                                    loop_0_0_tAFOX_1.setName("movements_common:movementNote");
                                    org.dom4j.Element loop_0_1_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_1_tAFOX_1 = loop_0_tAFOX_1.addElement("removalDate");
                                    } else {
                                        loop_0_1_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:removalDate");
                                    }
                                    loop_0_1_tAFOX_1.setName("movements_common:removalDate");
                                    org.dom4j.Element loop_0_2_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_2_tAFOX_1 = loop_0_tAFOX_1.addElement("reasonForMove");
                                    } else {
                                        loop_0_2_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:reasonForMove");
                                    }
                                    if (valueMap_tAFOX_1.get("reason4move") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_0_2_tAFOX_1,
                                                valueMap_tAFOX_1.get("reason4move"));
                                    }
                                    loop_0_2_tAFOX_1.setName("movements_common:reasonForMove");
                                    org.dom4j.Element loop_0_3_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_3_tAFOX_1 = loop_0_tAFOX_1.addElement("movementMethods");
                                    } else {
                                        loop_0_3_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:movementMethods");
                                    }
                                    loop_0_3_tAFOX_1.setName("movements_common:movementMethods");
                                    org.dom4j.Element loop_0_3_0_tAFOX_1 = loop_0_3_tAFOX_1
                                            .addElement("movementMethod");
                                    org.dom4j.Element loop_0_4_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_4_tAFOX_1 = loop_0_tAFOX_1.addElement("plannedRemovalDate");
                                    } else {
                                        loop_0_4_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:plannedRemovalDate");
                                    }
                                    loop_0_4_tAFOX_1.setName("movements_common:plannedRemovalDate");
                                    org.dom4j.Element loop_0_5_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_5_tAFOX_1 = loop_0_tAFOX_1.addElement("movementContact");
                                    } else {
                                        loop_0_5_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:movementContact");
                                    }
                                    loop_0_5_tAFOX_1.setName("movements_common:movementContact");
                                    org.dom4j.Element loop_0_6_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_6_tAFOX_1 = loop_0_tAFOX_1.addElement("normalLocation");
                                    } else {
                                        loop_0_6_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:normalLocation");
                                    }
                                    loop_0_6_tAFOX_1.setName("movements_common:normalLocation");
                                    org.dom4j.Element loop_0_7_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_7_tAFOX_1 = loop_0_tAFOX_1.addElement("currentLocationFitness");
                                    } else {
                                        loop_0_7_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:currentLocationFitness");
                                    }
                                    loop_0_7_tAFOX_1.setName("movements_common:currentLocationFitness");
                                    org.dom4j.Element loop_0_8_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_8_tAFOX_1 = loop_0_tAFOX_1.addElement("currentLocation");
                                    } else {
                                        loop_0_8_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:currentLocation");
                                    }
                                    if (valueMap_tAFOX_1.get("loc_refname") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_0_8_tAFOX_1,
                                                valueMap_tAFOX_1.get("loc_refname"));
                                    }
                                    loop_0_8_tAFOX_1.setName("movements_common:currentLocation");
                                    org.dom4j.Element loop_0_9_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_9_tAFOX_1 = loop_0_tAFOX_1.addElement("locationDate");
                                    } else {
                                        loop_0_9_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:locationDate");
                                    }
                                    if (valueMap_tAFOX_1.get("Capture_timestamp") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_0_9_tAFOX_1,
                                                valueMap_tAFOX_1.get("Capture_timestamp"));
                                    }
                                    loop_0_9_tAFOX_1.setName("movements_common:locationDate");
                                    org.dom4j.Element loop_0_10_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_10_tAFOX_1 = loop_0_tAFOX_1.addElement("currentLocationNote");
                                    } else {
                                        loop_0_10_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:currentLocationNote");
                                    }
                                    if (valueMap_tAFOX_1.get("Item_Num") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_0_10_tAFOX_1,
                                                valueMap_tAFOX_1.get("Item_Num"));
                                    }
                                    loop_0_10_tAFOX_1.setName("movements_common:currentLocationNote");
                                    org.dom4j.Element loop_0_11_tAFOX_1;
                                    if (loop_0_tAFOX_1.getNamespaceForPrefix("movements_common") == null) {
                                        loop_0_11_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movementReferenceNumber");
                                    } else {
                                        loop_0_11_tAFOX_1 = loop_0_tAFOX_1
                                                .addElement("movements_common:movementReferenceNumber");
                                    }
                                    if (valueMap_tAFOX_1.get("moveID") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_0_11_tAFOX_1,
                                                valueMap_tAFOX_1.get("moveID"));
                                    }
                                    loop_0_11_tAFOX_1.setName("movements_common:movementReferenceNumber");
                                    org.dom4j.Element loop_1_tAFOX_1 = loop_tAFOX_1.addElement("schema2");
                                    loop_1_tAFOX_1.addNamespace("movements_anthropology",
                                            TalendString.replaceSpecialCharForXML(
                                                    "http://collectionspace.org/services/movement/domain/anthropology"));
                                    loop_1_tAFOX_1.addAttribute("name", "movements_anthropology");
                                    org.dom4j.Element loop_1_0_tAFOX_1;
                                    if (loop_1_tAFOX_1
                                            .getNamespaceForPrefix("movements_anthropology") == null) {
                                        loop_1_0_tAFOX_1 = loop_1_tAFOX_1.addElement("locationHandlers");
                                    } else {
                                        loop_1_0_tAFOX_1 = loop_1_tAFOX_1
                                                .addElement("movements_anthropology:locationHandlers");
                                    }
                                    loop_1_0_tAFOX_1.setName("movements_anthropology:locationHandlers");
                                    org.dom4j.Element loop_1_0_0_tAFOX_1 = loop_1_0_tAFOX_1
                                            .addElement("locationHandler");
                                    if (valueMap_tAFOX_1.get("loc_handler") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_1_0_0_tAFOX_1,
                                                valueMap_tAFOX_1.get("loc_handler"));
                                    }
                                    org.dom4j.Element loop_1_1_tAFOX_1;
                                    if (loop_1_tAFOX_1
                                            .getNamespaceForPrefix("movements_anthropology") == null) {
                                        loop_1_1_tAFOX_1 = loop_1_tAFOX_1.addElement("crate");
                                    } else {
                                        loop_1_1_tAFOX_1 = loop_1_tAFOX_1
                                                .addElement("movements_anthropology:crate");
                                    }
                                    if (valueMap_tAFOX_1.get("crate_refname") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_1_1_tAFOX_1,
                                                valueMap_tAFOX_1.get("crate_refname"));
                                    }
                                    loop_1_1_tAFOX_1.setName("movements_anthropology:crate");
                                    org.dom4j.Element loop_1_2_tAFOX_1;
                                    if (loop_1_tAFOX_1
                                            .getNamespaceForPrefix("movements_anthropology") == null) {
                                        loop_1_2_tAFOX_1 = loop_1_tAFOX_1.addElement("computedSummary");
                                    } else {
                                        loop_1_2_tAFOX_1 = loop_1_tAFOX_1
                                                .addElement("movements_anthropology:computedSummary");
                                    }
                                    if (valueMap_tAFOX_1.get("computedSummary") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_1_2_tAFOX_1,
                                                valueMap_tAFOX_1.get("computedSummary"));
                                    }
                                    loop_1_2_tAFOX_1.setName("movements_anthropology:computedSummary");
                                    org.dom4j.Element loop_2_tAFOX_1 = loop_tAFOX_1.addElement("schema0");
                                    loop_2_tAFOX_1.addNamespace("collectionspace_core",
                                            TalendString.replaceSpecialCharForXML(
                                                    "http://collectionspace.org/collectionspace_core"));
                                    loop_2_tAFOX_1.addAttribute("name", "collectionspace_core");
                                    org.dom4j.Element loop_2_0_tAFOX_1 = loop_2_tAFOX_1.addElement("uri");
                                    if (valueMap_tAFOX_1.get("move_uri") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_2_0_tAFOX_1,
                                                valueMap_tAFOX_1.get("move_uri"));
                                    }
                                    org.dom4j.Element loop_2_1_tAFOX_1 = loop_2_tAFOX_1.addElement("refName");
                                    if (valueMap_tAFOX_1.get("move_refname") != null) {
                                        nestXMLTool_tAFOX_1.setText(loop_2_1_tAFOX_1,
                                                valueMap_tAFOX_1.get("move_refname"));
                                    }

                                    tos_count_tAdvancedFileOutputXML_1++;

                                    /**
                                     * [tAdvancedFileOutputXML_1 main ] stop
                                     */

                                } // End of branch "out_moveXML"

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

                                    /**
                                     * [tFileOutputDelimited_1 main ] start
                                     */

                                    currentComponent = "tFileOutputDelimited_1";

                                    StringBuilder sb_tFileOutputDelimited_1 = new StringBuilder();

                                    if (moveCSID.moveCSID != null) {

                                        sb_tFileOutputDelimited_1.append(

                                                moveCSID.moveCSID

                                        );

                                    }

                                    sb_tFileOutputDelimited_1.append(OUT_DELIM_ROWSEP_tFileOutputDelimited_1);

                                    nb_line_tFileOutputDelimited_1++;

                                    outtFileOutputDelimited_1.write(sb_tFileOutputDelimited_1.toString());

                                    tos_count_tFileOutputDelimited_1++;

                                    /**
                                     * [tFileOutputDelimited_1 main ] stop
                                     */

                                } // End of branch "moveCSID"

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

                                    /**
                                     * [tFileOutputDelimited_5 main ] start
                                     */

                                    currentComponent = "tFileOutputDelimited_5";

                                    StringBuilder sb_tFileOutputDelimited_5 = new StringBuilder();

                                    if (ID.Item_Num != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.Item_Num

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.moveID != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.moveID

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.loc_reject != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.loc_reject

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.handler_reject != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.handler_reject

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.obj_reject != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.obj_reject

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.loc_refname != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.loc_refname

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.crate_refname != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.crate_refname

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.loc_handler_refname != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.loc_handler_refname

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.capture_datetime != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.capture_datetime

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.moveCSID != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.moveCSID

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.move2obj_CSID != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.move2obj_CSID

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.obj2move_CSID != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.obj2move_CSID

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.move_uri != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.move_uri

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.move_refname != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.move_refname

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.obj_uri != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.obj_uri

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                    if (ID.obj_refname != null) {

                                        sb_tFileOutputDelimited_5.append(

                                                ID.obj_refname

                                        );

                                    }

                                    sb_tFileOutputDelimited_5.append(OUT_DELIM_ROWSEP_tFileOutputDelimited_5);

                                    nb_line_tFileOutputDelimited_5++;

                                    outtFileOutputDelimited_5.write(sb_tFileOutputDelimited_5.toString());

                                    tos_count_tFileOutputDelimited_5++;

                                    /**
                                     * [tFileOutputDelimited_5 main ] stop
                                     */

                                } // End of branch "ID"

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

                                    /**
                                     * [tFileOutputDelimited_4 main ] start
                                     */

                                    currentComponent = "tFileOutputDelimited_4";

                                    StringBuilder sb_tFileOutputDelimited_4 = new StringBuilder();

                                    if (unmatch_loc.Item_Num != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.Item_Num

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.moveID != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.moveID

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    sb_tFileOutputDelimited_4.append(

                                            unmatch_loc.reject_loc

                                    );

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.reject_handler != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.reject_handler

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.reject_obj != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.reject_obj

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.Location != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.Location

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.crate != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.crate

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.loc_refname != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.loc_refname

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.crate_refname != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.crate_refname

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.loc_handler != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.loc_handler

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.loc_handler_refname != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.loc_handler_refname

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                    if (unmatch_loc.Capture_timestamp != null) {

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.Capture_timestamp

                                        );

                                    }

                                    sb_tFileOutputDelimited_4.append(OUT_DELIM_ROWSEP_tFileOutputDelimited_4);

                                    nb_line_tFileOutputDelimited_4++;

                                    outtFileOutputDelimited_4.write(sb_tFileOutputDelimited_4.toString());

                                    tos_count_tFileOutputDelimited_4++;

                                    /**
                                     * [tFileOutputDelimited_4 main ] stop
                                     */

                                } // End of branch "unmatch_loc"

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

                                    /**
                                     * [tSortRow_6_SortOut main ] start
                                     */

                                    currentComponent = "tSortRow_6_SortOut";

                                    Comparablemove2obj_XMLStruct arrayRowtSortRow_6_SortOut = new Comparablemove2obj_XMLStruct();

                                    arrayRowtSortRow_6_SortOut.objectNum = move2obj_XML.objectNum;
                                    arrayRowtSortRow_6_SortOut.obj_CSID = move2obj_XML.obj_CSID;
                                    arrayRowtSortRow_6_SortOut.objectDocType = move2obj_XML.objectDocType;
                                    arrayRowtSortRow_6_SortOut.moveID = move2obj_XML.moveID;
                                    arrayRowtSortRow_6_SortOut.move_CSID = move2obj_XML.move_CSID;
                                    arrayRowtSortRow_6_SortOut.move_URI = move2obj_XML.move_URI;
                                    arrayRowtSortRow_6_SortOut.subjectDocType = move2obj_XML.subjectDocType;
                                    arrayRowtSortRow_6_SortOut.loc_refName = move2obj_XML.loc_refName;
                                    arrayRowtSortRow_6_SortOut.move_timestamp = move2obj_XML.move_timestamp;
                                    arrayRowtSortRow_6_SortOut.move2obj_CSID = move2obj_XML.move2obj_CSID;
                                    arrayRowtSortRow_6_SortOut.move_refname = move2obj_XML.move_refname;
                                    arrayRowtSortRow_6_SortOut.obj_uri = move2obj_XML.obj_uri;
                                    arrayRowtSortRow_6_SortOut.obj_refname = move2obj_XML.obj_refname;
                                    arrayRowtSortRow_6_SortOut.rel_m2o_uri = move2obj_XML.rel_m2o_uri;
                                    arrayRowtSortRow_6_SortOut.rel_m2o_refname = move2obj_XML.rel_m2o_refname;
                                    arrayRowtSortRow_6_SortOut.datetimeTZ = move2obj_XML.datetimeTZ;
                                    list_tSortRow_6_SortOut.add(arrayRowtSortRow_6_SortOut);

                                    tos_count_tSortRow_6_SortOut++;

                                    /**
                                     * [tSortRow_6_SortOut main ] stop
                                     */

                                } // End of branch "move2obj_XML"

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

                                    /**
                                     * [tSortRow_5_SortOut main ] start
                                     */

                                    currentComponent = "tSortRow_5_SortOut";

                                    Comparableobj2move_XMLStruct arrayRowtSortRow_5_SortOut = new Comparableobj2move_XMLStruct();

                                    arrayRowtSortRow_5_SortOut.objectNum = obj2move_XML.objectNum;
                                    arrayRowtSortRow_5_SortOut.obj_CSID = obj2move_XML.obj_CSID;
                                    arrayRowtSortRow_5_SortOut.subjectDoctype = obj2move_XML.subjectDoctype;
                                    arrayRowtSortRow_5_SortOut.moveID = obj2move_XML.moveID;
                                    arrayRowtSortRow_5_SortOut.move_CSID = obj2move_XML.move_CSID;
                                    arrayRowtSortRow_5_SortOut.move_URI = obj2move_XML.move_URI;
                                    arrayRowtSortRow_5_SortOut.objectDoctype = obj2move_XML.objectDoctype;
                                    arrayRowtSortRow_5_SortOut.loc_refName = obj2move_XML.loc_refName;
                                    arrayRowtSortRow_5_SortOut.move_timestamp = obj2move_XML.move_timestamp;
                                    arrayRowtSortRow_5_SortOut.obj2move_CSID = obj2move_XML.obj2move_CSID;
                                    arrayRowtSortRow_5_SortOut.move_refname = obj2move_XML.move_refname;
                                    arrayRowtSortRow_5_SortOut.obj_uri = obj2move_XML.obj_uri;
                                    arrayRowtSortRow_5_SortOut.obj_refname = obj2move_XML.obj_refname;
                                    arrayRowtSortRow_5_SortOut.rel_o2m_uri = obj2move_XML.rel_o2m_uri;
                                    arrayRowtSortRow_5_SortOut.rel_o2m_refname = obj2move_XML.rel_o2m_refname;
                                    arrayRowtSortRow_5_SortOut.datetimeTZ = obj2move_XML.datetimeTZ;
                                    list_tSortRow_5_SortOut.add(arrayRowtSortRow_5_SortOut);

                                    tos_count_tSortRow_5_SortOut++;

                                    /**
                                     * [tSortRow_5_SortOut main ] stop
                                     */

                                } // End of branch "obj2move_XML"

                            } // End of branch "obj_loc"

                            /**
                             * [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_1 end ] start
                         */

                        currentComponent = "tMap_1";

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

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

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

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

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

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

                        /**
                         * [tMap_1 end ] stop
                         */

                        /**
                         * [tSortRow_5_SortOut end ] start
                         */

                        currentComponent = "tSortRow_5_SortOut";

                        obj2move_XMLStruct[] array_tSortRow_5_SortOut = list_tSortRow_5_SortOut
                                .toArray(new Comparableobj2move_XMLStruct[0]);

                        java.util.Arrays.sort(array_tSortRow_5_SortOut);

                        globalMap.put("tSortRow_5", array_tSortRow_5_SortOut);

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

                        /**
                         * [tSortRow_5_SortOut end ] stop
                         */

                        /**
                         * [tAdvancedFileOutputXML_3 begin ] start
                         */

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

                        int tos_count_tAdvancedFileOutputXML_3 = 0;

                        int nb_line_tAFOX_3 = 0;

                        boolean needRoot_tAFOX_3 = true;

                        String fileName_tAFOX_3 = "../temp/relation/barcode6_obj2move."
                                + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".xml";
                        Boolean alreadyExistsFile_tAFOX_3 = new java.io.File(fileName_tAFOX_3).exists();
                        fileName_tAFOX_3 = new java.io.File(fileName_tAFOX_3).getAbsolutePath().replace("\\",
                                "/");
                        String file_tAFOX_3 = "";

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

                        if (!createFiletAFOX_3.exists()) {
                            (new java.io.File(fileName_tAFOX_3.substring(0, fileName_tAFOX_3.lastIndexOf("/"))))
                                    .mkdirs();
                            needRoot_tAFOX_3 = true;
                        }

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

                        class NestXMLTool_tAFOX_3 {
                            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_3 nestXMLTool_tAFOX_3 = new NestXMLTool_tAFOX_3();
                        // sort group root element for judgement of group
                        java.util.List<org.dom4j.Element> groupElementList_tAFOX_3 = new java.util.ArrayList<org.dom4j.Element>();
                        org.dom4j.Element root4Group_tAFOX_3 = null;
                        org.dom4j.Document doc_tAFOX_3 = null;

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

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

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

                        int[] orders_tAFOX_3 = new int[1];

                        /**
                         * [tAdvancedFileOutputXML_3 begin ] stop
                         */

                        /**
                         * [tSortRow_5_SortIn begin ] start
                         */

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

                        int tos_count_tSortRow_5_SortIn = 0;

                        obj2move_XMLStruct[] array_tSortRow_5_SortIn = (obj2move_XMLStruct[]) globalMap
                                .get("tSortRow_5");

                        int nb_line_tSortRow_5_SortIn = 0;

                        obj2move_XMLStruct current_tSortRow_5_SortIn = null;

                        for (int i_tSortRow_5_SortIn = 0; i_tSortRow_5_SortIn < array_tSortRow_5_SortIn.length; i_tSortRow_5_SortIn++) {
                            current_tSortRow_5_SortIn = array_tSortRow_5_SortIn[i_tSortRow_5_SortIn];
                            row1.objectNum = current_tSortRow_5_SortIn.objectNum;
                            row1.obj_CSID = current_tSortRow_5_SortIn.obj_CSID;
                            row1.subjectDoctype = current_tSortRow_5_SortIn.subjectDoctype;
                            row1.moveID = current_tSortRow_5_SortIn.moveID;
                            row1.move_CSID = current_tSortRow_5_SortIn.move_CSID;
                            row1.move_URI = current_tSortRow_5_SortIn.move_URI;
                            row1.objectDoctype = current_tSortRow_5_SortIn.objectDoctype;
                            row1.loc_refName = current_tSortRow_5_SortIn.loc_refName;
                            row1.move_timestamp = current_tSortRow_5_SortIn.move_timestamp;
                            row1.obj2move_CSID = current_tSortRow_5_SortIn.obj2move_CSID;
                            row1.move_refname = current_tSortRow_5_SortIn.move_refname;
                            row1.obj_uri = current_tSortRow_5_SortIn.obj_uri;
                            row1.obj_refname = current_tSortRow_5_SortIn.obj_refname;
                            row1.rel_o2m_uri = current_tSortRow_5_SortIn.rel_o2m_uri;
                            row1.rel_o2m_refname = current_tSortRow_5_SortIn.rel_o2m_refname;
                            row1.datetimeTZ = current_tSortRow_5_SortIn.datetimeTZ;
                            // increase number of line sorted
                            nb_line_tSortRow_5_SortIn++;

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

                            currentComponent = "tSortRow_5_SortIn";

                            tos_count_tSortRow_5_SortIn++;

                            /**
                             * [tSortRow_5_SortIn main ] stop
                             */

                            /**
                             * [tAdvancedFileOutputXML_3 main ] start
                             */

                            currentComponent = "tAdvancedFileOutputXML_3";

                            nb_line_tAFOX_3++;
                            valueMap_tAFOX_3.clear();
                            valueMap_tAFOX_3.put("objectNum",
                                    (row1.objectNum != null ? row1.objectNum.toString() : null));
                            valueMap_tAFOX_3.put("obj_CSID",
                                    (row1.obj_CSID != null ? row1.obj_CSID.toString() : null));
                            valueMap_tAFOX_3.put("subjectDoctype",
                                    (row1.subjectDoctype != null ? row1.subjectDoctype.toString() : null));
                            valueMap_tAFOX_3.put("moveID",
                                    (row1.moveID != null ? row1.moveID.toString() : null));
                            valueMap_tAFOX_3.put("move_CSID",
                                    (row1.move_CSID != null ? row1.move_CSID.toString() : null));
                            valueMap_tAFOX_3.put("move_URI",
                                    (row1.move_URI != null ? row1.move_URI.toString() : null));
                            valueMap_tAFOX_3.put("objectDoctype",
                                    (row1.objectDoctype != null ? row1.objectDoctype.toString() : null));
                            valueMap_tAFOX_3.put("loc_refName",
                                    (row1.loc_refName != null ? row1.loc_refName.toString() : null));
                            valueMap_tAFOX_3.put("move_timestamp",
                                    (row1.move_timestamp != null ? row1.move_timestamp.toString() : null));
                            valueMap_tAFOX_3.put("obj2move_CSID", (row1.obj2move_CSID.toString()));
                            valueMap_tAFOX_3.put("move_refname", (row1.move_refname.toString()));
                            valueMap_tAFOX_3.put("obj_uri", (row1.obj_uri.toString()));
                            valueMap_tAFOX_3.put("obj_refname", (row1.obj_refname.toString()));
                            valueMap_tAFOX_3.put("rel_o2m_uri", (row1.rel_o2m_uri.toString()));
                            valueMap_tAFOX_3.put("rel_o2m_refname", (row1.rel_o2m_refname.toString()));
                            valueMap_tAFOX_3.put("datetimeTZ", (row1.datetimeTZ.toString()));
                            org.dom4j.Element subTreeRootParent_tAFOX_3 = null;

                            // build root xml tree
                            if (needRoot_tAFOX_3) {
                                needRoot_tAFOX_3 = false;
                                if (orders_tAFOX_3.length > 0) {
                                    orders_tAFOX_3[0] = 0;
                                }
                                org.dom4j.Element root_tAFOX_3 = doc_tAFOX_3.addElement("imports");
                                subTreeRootParent_tAFOX_3 = root_tAFOX_3;
                                root4Group_tAFOX_3 = subTreeRootParent_tAFOX_3;
                            } else {
                                subTreeRootParent_tAFOX_3 = root4Group_tAFOX_3;
                            }
                            // build group xml tree
                            // build loop xml tree
                            org.dom4j.Element loop_tAFOX_3 = org.dom4j.DocumentHelper.createElement("import");
                            if (orders_tAFOX_3[0] == 0) {
                                orders_tAFOX_3[0] = 0;
                            }
                            if (1 < orders_tAFOX_3.length) {
                                orders_tAFOX_3[1] = 0;
                            }
                            subTreeRootParent_tAFOX_3.elements().add(orders_tAFOX_3[0]++, loop_tAFOX_3);
                            loop_tAFOX_3.addAttribute("service", "Relations");
                            loop_tAFOX_3.addAttribute("type", "Relation");
                            if (valueMap_tAFOX_3.get("obj2move_CSID") != null) {
                                loop_tAFOX_3.addAttribute("CSID", valueMap_tAFOX_3.get("obj2move_CSID"));
                            }
                            org.dom4j.Element loop_0_tAFOX_3 = loop_tAFOX_3.addElement("schema");
                            loop_0_tAFOX_3.addNamespace("relations_common", TalendString
                                    .replaceSpecialCharForXML("http://collectionspace.org/relation"));
                            loop_0_tAFOX_3.addAttribute("name", "relations_common");
                            org.dom4j.Element loop_0_0_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_0_tAFOX_3 = loop_0_tAFOX_3.addElement("relationshipType");
                            } else {
                                loop_0_0_tAFOX_3 = loop_0_tAFOX_3
                                        .addElement("relations_common:relationshipType");
                            }
                            nestXMLTool_tAFOX_3.parseAndAdd(loop_0_0_tAFOX_3, "affects");

                            loop_0_0_tAFOX_3.setName("relations_common:relationshipType");
                            org.dom4j.Element loop_0_1_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_1_tAFOX_3 = loop_0_tAFOX_3.addElement("subjectCsid");
                            } else {
                                loop_0_1_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:subjectCsid");
                            }
                            if (valueMap_tAFOX_3.get("obj_CSID") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_1_tAFOX_3, valueMap_tAFOX_3.get("obj_CSID"));
                            }
                            loop_0_1_tAFOX_3.setName("relations_common:subjectCsid");
                            org.dom4j.Element loop_0_2_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_2_tAFOX_3 = loop_0_tAFOX_3.addElement("subjectDocumentType");
                            } else {
                                loop_0_2_tAFOX_3 = loop_0_tAFOX_3
                                        .addElement("relations_common:subjectDocumentType");
                            }
                            if (valueMap_tAFOX_3.get("subjectDoctype") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_2_tAFOX_3,
                                        valueMap_tAFOX_3.get("subjectDoctype"));
                            }
                            loop_0_2_tAFOX_3.setName("relations_common:subjectDocumentType");
                            org.dom4j.Element loop_0_3_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_3_tAFOX_3 = loop_0_tAFOX_3.addElement("subjectUri");
                            } else {
                                loop_0_3_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:subjectUri");
                            }
                            if (valueMap_tAFOX_3.get("obj_uri") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_3_tAFOX_3, valueMap_tAFOX_3.get("obj_uri"));
                            }
                            loop_0_3_tAFOX_3.setName("relations_common:subjectUri");
                            org.dom4j.Element loop_0_4_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_4_tAFOX_3 = loop_0_tAFOX_3.addElement("predicateDisplayName");
                            } else {
                                loop_0_4_tAFOX_3 = loop_0_tAFOX_3
                                        .addElement("relations_common:predicateDisplayName");
                            }
                            loop_0_4_tAFOX_3.setName("relations_common:predicateDisplayName");
                            org.dom4j.Element loop_0_5_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_5_tAFOX_3 = loop_0_tAFOX_3.addElement("predicate");
                            } else {
                                loop_0_5_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:predicate");
                            }
                            loop_0_5_tAFOX_3.setName("relations_common:predicate");
                            org.dom4j.Element loop_0_6_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_6_tAFOX_3 = loop_0_tAFOX_3.addElement("objectCsid");
                            } else {
                                loop_0_6_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:objectCsid");
                            }
                            if (valueMap_tAFOX_3.get("move_CSID") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_6_tAFOX_3,
                                        valueMap_tAFOX_3.get("move_CSID"));
                            }
                            loop_0_6_tAFOX_3.setName("relations_common:objectCsid");
                            org.dom4j.Element loop_0_7_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_7_tAFOX_3 = loop_0_tAFOX_3.addElement("objectUri");
                            } else {
                                loop_0_7_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:objectUri");
                            }
                            if (valueMap_tAFOX_3.get("move_URI") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_7_tAFOX_3, valueMap_tAFOX_3.get("move_URI"));
                            }
                            loop_0_7_tAFOX_3.setName("relations_common:objectUri");
                            org.dom4j.Element loop_0_8_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_8_tAFOX_3 = loop_0_tAFOX_3.addElement("objectRefName");
                            } else {
                                loop_0_8_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:objectRefName");
                            }
                            if (valueMap_tAFOX_3.get("move_refname") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_8_tAFOX_3,
                                        valueMap_tAFOX_3.get("move_refname"));
                            }
                            loop_0_8_tAFOX_3.setName("relations_common:objectRefName");
                            org.dom4j.Element loop_0_9_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_9_tAFOX_3 = loop_0_tAFOX_3.addElement("subjectRefName");
                            } else {
                                loop_0_9_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:subjectRefName");
                            }
                            if (valueMap_tAFOX_3.get("obj_refname") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_9_tAFOX_3,
                                        valueMap_tAFOX_3.get("obj_refname"));
                            }
                            loop_0_9_tAFOX_3.setName("relations_common:subjectRefName");
                            org.dom4j.Element loop_0_10_tAFOX_3;
                            if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_10_tAFOX_3 = loop_0_tAFOX_3.addElement("objectDocumentType");
                            } else {
                                loop_0_10_tAFOX_3 = loop_0_tAFOX_3
                                        .addElement("relations_common:objectDocumentType");
                            }
                            if (valueMap_tAFOX_3.get("objectDoctype") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_0_10_tAFOX_3,
                                        valueMap_tAFOX_3.get("objectDoctype"));
                            }
                            loop_0_10_tAFOX_3.setName("relations_common:objectDocumentType");
                            org.dom4j.Element loop_1_tAFOX_3 = loop_tAFOX_3.addElement("schema0");
                            loop_1_tAFOX_3.addNamespace("collectionspace_core",
                                    TalendString.replaceSpecialCharForXML(
                                            "http://collectionspace.org/collectionspace_core/"));
                            loop_1_tAFOX_3.addAttribute("name", "collectionspace_core");
                            org.dom4j.Element loop_1_0_tAFOX_3 = loop_1_tAFOX_3.addElement("uri");
                            if (valueMap_tAFOX_3.get("rel_o2m_uri") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_1_0_tAFOX_3,
                                        valueMap_tAFOX_3.get("rel_o2m_uri"));
                            }
                            org.dom4j.Element loop_1_1_tAFOX_3 = loop_1_tAFOX_3.addElement("refName");
                            if (valueMap_tAFOX_3.get("rel_o2m_refname") != null) {
                                nestXMLTool_tAFOX_3.setText(loop_1_1_tAFOX_3,
                                        valueMap_tAFOX_3.get("rel_o2m_refname"));
                            }

                            tos_count_tAdvancedFileOutputXML_3++;

                            /**
                             * [tAdvancedFileOutputXML_3 main ] stop
                             */

                            /**
                             * [tSortRow_5_SortIn end ] start
                             */

                            currentComponent = "tSortRow_5_SortIn";

                        }

                        globalMap.put("tSortRow_5_SortIn_NB_LINE", nb_line_tSortRow_5_SortIn);

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

                        /**
                         * [tSortRow_5_SortIn end ] stop
                         */

                        /**
                         * [tAdvancedFileOutputXML_3 end ] start
                         */

                        currentComponent = "tAdvancedFileOutputXML_3";

                        java.io.FileOutputStream stream_tAFOX_3 = new java.io.FileOutputStream(
                                fileName_tAFOX_3);
                        org.dom4j.io.XMLWriter output_tAFOX_3 = new org.dom4j.io.XMLWriter(stream_tAFOX_3,
                                format_tAFOX_3);
                        if (doc_tAFOX_3.getRootElement() != null) {
                            nestXMLTool_tAFOX_3.replaceDefaultNameSpace(doc_tAFOX_3.getRootElement());
                            output_tAFOX_3.write(doc_tAFOX_3);
                        }
                        output_tAFOX_3.close();
                        globalMap.put("tAdvancedFileOutputXML_3_NB_LINE", nb_line_tAFOX_3);

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

                        /**
                         * [tAdvancedFileOutputXML_3 end ] stop
                         */

                        /**
                         * [tSortRow_6_SortOut end ] start
                         */

                        currentComponent = "tSortRow_6_SortOut";

                        move2obj_XMLStruct[] array_tSortRow_6_SortOut = list_tSortRow_6_SortOut
                                .toArray(new Comparablemove2obj_XMLStruct[0]);

                        java.util.Arrays.sort(array_tSortRow_6_SortOut);

                        globalMap.put("tSortRow_6", array_tSortRow_6_SortOut);

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

                        /**
                         * [tSortRow_6_SortOut end ] stop
                         */

                        /**
                         * [tAdvancedFileOutputXML_2 begin ] start
                         */

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

                        int tos_count_tAdvancedFileOutputXML_2 = 0;

                        int nb_line_tAFOX_2 = 0;

                        boolean needRoot_tAFOX_2 = true;

                        String fileName_tAFOX_2 = "../temp/relation/barcode6_move2obj."
                                + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".xml";
                        Boolean alreadyExistsFile_tAFOX_2 = new java.io.File(fileName_tAFOX_2).exists();
                        fileName_tAFOX_2 = new java.io.File(fileName_tAFOX_2).getAbsolutePath().replace("\\",
                                "/");
                        String file_tAFOX_2 = "";

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

                        if (!createFiletAFOX_2.exists()) {
                            (new java.io.File(fileName_tAFOX_2.substring(0, fileName_tAFOX_2.lastIndexOf("/"))))
                                    .mkdirs();
                            needRoot_tAFOX_2 = true;
                        }

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

                        class NestXMLTool_tAFOX_2 {
                            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_2 nestXMLTool_tAFOX_2 = new NestXMLTool_tAFOX_2();
                        // sort group root element for judgement of group
                        java.util.List<org.dom4j.Element> groupElementList_tAFOX_2 = new java.util.ArrayList<org.dom4j.Element>();
                        org.dom4j.Element root4Group_tAFOX_2 = null;
                        org.dom4j.Document doc_tAFOX_2 = null;

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

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

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

                        int[] orders_tAFOX_2 = new int[1];

                        /**
                         * [tAdvancedFileOutputXML_2 begin ] stop
                         */

                        /**
                         * [tSortRow_6_SortIn begin ] start
                         */

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

                        int tos_count_tSortRow_6_SortIn = 0;

                        move2obj_XMLStruct[] array_tSortRow_6_SortIn = (move2obj_XMLStruct[]) globalMap
                                .get("tSortRow_6");

                        int nb_line_tSortRow_6_SortIn = 0;

                        move2obj_XMLStruct current_tSortRow_6_SortIn = null;

                        for (int i_tSortRow_6_SortIn = 0; i_tSortRow_6_SortIn < array_tSortRow_6_SortIn.length; i_tSortRow_6_SortIn++) {
                            current_tSortRow_6_SortIn = array_tSortRow_6_SortIn[i_tSortRow_6_SortIn];
                            row3.objectNum = current_tSortRow_6_SortIn.objectNum;
                            row3.obj_CSID = current_tSortRow_6_SortIn.obj_CSID;
                            row3.objectDocType = current_tSortRow_6_SortIn.objectDocType;
                            row3.moveID = current_tSortRow_6_SortIn.moveID;
                            row3.move_CSID = current_tSortRow_6_SortIn.move_CSID;
                            row3.move_URI = current_tSortRow_6_SortIn.move_URI;
                            row3.subjectDocType = current_tSortRow_6_SortIn.subjectDocType;
                            row3.loc_refName = current_tSortRow_6_SortIn.loc_refName;
                            row3.move_timestamp = current_tSortRow_6_SortIn.move_timestamp;
                            row3.move2obj_CSID = current_tSortRow_6_SortIn.move2obj_CSID;
                            row3.move_refname = current_tSortRow_6_SortIn.move_refname;
                            row3.obj_uri = current_tSortRow_6_SortIn.obj_uri;
                            row3.obj_refname = current_tSortRow_6_SortIn.obj_refname;
                            row3.rel_m2o_uri = current_tSortRow_6_SortIn.rel_m2o_uri;
                            row3.rel_m2o_refname = current_tSortRow_6_SortIn.rel_m2o_refname;
                            row3.datetimeTZ = current_tSortRow_6_SortIn.datetimeTZ;
                            // increase number of line sorted
                            nb_line_tSortRow_6_SortIn++;

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

                            currentComponent = "tSortRow_6_SortIn";

                            tos_count_tSortRow_6_SortIn++;

                            /**
                             * [tSortRow_6_SortIn main ] stop
                             */

                            /**
                             * [tAdvancedFileOutputXML_2 main ] start
                             */

                            currentComponent = "tAdvancedFileOutputXML_2";

                            nb_line_tAFOX_2++;
                            valueMap_tAFOX_2.clear();
                            valueMap_tAFOX_2.put("objectNum",
                                    (row3.objectNum != null ? row3.objectNum.toString() : null));
                            valueMap_tAFOX_2.put("obj_CSID",
                                    (row3.obj_CSID != null ? row3.obj_CSID.toString() : null));
                            valueMap_tAFOX_2.put("objectDocType",
                                    (row3.objectDocType != null ? row3.objectDocType.toString() : null));
                            valueMap_tAFOX_2.put("moveID",
                                    (row3.moveID != null ? row3.moveID.toString() : null));
                            valueMap_tAFOX_2.put("move_CSID",
                                    (row3.move_CSID != null ? row3.move_CSID.toString() : null));
                            valueMap_tAFOX_2.put("move_URI",
                                    (row3.move_URI != null ? row3.move_URI.toString() : null));
                            valueMap_tAFOX_2.put("subjectDocType",
                                    (row3.subjectDocType != null ? row3.subjectDocType.toString() : null));
                            valueMap_tAFOX_2.put("loc_refName",
                                    (row3.loc_refName != null ? row3.loc_refName.toString() : null));
                            valueMap_tAFOX_2.put("move_timestamp",
                                    (row3.move_timestamp != null ? row3.move_timestamp.toString() : null));
                            valueMap_tAFOX_2.put("move2obj_CSID", (row3.move2obj_CSID.toString()));
                            valueMap_tAFOX_2.put("move_refname", (row3.move_refname.toString()));
                            valueMap_tAFOX_2.put("obj_uri", (row3.obj_uri.toString()));
                            valueMap_tAFOX_2.put("obj_refname", (row3.obj_refname.toString()));
                            valueMap_tAFOX_2.put("rel_m2o_uri", (row3.rel_m2o_uri.toString()));
                            valueMap_tAFOX_2.put("rel_m2o_refname", (row3.rel_m2o_refname.toString()));
                            valueMap_tAFOX_2.put("datetimeTZ", (row3.datetimeTZ.toString()));
                            org.dom4j.Element subTreeRootParent_tAFOX_2 = null;

                            // build root xml tree
                            if (needRoot_tAFOX_2) {
                                needRoot_tAFOX_2 = false;
                                if (orders_tAFOX_2.length > 0) {
                                    orders_tAFOX_2[0] = 0;
                                }
                                org.dom4j.Element root_tAFOX_2 = doc_tAFOX_2.addElement("imports");
                                subTreeRootParent_tAFOX_2 = root_tAFOX_2;
                                root4Group_tAFOX_2 = subTreeRootParent_tAFOX_2;
                            } else {
                                subTreeRootParent_tAFOX_2 = root4Group_tAFOX_2;
                            }
                            // build group xml tree
                            // build loop xml tree
                            org.dom4j.Element loop_tAFOX_2 = org.dom4j.DocumentHelper.createElement("import");
                            if (orders_tAFOX_2[0] == 0) {
                                orders_tAFOX_2[0] = 0;
                            }
                            if (1 < orders_tAFOX_2.length) {
                                orders_tAFOX_2[1] = 0;
                            }
                            subTreeRootParent_tAFOX_2.elements().add(orders_tAFOX_2[0]++, loop_tAFOX_2);
                            loop_tAFOX_2.addAttribute("service", "Relations");
                            loop_tAFOX_2.addAttribute("type", "Relation");
                            if (valueMap_tAFOX_2.get("move2obj_CSID") != null) {
                                loop_tAFOX_2.addAttribute("CSID", valueMap_tAFOX_2.get("move2obj_CSID"));
                            }
                            org.dom4j.Element loop_0_tAFOX_2 = loop_tAFOX_2.addElement("schema");
                            loop_0_tAFOX_2.addNamespace("relations_common", TalendString
                                    .replaceSpecialCharForXML("http://collectionspace.org/relation"));
                            loop_0_tAFOX_2.addAttribute("name", "relations_common");
                            org.dom4j.Element loop_0_0_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_0_tAFOX_2 = loop_0_tAFOX_2.addElement("relationshipType");
                            } else {
                                loop_0_0_tAFOX_2 = loop_0_tAFOX_2
                                        .addElement("relations_common:relationshipType");
                            }
                            nestXMLTool_tAFOX_2.parseAndAdd(loop_0_0_tAFOX_2, "affects");

                            loop_0_0_tAFOX_2.setName("relations_common:relationshipType");
                            org.dom4j.Element loop_0_1_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_1_tAFOX_2 = loop_0_tAFOX_2.addElement("subjectCsid");
                            } else {
                                loop_0_1_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:subjectCsid");
                            }
                            if (valueMap_tAFOX_2.get("move_CSID") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_1_tAFOX_2,
                                        valueMap_tAFOX_2.get("move_CSID"));
                            }
                            loop_0_1_tAFOX_2.setName("relations_common:subjectCsid");
                            org.dom4j.Element loop_0_2_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_2_tAFOX_2 = loop_0_tAFOX_2.addElement("subjectDocumentType");
                            } else {
                                loop_0_2_tAFOX_2 = loop_0_tAFOX_2
                                        .addElement("relations_common:subjectDocumentType");
                            }
                            if (valueMap_tAFOX_2.get("subjectDocType") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_2_tAFOX_2,
                                        valueMap_tAFOX_2.get("subjectDocType"));
                            }
                            loop_0_2_tAFOX_2.setName("relations_common:subjectDocumentType");
                            org.dom4j.Element loop_0_3_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_3_tAFOX_2 = loop_0_tAFOX_2.addElement("subjectUri");
                            } else {
                                loop_0_3_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:subjectUri");
                            }
                            if (valueMap_tAFOX_2.get("move_URI") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_3_tAFOX_2, valueMap_tAFOX_2.get("move_URI"));
                            }
                            loop_0_3_tAFOX_2.setName("relations_common:subjectUri");
                            org.dom4j.Element loop_0_4_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_4_tAFOX_2 = loop_0_tAFOX_2.addElement("predicateDisplayName");
                            } else {
                                loop_0_4_tAFOX_2 = loop_0_tAFOX_2
                                        .addElement("relations_common:predicateDisplayName");
                            }
                            loop_0_4_tAFOX_2.setName("relations_common:predicateDisplayName");
                            org.dom4j.Element loop_0_5_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_5_tAFOX_2 = loop_0_tAFOX_2.addElement("predicate");
                            } else {
                                loop_0_5_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:predicate");
                            }
                            loop_0_5_tAFOX_2.setName("relations_common:predicate");
                            org.dom4j.Element loop_0_6_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_6_tAFOX_2 = loop_0_tAFOX_2.addElement("objectCsid");
                            } else {
                                loop_0_6_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:objectCsid");
                            }
                            if (valueMap_tAFOX_2.get("obj_CSID") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_6_tAFOX_2, valueMap_tAFOX_2.get("obj_CSID"));
                            }
                            loop_0_6_tAFOX_2.setName("relations_common:objectCsid");
                            org.dom4j.Element loop_0_7_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_7_tAFOX_2 = loop_0_tAFOX_2.addElement("objectUri");
                            } else {
                                loop_0_7_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:objectUri");
                            }
                            if (valueMap_tAFOX_2.get("obj_uri") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_7_tAFOX_2, valueMap_tAFOX_2.get("obj_uri"));
                            }
                            loop_0_7_tAFOX_2.setName("relations_common:objectUri");
                            org.dom4j.Element loop_0_8_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_8_tAFOX_2 = loop_0_tAFOX_2.addElement("objectRefName");
                            } else {
                                loop_0_8_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:objectRefName");
                            }
                            if (valueMap_tAFOX_2.get("obj_refname") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_8_tAFOX_2,
                                        valueMap_tAFOX_2.get("obj_refname"));
                            }
                            loop_0_8_tAFOX_2.setName("relations_common:objectRefName");
                            org.dom4j.Element loop_0_9_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_9_tAFOX_2 = loop_0_tAFOX_2.addElement("subjectRefName");
                            } else {
                                loop_0_9_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:subjectRefName");
                            }
                            if (valueMap_tAFOX_2.get("move_refname") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_9_tAFOX_2,
                                        valueMap_tAFOX_2.get("move_refname"));
                            }
                            loop_0_9_tAFOX_2.setName("relations_common:subjectRefName");
                            org.dom4j.Element loop_0_10_tAFOX_2;
                            if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                                loop_0_10_tAFOX_2 = loop_0_tAFOX_2.addElement("objectDocumentType");
                            } else {
                                loop_0_10_tAFOX_2 = loop_0_tAFOX_2
                                        .addElement("relations_common:objectDocumentType");
                            }
                            if (valueMap_tAFOX_2.get("objectDocType") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_0_10_tAFOX_2,
                                        valueMap_tAFOX_2.get("objectDocType"));
                            }
                            loop_0_10_tAFOX_2.setName("relations_common:objectDocumentType");
                            org.dom4j.Element loop_1_tAFOX_2 = loop_tAFOX_2.addElement("schema0");
                            loop_1_tAFOX_2.addNamespace("collectionspace_core",
                                    TalendString.replaceSpecialCharForXML(
                                            "http://collectionspace.org/collectionspace_core/"));
                            loop_1_tAFOX_2.addAttribute("name", "collectionspace_core");
                            org.dom4j.Element loop_1_0_tAFOX_2 = loop_1_tAFOX_2.addElement("uri");
                            if (valueMap_tAFOX_2.get("rel_m2o_uri") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_1_0_tAFOX_2,
                                        valueMap_tAFOX_2.get("rel_m2o_uri"));
                            }
                            org.dom4j.Element loop_1_1_tAFOX_2 = loop_1_tAFOX_2.addElement("refName");
                            if (valueMap_tAFOX_2.get("rel_m2o_refname") != null) {
                                nestXMLTool_tAFOX_2.setText(loop_1_1_tAFOX_2,
                                        valueMap_tAFOX_2.get("rel_m2o_refname"));
                            }

                            tos_count_tAdvancedFileOutputXML_2++;

                            /**
                             * [tAdvancedFileOutputXML_2 main ] stop
                             */

                            /**
                             * [tSortRow_6_SortIn end ] start
                             */

                            currentComponent = "tSortRow_6_SortIn";

                        }

                        globalMap.put("tSortRow_6_SortIn_NB_LINE", nb_line_tSortRow_6_SortIn);

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

                        /**
                         * [tSortRow_6_SortIn end ] stop
                         */

                        /**
                         * [tAdvancedFileOutputXML_2 end ] start
                         */

                        currentComponent = "tAdvancedFileOutputXML_2";

                        java.io.FileOutputStream stream_tAFOX_2 = new java.io.FileOutputStream(
                                fileName_tAFOX_2);
                        org.dom4j.io.XMLWriter output_tAFOX_2 = new org.dom4j.io.XMLWriter(stream_tAFOX_2,
                                format_tAFOX_2);
                        if (doc_tAFOX_2.getRootElement() != null) {
                            nestXMLTool_tAFOX_2.replaceDefaultNameSpace(doc_tAFOX_2.getRootElement());
                            output_tAFOX_2.write(doc_tAFOX_2);
                        }
                        output_tAFOX_2.close();
                        globalMap.put("tAdvancedFileOutputXML_2_NB_LINE", nb_line_tAFOX_2);

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

                        /**
                         * [tAdvancedFileOutputXML_2 end ] stop
                         */

                        /**
                         * [tFileOutputDelimited_4 end ] start
                         */

                        currentComponent = "tFileOutputDelimited_4";

                    } finally {
                        if (outtFileOutputDelimited_4 != null) {
                            outtFileOutputDelimited_4.flush();
                            outtFileOutputDelimited_4.close();
                        }
                        globalMap.put("tFileOutputDelimited_4_NB_LINE", nb_line_tFileOutputDelimited_4);
                        globalMap.put("tFileOutputDelimited_4_FILE_NAME", fileName_tFileOutputDelimited_4);
                    } // finally

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

                    /**
                     * [tFileOutputDelimited_4 end ] stop
                     */

                    /**
                     * [tFileOutputDelimited_5 end ] start
                     */

                    currentComponent = "tFileOutputDelimited_5";

                } finally {
                    if (outtFileOutputDelimited_5 != null) {
                        outtFileOutputDelimited_5.flush();
                        outtFileOutputDelimited_5.close();
                    }
                    globalMap.put("tFileOutputDelimited_5_NB_LINE", nb_line_tFileOutputDelimited_5);
                    globalMap.put("tFileOutputDelimited_5_FILE_NAME", fileName_tFileOutputDelimited_5);
                } // finally

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

                /**
                 * [tFileOutputDelimited_5 end ] stop
                 */

                /**
                 * [tFileOutputDelimited_1 end ] start
                 */

                currentComponent = "tFileOutputDelimited_1";

            } finally {
                if (outtFileOutputDelimited_1 != null) {
                    outtFileOutputDelimited_1.flush();
                    outtFileOutputDelimited_1.close();
                }
                globalMap.put("tFileOutputDelimited_1_NB_LINE", nb_line_tFileOutputDelimited_1);
                globalMap.put("tFileOutputDelimited_1_FILE_NAME", fileName_tFileOutputDelimited_1);
            } // finally

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

            /**
             * [tFileOutputDelimited_1 end ] stop
             */

            /**
             * [tAdvancedFileOutputXML_1 end ] start
             */

            currentComponent = "tAdvancedFileOutputXML_1";

            java.io.FileOutputStream stream_tAFOX_1 = new java.io.FileOutputStream(fileName_tAFOX_1);
            org.dom4j.io.XMLWriter output_tAFOX_1 = new org.dom4j.io.XMLWriter(stream_tAFOX_1, format_tAFOX_1);
            if (doc_tAFOX_1.getRootElement() != null) {
                nestXMLTool_tAFOX_1.replaceDefaultNameSpace(doc_tAFOX_1.getRootElement());
                output_tAFOX_1.write(doc_tAFOX_1);
            }
            output_tAFOX_1.close();
            globalMap.put("tAdvancedFileOutputXML_1_NB_LINE", nb_line_tAFOX_1);

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

            /**
             * [tAdvancedFileOutputXML_1 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 "tSortRow_6_SortIn"
        globalMap.put("tSortRow_6", null);

        // free memory for "tSortRow_5_SortIn"
        globalMap.put("tSortRow_5", null);

        // free memory for "tMap_1"
        globalMap.put("tHash_Lookup_person_ID_displayName", null);

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

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

        // free memory for "tMap_1"
        globalMap.put("tHash_Lookup_obj_IDs", 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:pahma_etl.tmslocation_barcode_mvcrate_1_0.TMSlocation_barcode_mvCrate.java

License:LGPL

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

    final boolean execStat = this.execStat;

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

    try {/*from  ww w  .j av  a2s . co  m*/

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

            tFileInputDelimited_1Process(globalMap);

            obj_IDsStruct obj_IDs = new obj_IDsStruct();
            out_moveXMLStruct out_moveXML = new out_moveXMLStruct();
            moveCSIDStruct moveCSID = new moveCSIDStruct();
            IDStruct ID = new IDStruct();
            unmatch_locStruct unmatch_loc = new unmatch_locStruct();
            move2obj_XMLStruct move2obj_XML = new move2obj_XMLStruct();
            obj2move_XMLStruct obj2move_XML = new obj2move_XMLStruct();

            /**
             * [tAdvancedFileOutputXML_1 begin ] start
             */

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

            int tos_count_tAdvancedFileOutputXML_1 = 0;

            int nb_line_tAFOX_1 = 0;

            boolean needRoot_tAFOX_1 = true;

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

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

            if (!createFiletAFOX_1.exists()) {
                (new java.io.File(fileName_tAFOX_1.substring(0, fileName_tAFOX_1.lastIndexOf("/")))).mkdirs();
                needRoot_tAFOX_1 = true;
            }

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

            class NestXMLTool_tAFOX_1 {
                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_1 nestXMLTool_tAFOX_1 = new NestXMLTool_tAFOX_1();
            // sort group root element for judgement of group
            java.util.List<org.dom4j.Element> groupElementList_tAFOX_1 = new java.util.ArrayList<org.dom4j.Element>();
            org.dom4j.Element root4Group_tAFOX_1 = null;
            org.dom4j.Document doc_tAFOX_1 = null;

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

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

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

            int[] orders_tAFOX_1 = new int[1];

            /**
             * [tAdvancedFileOutputXML_1 begin ] stop
             */

            /**
             * [tFileOutputDelimited_1 begin ] start
             */

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

            int tos_count_tFileOutputDelimited_1 = 0;

            String fileName_tFileOutputDelimited_1 = "";
            fileName_tFileOutputDelimited_1 = (new java.io.File("../temp/location/barcodeMvCrate_CSID."
                    + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".txt")).getAbsolutePath()
                            .replace("\\", "/");
            String fullName_tFileOutputDelimited_1 = null;
            String extension_tFileOutputDelimited_1 = null;
            String directory_tFileOutputDelimited_1 = null;
            if ((fileName_tFileOutputDelimited_1.indexOf("/") != -1)) {
                if (fileName_tFileOutputDelimited_1.lastIndexOf(".") < fileName_tFileOutputDelimited_1
                        .lastIndexOf("/")) {
                    fullName_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1;
                    extension_tFileOutputDelimited_1 = "";
                } else {
                    fullName_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1.substring(0,
                            fileName_tFileOutputDelimited_1.lastIndexOf("."));
                    extension_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1
                            .substring(fileName_tFileOutputDelimited_1.lastIndexOf("."));
                }
                directory_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1.substring(0,
                        fileName_tFileOutputDelimited_1.lastIndexOf("/"));
            } else {
                if (fileName_tFileOutputDelimited_1.lastIndexOf(".") != -1) {
                    fullName_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1.substring(0,
                            fileName_tFileOutputDelimited_1.lastIndexOf("."));
                    extension_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1
                            .substring(fileName_tFileOutputDelimited_1.lastIndexOf("."));
                } else {
                    fullName_tFileOutputDelimited_1 = fileName_tFileOutputDelimited_1;
                    extension_tFileOutputDelimited_1 = "";
                }
                directory_tFileOutputDelimited_1 = "";
            }
            boolean isFileGenerated_tFileOutputDelimited_1 = true;
            java.io.File filetFileOutputDelimited_1 = new java.io.File(fileName_tFileOutputDelimited_1);
            globalMap.put("tFileOutputDelimited_1_FILE_NAME", fileName_tFileOutputDelimited_1);

            int nb_line_tFileOutputDelimited_1 = 0;
            int splitEvery_tFileOutputDelimited_1 = 1000;
            int splitedFileNo_tFileOutputDelimited_1 = 0;
            int currentRow_tFileOutputDelimited_1 = 0;

            final String OUT_DELIM_tFileOutputDelimited_1 = /**
                                                            * Start field
                                                            * tFileOutputDelimited_1:FIELDSEPARATOR
                                                            */
                    ";"/** End field tFileOutputDelimited_1:FIELDSEPARATOR */
            ;

            final String OUT_DELIM_ROWSEP_tFileOutputDelimited_1 = /**
                                                                   * Start
                                                                   * field tFileOutputDelimited_1:ROWSEPARATOR
                                                                   */
                    "\n"/** End field tFileOutputDelimited_1:ROWSEPARATOR */
            ;

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

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

                /**
                 * [tFileOutputDelimited_1 begin ] stop
                 */

                /**
                 * [tFileOutputDelimited_5 begin ] start
                 */

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

                int tos_count_tFileOutputDelimited_5 = 0;

                String fileName_tFileOutputDelimited_5 = "";
                fileName_tFileOutputDelimited_5 = (new java.io.File("../temp/location/barcodeMvCrate_ID."
                        + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".txt"))
                                .getAbsolutePath().replace("\\", "/");
                String fullName_tFileOutputDelimited_5 = null;
                String extension_tFileOutputDelimited_5 = null;
                String directory_tFileOutputDelimited_5 = null;
                if ((fileName_tFileOutputDelimited_5.indexOf("/") != -1)) {
                    if (fileName_tFileOutputDelimited_5.lastIndexOf(".") < fileName_tFileOutputDelimited_5
                            .lastIndexOf("/")) {
                        fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5;
                        extension_tFileOutputDelimited_5 = "";
                    } else {
                        fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5.substring(0,
                                fileName_tFileOutputDelimited_5.lastIndexOf("."));
                        extension_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5
                                .substring(fileName_tFileOutputDelimited_5.lastIndexOf("."));
                    }
                    directory_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5.substring(0,
                            fileName_tFileOutputDelimited_5.lastIndexOf("/"));
                } else {
                    if (fileName_tFileOutputDelimited_5.lastIndexOf(".") != -1) {
                        fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5.substring(0,
                                fileName_tFileOutputDelimited_5.lastIndexOf("."));
                        extension_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5
                                .substring(fileName_tFileOutputDelimited_5.lastIndexOf("."));
                    } else {
                        fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5;
                        extension_tFileOutputDelimited_5 = "";
                    }
                    directory_tFileOutputDelimited_5 = "";
                }
                boolean isFileGenerated_tFileOutputDelimited_5 = true;
                java.io.File filetFileOutputDelimited_5 = new java.io.File(fileName_tFileOutputDelimited_5);
                globalMap.put("tFileOutputDelimited_5_FILE_NAME", fileName_tFileOutputDelimited_5);

                int nb_line_tFileOutputDelimited_5 = 0;
                int splitEvery_tFileOutputDelimited_5 = 1000;
                int splitedFileNo_tFileOutputDelimited_5 = 0;
                int currentRow_tFileOutputDelimited_5 = 0;

                final String OUT_DELIM_tFileOutputDelimited_5 = /**
                                                                * Start
                                                                * field tFileOutputDelimited_5:FIELDSEPARATOR
                                                                */
                        ";"/** End field tFileOutputDelimited_5:FIELDSEPARATOR */
                ;

                final String OUT_DELIM_ROWSEP_tFileOutputDelimited_5 = /**
                                                                       * 
                                                                       * Start field tFileOutputDelimited_5:ROWSEPARATOR
                                                                       */
                        "\n"/** End field tFileOutputDelimited_5:ROWSEPARATOR */
                ;

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

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

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

                        outtFileOutputDelimited_5.write("Item_Num");

                        outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                        outtFileOutputDelimited_5.write("moveID");

                        outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                        outtFileOutputDelimited_5.write("loc_reject");

                        outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                        outtFileOutputDelimited_5.write("handler_reject");

                        outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                        outtFileOutputDelimited_5.write("obj_reject");

                        outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                        outtFileOutputDelimited_5.write("loc_refname");

                        outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                        outtFileOutputDelimited_5.write("crate_refname");

                        outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                        outtFileOutputDelimited_5.write("loc_handler_refname");

                        outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                        outtFileOutputDelimited_5.write("capture_datetime");

                        outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                        outtFileOutputDelimited_5.write("moveCSID");

                        outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                        outtFileOutputDelimited_5.write("move2obj_CSID");

                        outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                        outtFileOutputDelimited_5.write("obj2move_CSID");

                        outtFileOutputDelimited_5.write(OUT_DELIM_ROWSEP_tFileOutputDelimited_5);
                        outtFileOutputDelimited_5.flush();
                    }

                    /**
                     * [tFileOutputDelimited_5 begin ] stop
                     */

                    /**
                     * [tFileOutputDelimited_4 begin ] start
                     */

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

                    int tos_count_tFileOutputDelimited_4 = 0;

                    String fileName_tFileOutputDelimited_4 = "";
                    fileName_tFileOutputDelimited_4 = (new java.io.File(
                            "../temp/location/barcodeMvCrate_unmatched." + TalendDate.getDate("CCYY-MM-DD")
                                    + "-" + context.infile_min + ".txt")).getAbsolutePath().replace("\\", "/");
                    String fullName_tFileOutputDelimited_4 = null;
                    String extension_tFileOutputDelimited_4 = null;
                    String directory_tFileOutputDelimited_4 = null;
                    if ((fileName_tFileOutputDelimited_4.indexOf("/") != -1)) {
                        if (fileName_tFileOutputDelimited_4.lastIndexOf(".") < fileName_tFileOutputDelimited_4
                                .lastIndexOf("/")) {
                            fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4;
                            extension_tFileOutputDelimited_4 = "";
                        } else {
                            fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4.substring(0,
                                    fileName_tFileOutputDelimited_4.lastIndexOf("."));
                            extension_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4
                                    .substring(fileName_tFileOutputDelimited_4.lastIndexOf("."));
                        }
                        directory_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4.substring(0,
                                fileName_tFileOutputDelimited_4.lastIndexOf("/"));
                    } else {
                        if (fileName_tFileOutputDelimited_4.lastIndexOf(".") != -1) {
                            fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4.substring(0,
                                    fileName_tFileOutputDelimited_4.lastIndexOf("."));
                            extension_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4
                                    .substring(fileName_tFileOutputDelimited_4.lastIndexOf("."));
                        } else {
                            fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4;
                            extension_tFileOutputDelimited_4 = "";
                        }
                        directory_tFileOutputDelimited_4 = "";
                    }
                    boolean isFileGenerated_tFileOutputDelimited_4 = true;
                    java.io.File filetFileOutputDelimited_4 = new java.io.File(fileName_tFileOutputDelimited_4);
                    globalMap.put("tFileOutputDelimited_4_FILE_NAME", fileName_tFileOutputDelimited_4);

                    int nb_line_tFileOutputDelimited_4 = 0;
                    int splitEvery_tFileOutputDelimited_4 = 1000;
                    int splitedFileNo_tFileOutputDelimited_4 = 0;
                    int currentRow_tFileOutputDelimited_4 = 0;

                    final String OUT_DELIM_tFileOutputDelimited_4 = /**
                                                                    * Start
                                                                    * field tFileOutputDelimited_4:FIELDSEPARATOR
                                                                    */
                            ";"/** End field tFileOutputDelimited_4:FIELDSEPARATOR */
                    ;

                    final String OUT_DELIM_ROWSEP_tFileOutputDelimited_4 = /**
                                                                           * 
                                                                           * Start field tFileOutputDelimited_4:ROWSEPARATOR
                                                                           */
                            "\n"/** End field tFileOutputDelimited_4:ROWSEPARATOR */
                    ;

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

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

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

                            outtFileOutputDelimited_4.write("Item_Num");

                            outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                            outtFileOutputDelimited_4.write("moveID");

                            outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                            outtFileOutputDelimited_4.write("reject_loc");

                            outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                            outtFileOutputDelimited_4.write("reject_handler");

                            outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                            outtFileOutputDelimited_4.write("reject_obj");

                            outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                            outtFileOutputDelimited_4.write("newLocation");

                            outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                            outtFileOutputDelimited_4.write("currCrate");

                            outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                            outtFileOutputDelimited_4.write("loc_refname");

                            outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                            outtFileOutputDelimited_4.write("crate_refname");

                            outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                            outtFileOutputDelimited_4.write("loc_handler");

                            outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                            outtFileOutputDelimited_4.write("loc_handler_refname");

                            outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                            outtFileOutputDelimited_4.write("Capture_timestamp");

                            outtFileOutputDelimited_4.write(OUT_DELIM_ROWSEP_tFileOutputDelimited_4);
                            outtFileOutputDelimited_4.flush();
                        }

                        /**
                         * [tFileOutputDelimited_4 begin ] stop
                         */

                        /**
                         * [tAdvancedFileOutputXML_2 begin ] start
                         */

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

                        int tos_count_tAdvancedFileOutputXML_2 = 0;

                        int nb_line_tAFOX_2 = 0;

                        boolean needRoot_tAFOX_2 = true;

                        String fileName_tAFOX_2 = "../temp/relation/barcodeMvCrate_move2obj."
                                + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".xml";
                        Boolean alreadyExistsFile_tAFOX_2 = new java.io.File(fileName_tAFOX_2).exists();
                        fileName_tAFOX_2 = new java.io.File(fileName_tAFOX_2).getAbsolutePath().replace("\\",
                                "/");
                        String file_tAFOX_2 = "";

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

                        if (!createFiletAFOX_2.exists()) {
                            (new java.io.File(fileName_tAFOX_2.substring(0, fileName_tAFOX_2.lastIndexOf("/"))))
                                    .mkdirs();
                            needRoot_tAFOX_2 = true;
                        }

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

                        class NestXMLTool_tAFOX_2 {
                            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_2 nestXMLTool_tAFOX_2 = new NestXMLTool_tAFOX_2();
                        // sort group root element for judgement of group
                        java.util.List<org.dom4j.Element> groupElementList_tAFOX_2 = new java.util.ArrayList<org.dom4j.Element>();
                        org.dom4j.Element root4Group_tAFOX_2 = null;
                        org.dom4j.Document doc_tAFOX_2 = null;

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

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

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

                        int[] orders_tAFOX_2 = new int[1];

                        /**
                         * [tAdvancedFileOutputXML_2 begin ] stop
                         */

                        /**
                         * [tAdvancedFileOutputXML_3 begin ] start
                         */

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

                        int tos_count_tAdvancedFileOutputXML_3 = 0;

                        int nb_line_tAFOX_3 = 0;

                        boolean needRoot_tAFOX_3 = true;

                        String fileName_tAFOX_3 = "../temp/relation/barcodeMvCrate_obj2move."
                                + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".xml";
                        Boolean alreadyExistsFile_tAFOX_3 = new java.io.File(fileName_tAFOX_3).exists();
                        fileName_tAFOX_3 = new java.io.File(fileName_tAFOX_3).getAbsolutePath().replace("\\",
                                "/");
                        String file_tAFOX_3 = "";

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

                        if (!createFiletAFOX_3.exists()) {
                            (new java.io.File(fileName_tAFOX_3.substring(0, fileName_tAFOX_3.lastIndexOf("/"))))
                                    .mkdirs();
                            needRoot_tAFOX_3 = true;
                        }

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

                        class NestXMLTool_tAFOX_3 {
                            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_3 nestXMLTool_tAFOX_3 = new NestXMLTool_tAFOX_3();
                        // sort group root element for judgement of group
                        java.util.List<org.dom4j.Element> groupElementList_tAFOX_3 = new java.util.ArrayList<org.dom4j.Element>();
                        org.dom4j.Element root4Group_tAFOX_3 = null;
                        org.dom4j.Document doc_tAFOX_3 = null;

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

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

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

                        int[] orders_tAFOX_3 = new int[1];

                        /**
                         * [tAdvancedFileOutputXML_3 begin ] stop
                         */

                        /**
                         * [tMap_1 begin ] start
                         */

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

                        int tos_count_tMap_1 = 0;

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

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

                        barcode_no_obj_yetStruct barcode_no_obj_yetHashKey = new barcode_no_obj_yetStruct();
                        barcode_no_obj_yetStruct barcode_no_obj_yetDefault = new barcode_no_obj_yetStruct();
                        // ###############################

                        // ###############################
                        // # Vars initialization
                        class Var__tMap_1__Struct {
                            String moveID;
                            String move_CSID;
                            java.util.Date Talend_date;
                            String date;
                            String datetime;
                            String datetimeTZ;
                            String trim_locrefname;
                            String item_locref;
                            String trim_craterefname;
                            boolean loc_reject;
                            boolean handler_reject;
                            boolean obj_reject;
                            String move2obj_CSID;
                            String obj2move_CSID;
                            String reason4move;
                            String computedSummary;
                        }
                        Var__tMap_1__Struct Var__tMap_1 = new Var__tMap_1__Struct();
                        // ###############################

                        // ###############################
                        // # Outputs initialization
                        out_moveXMLStruct out_moveXML_tmp = new out_moveXMLStruct();
                        moveCSIDStruct moveCSID_tmp = new moveCSIDStruct();
                        IDStruct ID_tmp = new IDStruct();
                        unmatch_locStruct unmatch_loc_tmp = new unmatch_locStruct();
                        move2obj_XMLStruct move2obj_XML_tmp = new move2obj_XMLStruct();
                        obj2move_XMLStruct obj2move_XML_tmp = new obj2move_XMLStruct();
                        // ###############################

                        /**
                         * [tMap_1 begin ] stop
                         */

                        /**
                         * [tFileInputDelimited_10 begin ] start
                         */

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

                        int tos_count_tFileInputDelimited_10 = 0;

                        class RowHelper_tFileInputDelimited_10 {

                            public void valueToConn(org.talend.fileprocess.FileInputDelimited fid,
                                    obj_IDsStruct obj_IDs) throws Exception {

                                obj_IDs.obj_nuxeoID = fid.get(0).trim();

                                obj_IDs.obj_CSID = fid.get(1).trim();

                                obj_IDs.objectNumber = fid.get(2).trim();

                                obj_IDs.objectID = fid.get(3).trim();

                                obj_IDs.currCrate_refname = fid.get(4).trim();

                                obj_IDs.currLoc_refname = fid.get(5).trim();

                                obj_IDs.handler = fid.get(6).trim();

                                obj_IDs.timestamp = fid.get(7).trim();

                                obj_IDs.rewLoc_refname = fid.get(8).trim();

                            }

                        }
                        RowHelper_tFileInputDelimited_10 rowHelper_tFileInputDelimited_10 = new RowHelper_tFileInputDelimited_10();

                        int nb_line_tFileInputDelimited_10 = 0;
                        org.talend.fileprocess.FileInputDelimited fid_tFileInputDelimited_10 = null;
                        try {

                            Object filename_tFileInputDelimited_10 = "/tmp/all_crateObj.tab."
                                    + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min;
                            if (filename_tFileInputDelimited_10 instanceof java.io.InputStream) {

                                int footer_value_tFileInputDelimited_10 = 0,
                                        random_value_tFileInputDelimited_10 = -1;
                                if (footer_value_tFileInputDelimited_10 > 0
                                        || random_value_tFileInputDelimited_10 > 0) {
                                    throw new Exception(
                                            "When the input source is a stream,footer and random shouldn't be bigger than 0.");
                                }

                            }
                            try {
                                fid_tFileInputDelimited_10 = new org.talend.fileprocess.FileInputDelimited(
                                        "/tmp/all_crateObj.tab." + TalendDate.getDate("CCYY-MM-DD") + "-"
                                                + context.infile_min,
                                        "US-ASCII", "\t", "\n", false, 0, 0, -1, -1, false);
                            } catch (Exception e) {

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

                            }

                            while (fid_tFileInputDelimited_10 != null
                                    && fid_tFileInputDelimited_10.nextRecord()) {

                                obj_IDs = null;

                                boolean whetherReject_tFileInputDelimited_10 = false;
                                obj_IDs = new obj_IDsStruct();
                                try {

                                    rowHelper_tFileInputDelimited_10.valueToConn(fid_tFileInputDelimited_10,
                                            obj_IDs);

                                } catch (Exception e) {
                                    whetherReject_tFileInputDelimited_10 = true;

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

                                }

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

                                currentComponent = "tFileInputDelimited_10";

                                tos_count_tFileInputDelimited_10++;

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

                                    /**
                                     * [tMap_1 main ] start
                                     */

                                    currentComponent = "tMap_1";

                                    boolean hasCasePrimitiveKeyWithNull_tMap_1 = false;

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

                                    // /////////////////////////////////////////////
                                    // Starting Lookup Table
                                    // "barcode_no_obj_yet"
                                    // /////////////////////////////////////////////

                                    boolean forceLoopbarcode_no_obj_yet = false;

                                    barcode_no_obj_yetStruct barcode_no_obj_yetObjectFromLookup = null;

                                    if (!rejectedInnerJoin_tMap_1) { // G_TM_M_020

                                        hasCasePrimitiveKeyWithNull_tMap_1 = false;

                                        barcode_no_obj_yetHashKey.crate_refname = obj_IDs.currCrate_refname;

                                        barcode_no_obj_yetHashKey.hashCodeDirty = true;

                                        tHash_Lookup_barcode_no_obj_yet.lookup(barcode_no_obj_yetHashKey);

                                        if (!tHash_Lookup_barcode_no_obj_yet.hasNext()) { // G_TM_M_090

                                            forceLoopbarcode_no_obj_yet = true;

                                        } // G_TM_M_090

                                    } // G_TM_M_020

                                    else { // G 20 - G 21
                                        forceLoopbarcode_no_obj_yet = true;
                                    } // G 21

                                    barcode_no_obj_yetStruct barcode_no_obj_yet = null;

                                    while ((tHash_Lookup_barcode_no_obj_yet != null
                                            && tHash_Lookup_barcode_no_obj_yet.hasNext())
                                            || forceLoopbarcode_no_obj_yet) { // G_TM_M_043

                                        // CALL close loop of lookup
                                        // 'barcode_no_obj_yet'

                                        barcode_no_obj_yetStruct fromLookup_barcode_no_obj_yet = null;
                                        barcode_no_obj_yet = barcode_no_obj_yetDefault;

                                        if (!forceLoopbarcode_no_obj_yet) { // G
                                            // 46

                                            fromLookup_barcode_no_obj_yet = tHash_Lookup_barcode_no_obj_yet
                                                    .next();

                                            if (fromLookup_barcode_no_obj_yet != null) {
                                                barcode_no_obj_yet = fromLookup_barcode_no_obj_yet;
                                            }

                                        } // G 46

                                        forceLoopbarcode_no_obj_yet = false;

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

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

                                            Var__tMap_1__Struct Var = Var__tMap_1;
                                            Var.moveID = "Barcode." + TalendDate.getDate("CCYYMMDD-hhmm") + "-"
                                                    + StringHandling.TRIM(barcode_no_obj_yet.reason_for_move)
                                                    + "." + Numeric.sequence("", 1, 1);
                                            Var.move_CSID = Guid.getUUID();
                                            Var.Talend_date = (barcode_no_obj_yet.date_time == null
                                                    || barcode_no_obj_yet.date_time.equals(""))
                                                            ? null
                                                            : (TalendDate.addDate(
                                                                    TalendDate.parseDate("MM/dd/yyyy HH:mm",
                                                                            barcode_no_obj_yet.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.trim_locrefname = StringHandling
                                                    .TRIM(barcode_no_obj_yet.loc_refname);
                                            Var.item_locref = StringHandling.TRIM(obj_IDs.objectNumber) + "->"
                                                    + StringHandling.TRIM(barcode_no_obj_yet.loc_refname)
                                                    + " : " + barcode_no_obj_yet.crate_refname;
                                            Var.trim_craterefname = StringHandling
                                                    .TRIM(barcode_no_obj_yet.crate_refname);
                                            Var.loc_reject = Relational.ISNULL(barcode_no_obj_yet.loc_refname)
                                                    || Relational.ISNULL(barcode_no_obj_yet.crate_refname);
                                            Var.handler_reject = Relational
                                                    .ISNULL(barcode_no_obj_yet.person_scanning);
                                            Var.obj_reject = Relational.ISNULL(obj_IDs.obj_CSID);
                                            Var.move2obj_CSID = Guid.getUUID();
                                            Var.obj2move_CSID = Guid.getUUID();
                                            Var.reason4move = StringHandling
                                                    .UPCASE(barcode_no_obj_yet.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

                                            out_moveXML = null;
                                            moveCSID = null;
                                            ID = null;
                                            unmatch_loc = null;
                                            move2obj_XML = null;
                                            obj2move_XML = null;

                                            // # Output table :
                                            // 'out_moveXML'
                                            out_moveXML_tmp.Item_Num = StringHandling
                                                    .TRIM(obj_IDs.objectNumber);
                                            out_moveXML_tmp.loc_refname = barcode_no_obj_yet.loc_refname;
                                            out_moveXML_tmp.loc_displayname = StringHandling
                                                    .TRIM(barcode_no_obj_yet.new_location);
                                            out_moveXML_tmp.crate_refname = barcode_no_obj_yet.crate_refname;
                                            out_moveXML_tmp.crate_displayname = barcode_no_obj_yet.current_crate;
                                            out_moveXML_tmp.loc_handler = barcode_no_obj_yet.person_refname;
                                            out_moveXML_tmp.Capture_timestamp = Var.datetimeTZ;
                                            out_moveXML_tmp.reason4move = Var.reason4move;
                                            out_moveXML_tmp.computedSummary = Var.computedSummary;
                                            out_moveXML_tmp.moveID = Var.moveID;
                                            out_moveXML_tmp.moveCSID = Var.move_CSID;
                                            out_moveXML = out_moveXML_tmp;

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

                                            // # Output table : 'ID'
                                            ID_tmp.Item_Num = StringHandling.TRIM(obj_IDs.objectNumber);
                                            ID_tmp.moveID = Var.moveID;
                                            ID_tmp.loc_reject = Var.loc_reject;
                                            ID_tmp.handler_reject = Var.handler_reject;
                                            ID_tmp.obj_reject = Var.obj_reject;
                                            ID_tmp.loc_refname = barcode_no_obj_yet.loc_refname;
                                            ID_tmp.crate_refname = barcode_no_obj_yet.crate_refname;
                                            ID_tmp.loc_handler_refname = barcode_no_obj_yet.person_refname;
                                            ID_tmp.capture_datetime = Var.datetimeTZ;
                                            ID_tmp.moveCSID = Var.move_CSID;
                                            ID_tmp.move2obj_CSID = Var.move2obj_CSID;
                                            ID_tmp.obj2move_CSID = Var.obj2move_CSID;
                                            ID = ID_tmp;

                                            // # Output table :
                                            // 'unmatch_loc'
                                            // # Filter conditions
                                            if (

                                            Var.loc_reject || Var.obj_reject || Var.handler_reject

                                            ) {
                                                unmatch_loc_tmp.Item_Num = StringHandling
                                                        .TRIM(obj_IDs.objectNumber);
                                                unmatch_loc_tmp.moveID = Var.moveID;
                                                unmatch_loc_tmp.reject_loc = Var.loc_reject;
                                                unmatch_loc_tmp.reject_handler = Var.handler_reject;
                                                unmatch_loc_tmp.reject_obj = Var.obj_reject;
                                                unmatch_loc_tmp.newLocation = barcode_no_obj_yet.new_location;
                                                unmatch_loc_tmp.currCrate = barcode_no_obj_yet.current_crate;
                                                unmatch_loc_tmp.loc_refname = barcode_no_obj_yet.loc_refname;
                                                unmatch_loc_tmp.crate_refname = barcode_no_obj_yet.crate_refname;
                                                unmatch_loc_tmp.loc_handler = barcode_no_obj_yet.person_scanning;
                                                unmatch_loc_tmp.loc_handler_refname = barcode_no_obj_yet.person_refname;
                                                unmatch_loc_tmp.Capture_timestamp = barcode_no_obj_yet.date_time;
                                                unmatch_loc = unmatch_loc_tmp;
                                            } // closing filter/reject

                                            // # Output table :
                                            // 'move2obj_XML'
                                            move2obj_XML_tmp.objectNum = StringHandling
                                                    .TRIM(obj_IDs.objectNumber);
                                            move2obj_XML_tmp.obj_CSID = obj_IDs.obj_CSID;
                                            move2obj_XML_tmp.objectDocType = "CollectionObject";
                                            move2obj_XML_tmp.moveID = Var.moveID;
                                            move2obj_XML_tmp.move_CSID = Var.move_CSID;
                                            move2obj_XML_tmp.move_URI = "/movements/" + Var.move_CSID;
                                            move2obj_XML_tmp.subjectDocType = "Movement";
                                            move2obj_XML_tmp.loc_refName = Var.trim_locrefname;
                                            move2obj_XML_tmp.move_timestamp = Var.datetimeTZ;
                                            move2obj_XML_tmp.move2obj_CSID = Var.move2obj_CSID;
                                            move2obj_XML = move2obj_XML_tmp;

                                            // # Output table :
                                            // 'obj2move_XML'
                                            obj2move_XML_tmp.objectNum = StringHandling
                                                    .TRIM(obj_IDs.objectNumber);
                                            obj2move_XML_tmp.obj_CSID = obj_IDs.obj_CSID;
                                            obj2move_XML_tmp.subjectDoctype = "CollectionObject";
                                            obj2move_XML_tmp.moveID = Var.moveID;
                                            obj2move_XML_tmp.move_CSID = Var.move_CSID;
                                            obj2move_XML_tmp.move_URI = "/movements/" + Var.move_CSID;
                                            obj2move_XML_tmp.objectDoctype = "Movement";
                                            obj2move_XML_tmp.loc_refName = Var.trim_locrefname;
                                            obj2move_XML_tmp.move_timestamp = Var.datetimeTZ;
                                            obj2move_XML_tmp.obj2move_CSID = Var.obj2move_CSID;
                                            obj2move_XML = obj2move_XML_tmp;
                                            // ###############################

                                        } // end of Var scope

                                        rejectedInnerJoin_tMap_1 = false;

                                        tos_count_tMap_1++;

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

                                            /**
                                             * [tAdvancedFileOutputXML_1
                                             * main ] start
                                             */

                                            currentComponent = "tAdvancedFileOutputXML_1";

                                            nb_line_tAFOX_1++;
                                            valueMap_tAFOX_1.clear();
                                            valueMap_tAFOX_1.put("Item_Num", (out_moveXML.Item_Num.toString()));
                                            valueMap_tAFOX_1.put("loc_refname",
                                                    (out_moveXML.loc_refname != null
                                                            ? out_moveXML.loc_refname.toString()
                                                            : null));
                                            valueMap_tAFOX_1.put("loc_displayname",
                                                    (out_moveXML.loc_displayname != null
                                                            ? out_moveXML.loc_displayname.toString()
                                                            : null));
                                            valueMap_tAFOX_1.put("crate_refname",
                                                    (out_moveXML.crate_refname != null
                                                            ? out_moveXML.crate_refname.toString()
                                                            : null));
                                            valueMap_tAFOX_1.put("crate_displayname",
                                                    (out_moveXML.crate_displayname != null
                                                            ? out_moveXML.crate_displayname.toString()
                                                            : null));
                                            valueMap_tAFOX_1.put("loc_handler",
                                                    (out_moveXML.loc_handler != null
                                                            ? out_moveXML.loc_handler.toString()
                                                            : null));
                                            valueMap_tAFOX_1.put("Capture_timestamp",
                                                    (out_moveXML.Capture_timestamp != null
                                                            ? out_moveXML.Capture_timestamp.toString()
                                                            : null));
                                            valueMap_tAFOX_1.put("reason4move",
                                                    (out_moveXML.reason4move != null
                                                            ? out_moveXML.reason4move.toString()
                                                            : null));
                                            valueMap_tAFOX_1.put("computedSummary",
                                                    (out_moveXML.computedSummary != null
                                                            ? out_moveXML.computedSummary.toString()
                                                            : null));
                                            valueMap_tAFOX_1.put("moveID", (out_moveXML.moveID.toString()));
                                            valueMap_tAFOX_1.put("moveCSID", (out_moveXML.moveCSID.toString()));
                                            org.dom4j.Element subTreeRootParent_tAFOX_1 = null;

                                            // build root xml tree
                                            if (needRoot_tAFOX_1) {
                                                needRoot_tAFOX_1 = false;
                                                if (orders_tAFOX_1.length > 0) {
                                                    orders_tAFOX_1[0] = 0;
                                                }
                                                org.dom4j.Element root_tAFOX_1 = doc_tAFOX_1
                                                        .addElement("imports");
                                                subTreeRootParent_tAFOX_1 = root_tAFOX_1;
                                                root4Group_tAFOX_1 = subTreeRootParent_tAFOX_1;
                                            } else {
                                                subTreeRootParent_tAFOX_1 = root4Group_tAFOX_1;
                                            }
                                            // build group xml tree
                                            // build loop xml tree
                                            org.dom4j.Element loop_tAFOX_1 = org.dom4j.DocumentHelper
                                                    .createElement("import");
                                            if (orders_tAFOX_1[0] == 0) {
                                                orders_tAFOX_1[0] = 0;
                                            }
                                            if (1 < orders_tAFOX_1.length) {
                                                orders_tAFOX_1[1] = 0;
                                            }
                                            subTreeRootParent_tAFOX_1.elements().add(orders_tAFOX_1[0]++,
                                                    loop_tAFOX_1);
                                            loop_tAFOX_1.addAttribute("service", "Movements");
                                            loop_tAFOX_1.addAttribute("type", "Movement");
                                            if (valueMap_tAFOX_1.get("moveCSID") != null) {
                                                loop_tAFOX_1.addAttribute("CSID",
                                                        valueMap_tAFOX_1.get("moveCSID"));
                                            }
                                            org.dom4j.Element loop_0_tAFOX_1 = loop_tAFOX_1
                                                    .addElement("schema");
                                            loop_0_tAFOX_1.addNamespace("movements_common",
                                                    TalendString.replaceSpecialCharForXML(
                                                            "http://collectionspace.org/movement/"));
                                            loop_0_tAFOX_1.addAttribute("name", "movements_common");
                                            org.dom4j.Element loop_0_0_tAFOX_1;
                                            if (loop_0_tAFOX_1
                                                    .getNamespaceForPrefix("movements_common") == null) {
                                                loop_0_0_tAFOX_1 = loop_0_tAFOX_1.addElement("movementNote");
                                            } else {
                                                loop_0_0_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("movements_common:movementNote");
                                            }
                                            loop_0_0_tAFOX_1.setName("movements_common:movementNote");
                                            org.dom4j.Element loop_0_1_tAFOX_1;
                                            if (loop_0_tAFOX_1
                                                    .getNamespaceForPrefix("movements_common") == null) {
                                                loop_0_1_tAFOX_1 = loop_0_tAFOX_1.addElement("removalDate");
                                            } else {
                                                loop_0_1_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("movements_common:removalDate");
                                            }
                                            loop_0_1_tAFOX_1.setName("movements_common:removalDate");
                                            org.dom4j.Element loop_0_2_tAFOX_1;
                                            if (loop_0_tAFOX_1
                                                    .getNamespaceForPrefix("movements_common") == null) {
                                                loop_0_2_tAFOX_1 = loop_0_tAFOX_1.addElement("reasonForMove");
                                            } else {
                                                loop_0_2_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("movements_common:reasonForMove");
                                            }
                                            if (valueMap_tAFOX_1.get("reason4move") != null) {
                                                nestXMLTool_tAFOX_1.setText(loop_0_2_tAFOX_1,
                                                        valueMap_tAFOX_1.get("reason4move"));
                                            }
                                            loop_0_2_tAFOX_1.setName("movements_common:reasonForMove");
                                            org.dom4j.Element loop_0_3_tAFOX_1;
                                            if (loop_0_tAFOX_1
                                                    .getNamespaceForPrefix("movements_common") == null) {
                                                loop_0_3_tAFOX_1 = loop_0_tAFOX_1.addElement("movementMethods");
                                            } else {
                                                loop_0_3_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("movements_common:movementMethods");
                                            }
                                            loop_0_3_tAFOX_1.setName("movements_common:movementMethods");
                                            org.dom4j.Element loop_0_3_0_tAFOX_1 = loop_0_3_tAFOX_1
                                                    .addElement("movementMethod");
                                            org.dom4j.Element loop_0_4_tAFOX_1;
                                            if (loop_0_tAFOX_1
                                                    .getNamespaceForPrefix("movements_common") == null) {
                                                loop_0_4_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("plannedRemovalDate");
                                            } else {
                                                loop_0_4_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("movements_common:plannedRemovalDate");
                                            }
                                            loop_0_4_tAFOX_1.setName("movements_common:plannedRemovalDate");
                                            org.dom4j.Element loop_0_5_tAFOX_1;
                                            if (loop_0_tAFOX_1
                                                    .getNamespaceForPrefix("movements_common") == null) {
                                                loop_0_5_tAFOX_1 = loop_0_tAFOX_1.addElement("movementContact");
                                            } else {
                                                loop_0_5_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("movements_common:movementContact");
                                            }
                                            loop_0_5_tAFOX_1.setName("movements_common:movementContact");
                                            org.dom4j.Element loop_0_6_tAFOX_1;
                                            if (loop_0_tAFOX_1
                                                    .getNamespaceForPrefix("movements_common") == null) {
                                                loop_0_6_tAFOX_1 = loop_0_tAFOX_1.addElement("normalLocation");
                                            } else {
                                                loop_0_6_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("movements_common:normalLocation");
                                            }
                                            loop_0_6_tAFOX_1.setName("movements_common:normalLocation");
                                            org.dom4j.Element loop_0_7_tAFOX_1;
                                            if (loop_0_tAFOX_1
                                                    .getNamespaceForPrefix("movements_common") == null) {
                                                loop_0_7_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("currentLocationFitness");
                                            } else {
                                                loop_0_7_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("movements_common:currentLocationFitness");
                                            }
                                            loop_0_7_tAFOX_1.setName("movements_common:currentLocationFitness");
                                            org.dom4j.Element loop_0_8_tAFOX_1;
                                            if (loop_0_tAFOX_1
                                                    .getNamespaceForPrefix("movements_common") == null) {
                                                loop_0_8_tAFOX_1 = loop_0_tAFOX_1.addElement("currentLocation");
                                            } else {
                                                loop_0_8_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("movements_common:currentLocation");
                                            }
                                            if (valueMap_tAFOX_1.get("loc_refname") != null) {
                                                nestXMLTool_tAFOX_1.setText(loop_0_8_tAFOX_1,
                                                        valueMap_tAFOX_1.get("loc_refname"));
                                            }
                                            loop_0_8_tAFOX_1.setName("movements_common:currentLocation");
                                            org.dom4j.Element loop_0_9_tAFOX_1;
                                            if (loop_0_tAFOX_1
                                                    .getNamespaceForPrefix("movements_common") == null) {
                                                loop_0_9_tAFOX_1 = loop_0_tAFOX_1.addElement("locationDate");
                                            } else {
                                                loop_0_9_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("movements_common:locationDate");
                                            }
                                            if (valueMap_tAFOX_1.get("Capture_timestamp") != null) {
                                                nestXMLTool_tAFOX_1.setText(loop_0_9_tAFOX_1,
                                                        valueMap_tAFOX_1.get("Capture_timestamp"));
                                            }
                                            loop_0_9_tAFOX_1.setName("movements_common:locationDate");
                                            org.dom4j.Element loop_0_10_tAFOX_1;
                                            if (loop_0_tAFOX_1
                                                    .getNamespaceForPrefix("movements_common") == null) {
                                                loop_0_10_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("currentLocationNote");
                                            } else {
                                                loop_0_10_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("movements_common:currentLocationNote");
                                            }
                                            if (valueMap_tAFOX_1.get("Item_Num") != null) {
                                                nestXMLTool_tAFOX_1.setText(loop_0_10_tAFOX_1,
                                                        valueMap_tAFOX_1.get("Item_Num"));
                                            }
                                            loop_0_10_tAFOX_1.setName("movements_common:currentLocationNote");
                                            org.dom4j.Element loop_0_11_tAFOX_1;
                                            if (loop_0_tAFOX_1
                                                    .getNamespaceForPrefix("movements_common") == null) {
                                                loop_0_11_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("movementReferenceNumber");
                                            } else {
                                                loop_0_11_tAFOX_1 = loop_0_tAFOX_1
                                                        .addElement("movements_common:movementReferenceNumber");
                                            }
                                            if (valueMap_tAFOX_1.get("moveID") != null) {
                                                nestXMLTool_tAFOX_1.setText(loop_0_11_tAFOX_1,
                                                        valueMap_tAFOX_1.get("moveID"));
                                            }
                                            loop_0_11_tAFOX_1
                                                    .setName("movements_common:movementReferenceNumber");
                                            org.dom4j.Element loop_1_tAFOX_1 = loop_tAFOX_1
                                                    .addElement("schema2");
                                            loop_1_tAFOX_1.addNamespace("movements_anthropology",
                                                    TalendString.replaceSpecialCharForXML(
                                                            "http://collectionspace.org/services/movement/domain/anthropology"));
                                            loop_1_tAFOX_1.addAttribute("name", "movements_anthropology");
                                            org.dom4j.Element loop_1_0_tAFOX_1;
                                            if (loop_1_tAFOX_1
                                                    .getNamespaceForPrefix("movements_anthropology") == null) {
                                                loop_1_0_tAFOX_1 = loop_1_tAFOX_1
                                                        .addElement("locationHandlers");
                                            } else {
                                                loop_1_0_tAFOX_1 = loop_1_tAFOX_1
                                                        .addElement("movements_anthropology:locationHandlers");
                                            }
                                            loop_1_0_tAFOX_1.setName("movements_anthropology:locationHandlers");
                                            org.dom4j.Element loop_1_0_0_tAFOX_1 = loop_1_0_tAFOX_1
                                                    .addElement("locationHandler");
                                            if (valueMap_tAFOX_1.get("loc_handler") != null) {
                                                nestXMLTool_tAFOX_1.setText(loop_1_0_0_tAFOX_1,
                                                        valueMap_tAFOX_1.get("loc_handler"));
                                            }
                                            org.dom4j.Element loop_1_1_tAFOX_1;
                                            if (loop_1_tAFOX_1
                                                    .getNamespaceForPrefix("movements_anthropology") == null) {
                                                loop_1_1_tAFOX_1 = loop_1_tAFOX_1.addElement("crate");
                                            } else {
                                                loop_1_1_tAFOX_1 = loop_1_tAFOX_1
                                                        .addElement("movements_anthropology:crate");
                                            }
                                            if (valueMap_tAFOX_1.get("crate_refname") != null) {
                                                nestXMLTool_tAFOX_1.setText(loop_1_1_tAFOX_1,
                                                        valueMap_tAFOX_1.get("crate_refname"));
                                            }
                                            loop_1_1_tAFOX_1.setName("movements_anthropology:crate");
                                            org.dom4j.Element loop_1_2_tAFOX_1;
                                            if (loop_1_tAFOX_1
                                                    .getNamespaceForPrefix("movements_anthropology") == null) {
                                                loop_1_2_tAFOX_1 = loop_1_tAFOX_1.addElement("computedSummary");
                                            } else {
                                                loop_1_2_tAFOX_1 = loop_1_tAFOX_1
                                                        .addElement("movements_anthropology:computedSummary");
                                            }
                                            if (valueMap_tAFOX_1.get("computedSummary") != null) {
                                                nestXMLTool_tAFOX_1.setText(loop_1_2_tAFOX_1,
                                                        valueMap_tAFOX_1.get("computedSummary"));
                                            }
                                            loop_1_2_tAFOX_1.setName("movements_anthropology:computedSummary");

                                            tos_count_tAdvancedFileOutputXML_1++;

                                            /**
                                             * [tAdvancedFileOutputXML_1
                                             * main ] stop
                                             */

                                        } // End of branch "out_moveXML"

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

                                            /**
                                             * [tFileOutputDelimited_1 main
                                             * ] start
                                             */

                                            currentComponent = "tFileOutputDelimited_1";

                                            StringBuilder sb_tFileOutputDelimited_1 = new StringBuilder();

                                            if (moveCSID.moveCSID != null) {

                                                sb_tFileOutputDelimited_1.append(

                                                        moveCSID.moveCSID

                                                );

                                            }

                                            sb_tFileOutputDelimited_1
                                                    .append(OUT_DELIM_ROWSEP_tFileOutputDelimited_1);

                                            nb_line_tFileOutputDelimited_1++;

                                            outtFileOutputDelimited_1
                                                    .write(sb_tFileOutputDelimited_1.toString());

                                            tos_count_tFileOutputDelimited_1++;

                                            /**
                                             * [tFileOutputDelimited_1 main
                                             * ] stop
                                             */

                                        } // End of branch "moveCSID"

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

                                            /**
                                             * [tFileOutputDelimited_5 main
                                             * ] start
                                             */

                                            currentComponent = "tFileOutputDelimited_5";

                                            StringBuilder sb_tFileOutputDelimited_5 = new StringBuilder();

                                            if (ID.Item_Num != null) {

                                                sb_tFileOutputDelimited_5.append(

                                                        ID.Item_Num

                                                );

                                            }

                                            sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                            if (ID.moveID != null) {

                                                sb_tFileOutputDelimited_5.append(

                                                        ID.moveID

                                                );

                                            }

                                            sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                            if (ID.loc_reject != null) {

                                                sb_tFileOutputDelimited_5.append(

                                                        ID.loc_reject

                                                );

                                            }

                                            sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                            if (ID.handler_reject != null) {

                                                sb_tFileOutputDelimited_5.append(

                                                        ID.handler_reject

                                                );

                                            }

                                            sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                            if (ID.obj_reject != null) {

                                                sb_tFileOutputDelimited_5.append(

                                                        ID.obj_reject

                                                );

                                            }

                                            sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                            if (ID.loc_refname != null) {

                                                sb_tFileOutputDelimited_5.append(

                                                        ID.loc_refname

                                                );

                                            }

                                            sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                            if (ID.crate_refname != null) {

                                                sb_tFileOutputDelimited_5.append(

                                                        ID.crate_refname

                                                );

                                            }

                                            sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                            if (ID.loc_handler_refname != null) {

                                                sb_tFileOutputDelimited_5.append(

                                                        ID.loc_handler_refname

                                                );

                                            }

                                            sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                            if (ID.capture_datetime != null) {

                                                sb_tFileOutputDelimited_5.append(

                                                        ID.capture_datetime

                                                );

                                            }

                                            sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                            if (ID.moveCSID != null) {

                                                sb_tFileOutputDelimited_5.append(

                                                        ID.moveCSID

                                                );

                                            }

                                            sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                            if (ID.move2obj_CSID != null) {

                                                sb_tFileOutputDelimited_5.append(

                                                        ID.move2obj_CSID

                                                );

                                            }

                                            sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                            if (ID.obj2move_CSID != null) {

                                                sb_tFileOutputDelimited_5.append(

                                                        ID.obj2move_CSID

                                                );

                                            }

                                            sb_tFileOutputDelimited_5
                                                    .append(OUT_DELIM_ROWSEP_tFileOutputDelimited_5);

                                            nb_line_tFileOutputDelimited_5++;

                                            outtFileOutputDelimited_5
                                                    .write(sb_tFileOutputDelimited_5.toString());

                                            tos_count_tFileOutputDelimited_5++;

                                            /**
                                             * [tFileOutputDelimited_5 main
                                             * ] stop
                                             */

                                        } // End of branch "ID"

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

                                            /**
                                             * [tFileOutputDelimited_4 main
                                             * ] start
                                             */

                                            currentComponent = "tFileOutputDelimited_4";

                                            StringBuilder sb_tFileOutputDelimited_4 = new StringBuilder();

                                            if (unmatch_loc.Item_Num != null) {

                                                sb_tFileOutputDelimited_4.append(

                                                        unmatch_loc.Item_Num

                                                );

                                            }

                                            sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                            if (unmatch_loc.moveID != null) {

                                                sb_tFileOutputDelimited_4.append(

                                                        unmatch_loc.moveID

                                                );

                                            }

                                            sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                            sb_tFileOutputDelimited_4.append(

                                                    unmatch_loc.reject_loc

                                            );

                                            sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                            if (unmatch_loc.reject_handler != null) {

                                                sb_tFileOutputDelimited_4.append(

                                                        unmatch_loc.reject_handler

                                                );

                                            }

                                            sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                            if (unmatch_loc.reject_obj != null) {

                                                sb_tFileOutputDelimited_4.append(

                                                        unmatch_loc.reject_obj

                                                );

                                            }

                                            sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                            if (unmatch_loc.newLocation != null) {

                                                sb_tFileOutputDelimited_4.append(

                                                        unmatch_loc.newLocation

                                                );

                                            }

                                            sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                            if (unmatch_loc.currCrate != null) {

                                                sb_tFileOutputDelimited_4.append(

                                                        unmatch_loc.currCrate

                                                );

                                            }

                                            sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                            if (unmatch_loc.loc_refname != null) {

                                                sb_tFileOutputDelimited_4.append(

                                                        unmatch_loc.loc_refname

                                                );

                                            }

                                            sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                            if (unmatch_loc.crate_refname != null) {

                                                sb_tFileOutputDelimited_4.append(

                                                        unmatch_loc.crate_refname

                                                );

                                            }

                                            sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                            if (unmatch_loc.loc_handler != null) {

                                                sb_tFileOutputDelimited_4.append(

                                                        unmatch_loc.loc_handler

                                                );

                                            }

                                            sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                            if (unmatch_loc.loc_handler_refname != null) {

                                                sb_tFileOutputDelimited_4.append(

                                                        unmatch_loc.loc_handler_refname

                                                );

                                            }

                                            sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                            if (unmatch_loc.Capture_timestamp != null) {

                                                sb_tFileOutputDelimited_4.append(

                                                        unmatch_loc.Capture_timestamp

                                                );

                                            }

                                            sb_tFileOutputDelimited_4
                                                    .append(OUT_DELIM_ROWSEP_tFileOutputDelimited_4);

                                            nb_line_tFileOutputDelimited_4++;

                                            outtFileOutputDelimited_4
                                                    .write(sb_tFileOutputDelimited_4.toString());

                                            tos_count_tFileOutputDelimited_4++;

                                            /**
                                             * [tFileOutputDelimited_4 main
                                             * ] stop
                                             */

                                        } // End of branch "unmatch_loc"

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

                                            /**
                                             * [tAdvancedFileOutputXML_2
                                             * main ] start
                                             */

                                            currentComponent = "tAdvancedFileOutputXML_2";

                                            nb_line_tAFOX_2++;
                                            valueMap_tAFOX_2.clear();
                                            valueMap_tAFOX_2.put("objectNum",
                                                    (move2obj_XML.objectNum != null
                                                            ? move2obj_XML.objectNum.toString()
                                                            : null));
                                            valueMap_tAFOX_2.put("obj_CSID",
                                                    (move2obj_XML.obj_CSID != null
                                                            ? move2obj_XML.obj_CSID.toString()
                                                            : null));
                                            valueMap_tAFOX_2.put("objectDocType",
                                                    (move2obj_XML.objectDocType != null
                                                            ? move2obj_XML.objectDocType.toString()
                                                            : null));
                                            valueMap_tAFOX_2.put("moveID",
                                                    (move2obj_XML.moveID != null
                                                            ? move2obj_XML.moveID.toString()
                                                            : null));
                                            valueMap_tAFOX_2.put("move_CSID",
                                                    (move2obj_XML.move_CSID != null
                                                            ? move2obj_XML.move_CSID.toString()
                                                            : null));
                                            valueMap_tAFOX_2.put("move_URI",
                                                    (move2obj_XML.move_URI != null
                                                            ? move2obj_XML.move_URI.toString()
                                                            : null));
                                            valueMap_tAFOX_2.put("subjectDocType",
                                                    (move2obj_XML.subjectDocType != null
                                                            ? move2obj_XML.subjectDocType.toString()
                                                            : null));
                                            valueMap_tAFOX_2.put("loc_refName",
                                                    (move2obj_XML.loc_refName != null
                                                            ? move2obj_XML.loc_refName.toString()
                                                            : null));
                                            valueMap_tAFOX_2.put("move_timestamp",
                                                    (move2obj_XML.move_timestamp != null
                                                            ? move2obj_XML.move_timestamp.toString()
                                                            : null));
                                            valueMap_tAFOX_2.put("move2obj_CSID",
                                                    (move2obj_XML.move2obj_CSID.toString()));
                                            org.dom4j.Element subTreeRootParent_tAFOX_2 = null;

                                            // build root xml tree
                                            if (needRoot_tAFOX_2) {
                                                needRoot_tAFOX_2 = false;
                                                if (orders_tAFOX_2.length > 0) {
                                                    orders_tAFOX_2[0] = 0;
                                                }
                                                org.dom4j.Element root_tAFOX_2 = doc_tAFOX_2
                                                        .addElement("imports");
                                                subTreeRootParent_tAFOX_2 = root_tAFOX_2;
                                                root4Group_tAFOX_2 = subTreeRootParent_tAFOX_2;
                                            } else {
                                                subTreeRootParent_tAFOX_2 = root4Group_tAFOX_2;
                                            }
                                            // build group xml tree
                                            // build loop xml tree
                                            org.dom4j.Element loop_tAFOX_2 = org.dom4j.DocumentHelper
                                                    .createElement("import");
                                            if (orders_tAFOX_2[0] == 0) {
                                                orders_tAFOX_2[0] = 0;
                                            }
                                            if (1 < orders_tAFOX_2.length) {
                                                orders_tAFOX_2[1] = 0;
                                            }
                                            subTreeRootParent_tAFOX_2.elements().add(orders_tAFOX_2[0]++,
                                                    loop_tAFOX_2);
                                            loop_tAFOX_2.addAttribute("service", "Relations");
                                            loop_tAFOX_2.addAttribute("type", "Relation");
                                            if (valueMap_tAFOX_2.get("move2obj_CSID") != null) {
                                                loop_tAFOX_2.addAttribute("CSID",
                                                        valueMap_tAFOX_2.get("move2obj_CSID"));
                                            }
                                            org.dom4j.Element loop_0_tAFOX_2 = loop_tAFOX_2
                                                    .addElement("schema");
                                            loop_0_tAFOX_2.addNamespace("relations_common",
                                                    TalendString.replaceSpecialCharForXML(
                                                            "http://collectionspace.org/relation"));
                                            loop_0_tAFOX_2.addAttribute("name", "relations_common");
                                            org.dom4j.Element loop_0_0_tAFOX_2;
                                            if (loop_0_tAFOX_2
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_0_tAFOX_2 = loop_0_tAFOX_2
                                                        .addElement("relationshipType");
                                            } else {
                                                loop_0_0_tAFOX_2 = loop_0_tAFOX_2
                                                        .addElement("relations_common:relationshipType");
                                            }
                                            nestXMLTool_tAFOX_2.parseAndAdd(loop_0_0_tAFOX_2, "affects");

                                            loop_0_0_tAFOX_2.setName("relations_common:relationshipType");
                                            org.dom4j.Element loop_0_1_tAFOX_2;
                                            if (loop_0_tAFOX_2
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_1_tAFOX_2 = loop_0_tAFOX_2.addElement("subjectCsid");
                                            } else {
                                                loop_0_1_tAFOX_2 = loop_0_tAFOX_2
                                                        .addElement("relations_common:subjectCsid");
                                            }
                                            if (valueMap_tAFOX_2.get("move_CSID") != null) {
                                                nestXMLTool_tAFOX_2.setText(loop_0_1_tAFOX_2,
                                                        valueMap_tAFOX_2.get("move_CSID"));
                                            }
                                            loop_0_1_tAFOX_2.setName("relations_common:subjectCsid");
                                            org.dom4j.Element loop_0_2_tAFOX_2;
                                            if (loop_0_tAFOX_2
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_2_tAFOX_2 = loop_0_tAFOX_2
                                                        .addElement("subjectDocumentType");
                                            } else {
                                                loop_0_2_tAFOX_2 = loop_0_tAFOX_2
                                                        .addElement("relations_common:subjectDocumentType");
                                            }
                                            if (valueMap_tAFOX_2.get("subjectDocType") != null) {
                                                nestXMLTool_tAFOX_2.setText(loop_0_2_tAFOX_2,
                                                        valueMap_tAFOX_2.get("subjectDocType"));
                                            }
                                            loop_0_2_tAFOX_2.setName("relations_common:subjectDocumentType");
                                            org.dom4j.Element loop_0_3_tAFOX_2;
                                            if (loop_0_tAFOX_2
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_3_tAFOX_2 = loop_0_tAFOX_2.addElement("subjectUri");
                                            } else {
                                                loop_0_3_tAFOX_2 = loop_0_tAFOX_2
                                                        .addElement("relations_common:subjectUri");
                                            }
                                            if (valueMap_tAFOX_2.get("move_URI") != null) {
                                                nestXMLTool_tAFOX_2.setText(loop_0_3_tAFOX_2,
                                                        valueMap_tAFOX_2.get("move_URI"));
                                            }
                                            loop_0_3_tAFOX_2.setName("relations_common:subjectUri");
                                            org.dom4j.Element loop_0_4_tAFOX_2;
                                            if (loop_0_tAFOX_2
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_4_tAFOX_2 = loop_0_tAFOX_2
                                                        .addElement("predicateDisplayName");
                                            } else {
                                                loop_0_4_tAFOX_2 = loop_0_tAFOX_2
                                                        .addElement("relations_common:predicateDisplayName");
                                            }
                                            loop_0_4_tAFOX_2.setName("relations_common:predicateDisplayName");
                                            org.dom4j.Element loop_0_5_tAFOX_2;
                                            if (loop_0_tAFOX_2
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_5_tAFOX_2 = loop_0_tAFOX_2.addElement("predicate");
                                            } else {
                                                loop_0_5_tAFOX_2 = loop_0_tAFOX_2
                                                        .addElement("relations_common:predicate");
                                            }
                                            loop_0_5_tAFOX_2.setName("relations_common:predicate");
                                            org.dom4j.Element loop_0_6_tAFOX_2;
                                            if (loop_0_tAFOX_2
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_6_tAFOX_2 = loop_0_tAFOX_2.addElement("objectCsid");
                                            } else {
                                                loop_0_6_tAFOX_2 = loop_0_tAFOX_2
                                                        .addElement("relations_common:objectCsid");
                                            }
                                            if (valueMap_tAFOX_2.get("obj_CSID") != null) {
                                                nestXMLTool_tAFOX_2.setText(loop_0_6_tAFOX_2,
                                                        valueMap_tAFOX_2.get("obj_CSID"));
                                            }
                                            loop_0_6_tAFOX_2.setName("relations_common:objectCsid");
                                            org.dom4j.Element loop_0_7_tAFOX_2;
                                            if (loop_0_tAFOX_2
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_7_tAFOX_2 = loop_0_tAFOX_2.addElement("objectUri");
                                            } else {
                                                loop_0_7_tAFOX_2 = loop_0_tAFOX_2
                                                        .addElement("relations_common:objectUri");
                                            }
                                            loop_0_7_tAFOX_2.setName("relations_common:objectUri");
                                            org.dom4j.Element loop_0_8_tAFOX_2;
                                            if (loop_0_tAFOX_2
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_8_tAFOX_2 = loop_0_tAFOX_2.addElement("objectRefName");
                                            } else {
                                                loop_0_8_tAFOX_2 = loop_0_tAFOX_2
                                                        .addElement("relations_common:objectRefName");
                                            }
                                            loop_0_8_tAFOX_2.setName("relations_common:objectRefName");
                                            org.dom4j.Element loop_0_9_tAFOX_2;
                                            if (loop_0_tAFOX_2
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_9_tAFOX_2 = loop_0_tAFOX_2.addElement("subjectRefName");
                                            } else {
                                                loop_0_9_tAFOX_2 = loop_0_tAFOX_2
                                                        .addElement("relations_common:subjectRefName");
                                            }
                                            loop_0_9_tAFOX_2.setName("relations_common:subjectRefName");
                                            org.dom4j.Element loop_0_10_tAFOX_2;
                                            if (loop_0_tAFOX_2
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_10_tAFOX_2 = loop_0_tAFOX_2
                                                        .addElement("objectDocumentType");
                                            } else {
                                                loop_0_10_tAFOX_2 = loop_0_tAFOX_2
                                                        .addElement("relations_common:objectDocumentType");
                                            }
                                            if (valueMap_tAFOX_2.get("objectDocType") != null) {
                                                nestXMLTool_tAFOX_2.setText(loop_0_10_tAFOX_2,
                                                        valueMap_tAFOX_2.get("objectDocType"));
                                            }
                                            loop_0_10_tAFOX_2.setName("relations_common:objectDocumentType");

                                            tos_count_tAdvancedFileOutputXML_2++;

                                            /**
                                             * [tAdvancedFileOutputXML_2
                                             * main ] stop
                                             */

                                        } // End of branch "move2obj_XML"

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

                                            /**
                                             * [tAdvancedFileOutputXML_3
                                             * main ] start
                                             */

                                            currentComponent = "tAdvancedFileOutputXML_3";

                                            nb_line_tAFOX_3++;
                                            valueMap_tAFOX_3.clear();
                                            valueMap_tAFOX_3.put("objectNum",
                                                    (obj2move_XML.objectNum != null
                                                            ? obj2move_XML.objectNum.toString()
                                                            : null));
                                            valueMap_tAFOX_3.put("obj_CSID",
                                                    (obj2move_XML.obj_CSID != null
                                                            ? obj2move_XML.obj_CSID.toString()
                                                            : null));
                                            valueMap_tAFOX_3.put("subjectDoctype",
                                                    (obj2move_XML.subjectDoctype != null
                                                            ? obj2move_XML.subjectDoctype.toString()
                                                            : null));
                                            valueMap_tAFOX_3.put("moveID",
                                                    (obj2move_XML.moveID != null
                                                            ? obj2move_XML.moveID.toString()
                                                            : null));
                                            valueMap_tAFOX_3.put("move_CSID",
                                                    (obj2move_XML.move_CSID != null
                                                            ? obj2move_XML.move_CSID.toString()
                                                            : null));
                                            valueMap_tAFOX_3.put("move_URI",
                                                    (obj2move_XML.move_URI != null
                                                            ? obj2move_XML.move_URI.toString()
                                                            : null));
                                            valueMap_tAFOX_3.put("objectDoctype",
                                                    (obj2move_XML.objectDoctype != null
                                                            ? obj2move_XML.objectDoctype.toString()
                                                            : null));
                                            valueMap_tAFOX_3.put("loc_refName",
                                                    (obj2move_XML.loc_refName != null
                                                            ? obj2move_XML.loc_refName.toString()
                                                            : null));
                                            valueMap_tAFOX_3.put("move_timestamp",
                                                    (obj2move_XML.move_timestamp != null
                                                            ? obj2move_XML.move_timestamp.toString()
                                                            : null));
                                            valueMap_tAFOX_3.put("obj2move_CSID",
                                                    (obj2move_XML.obj2move_CSID.toString()));
                                            org.dom4j.Element subTreeRootParent_tAFOX_3 = null;

                                            // build root xml tree
                                            if (needRoot_tAFOX_3) {
                                                needRoot_tAFOX_3 = false;
                                                if (orders_tAFOX_3.length > 0) {
                                                    orders_tAFOX_3[0] = 0;
                                                }
                                                org.dom4j.Element root_tAFOX_3 = doc_tAFOX_3
                                                        .addElement("imports");
                                                subTreeRootParent_tAFOX_3 = root_tAFOX_3;
                                                root4Group_tAFOX_3 = subTreeRootParent_tAFOX_3;
                                            } else {
                                                subTreeRootParent_tAFOX_3 = root4Group_tAFOX_3;
                                            }
                                            // build group xml tree
                                            // build loop xml tree
                                            org.dom4j.Element loop_tAFOX_3 = org.dom4j.DocumentHelper
                                                    .createElement("import");
                                            if (orders_tAFOX_3[0] == 0) {
                                                orders_tAFOX_3[0] = 0;
                                            }
                                            if (1 < orders_tAFOX_3.length) {
                                                orders_tAFOX_3[1] = 0;
                                            }
                                            subTreeRootParent_tAFOX_3.elements().add(orders_tAFOX_3[0]++,
                                                    loop_tAFOX_3);
                                            loop_tAFOX_3.addAttribute("service", "Relations");
                                            loop_tAFOX_3.addAttribute("type", "Relation");
                                            if (valueMap_tAFOX_3.get("obj2move_CSID") != null) {
                                                loop_tAFOX_3.addAttribute("CSID",
                                                        valueMap_tAFOX_3.get("obj2move_CSID"));
                                            }
                                            org.dom4j.Element loop_0_tAFOX_3 = loop_tAFOX_3
                                                    .addElement("schema");
                                            loop_0_tAFOX_3.addNamespace("relations_common",
                                                    TalendString.replaceSpecialCharForXML(
                                                            "http://collectionspace.org/relation"));
                                            loop_0_tAFOX_3.addAttribute("name", "relations_common");
                                            org.dom4j.Element loop_0_0_tAFOX_3;
                                            if (loop_0_tAFOX_3
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_0_tAFOX_3 = loop_0_tAFOX_3
                                                        .addElement("relationshipType");
                                            } else {
                                                loop_0_0_tAFOX_3 = loop_0_tAFOX_3
                                                        .addElement("relations_common:relationshipType");
                                            }
                                            nestXMLTool_tAFOX_3.parseAndAdd(loop_0_0_tAFOX_3, "affects");

                                            loop_0_0_tAFOX_3.setName("relations_common:relationshipType");
                                            org.dom4j.Element loop_0_1_tAFOX_3;
                                            if (loop_0_tAFOX_3
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_1_tAFOX_3 = loop_0_tAFOX_3.addElement("subjectCsid");
                                            } else {
                                                loop_0_1_tAFOX_3 = loop_0_tAFOX_3
                                                        .addElement("relations_common:subjectCsid");
                                            }
                                            if (valueMap_tAFOX_3.get("obj_CSID") != null) {
                                                nestXMLTool_tAFOX_3.setText(loop_0_1_tAFOX_3,
                                                        valueMap_tAFOX_3.get("obj_CSID"));
                                            }
                                            loop_0_1_tAFOX_3.setName("relations_common:subjectCsid");
                                            org.dom4j.Element loop_0_2_tAFOX_3;
                                            if (loop_0_tAFOX_3
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_2_tAFOX_3 = loop_0_tAFOX_3
                                                        .addElement("subjectDocumentType");
                                            } else {
                                                loop_0_2_tAFOX_3 = loop_0_tAFOX_3
                                                        .addElement("relations_common:subjectDocumentType");
                                            }
                                            if (valueMap_tAFOX_3.get("subjectDoctype") != null) {
                                                nestXMLTool_tAFOX_3.setText(loop_0_2_tAFOX_3,
                                                        valueMap_tAFOX_3.get("subjectDoctype"));
                                            }
                                            loop_0_2_tAFOX_3.setName("relations_common:subjectDocumentType");
                                            org.dom4j.Element loop_0_3_tAFOX_3;
                                            if (loop_0_tAFOX_3
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_3_tAFOX_3 = loop_0_tAFOX_3.addElement("subjectUri");
                                            } else {
                                                loop_0_3_tAFOX_3 = loop_0_tAFOX_3
                                                        .addElement("relations_common:subjectUri");
                                            }
                                            loop_0_3_tAFOX_3.setName("relations_common:subjectUri");
                                            org.dom4j.Element loop_0_4_tAFOX_3;
                                            if (loop_0_tAFOX_3
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_4_tAFOX_3 = loop_0_tAFOX_3
                                                        .addElement("predicateDisplayName");
                                            } else {
                                                loop_0_4_tAFOX_3 = loop_0_tAFOX_3
                                                        .addElement("relations_common:predicateDisplayName");
                                            }
                                            loop_0_4_tAFOX_3.setName("relations_common:predicateDisplayName");
                                            org.dom4j.Element loop_0_5_tAFOX_3;
                                            if (loop_0_tAFOX_3
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_5_tAFOX_3 = loop_0_tAFOX_3.addElement("predicate");
                                            } else {
                                                loop_0_5_tAFOX_3 = loop_0_tAFOX_3
                                                        .addElement("relations_common:predicate");
                                            }
                                            loop_0_5_tAFOX_3.setName("relations_common:predicate");
                                            org.dom4j.Element loop_0_6_tAFOX_3;
                                            if (loop_0_tAFOX_3
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_6_tAFOX_3 = loop_0_tAFOX_3.addElement("objectCsid");
                                            } else {
                                                loop_0_6_tAFOX_3 = loop_0_tAFOX_3
                                                        .addElement("relations_common:objectCsid");
                                            }
                                            if (valueMap_tAFOX_3.get("move_CSID") != null) {
                                                nestXMLTool_tAFOX_3.setText(loop_0_6_tAFOX_3,
                                                        valueMap_tAFOX_3.get("move_CSID"));
                                            }
                                            loop_0_6_tAFOX_3.setName("relations_common:objectCsid");
                                            org.dom4j.Element loop_0_7_tAFOX_3;
                                            if (loop_0_tAFOX_3
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_7_tAFOX_3 = loop_0_tAFOX_3.addElement("objectUri");
                                            } else {
                                                loop_0_7_tAFOX_3 = loop_0_tAFOX_3
                                                        .addElement("relations_common:objectUri");
                                            }
                                            if (valueMap_tAFOX_3.get("move_URI") != null) {
                                                nestXMLTool_tAFOX_3.setText(loop_0_7_tAFOX_3,
                                                        valueMap_tAFOX_3.get("move_URI"));
                                            }
                                            loop_0_7_tAFOX_3.setName("relations_common:objectUri");
                                            org.dom4j.Element loop_0_8_tAFOX_3;
                                            if (loop_0_tAFOX_3
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_8_tAFOX_3 = loop_0_tAFOX_3.addElement("objectRefName");
                                            } else {
                                                loop_0_8_tAFOX_3 = loop_0_tAFOX_3
                                                        .addElement("relations_common:objectRefName");
                                            }
                                            loop_0_8_tAFOX_3.setName("relations_common:objectRefName");
                                            org.dom4j.Element loop_0_9_tAFOX_3;
                                            if (loop_0_tAFOX_3
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_9_tAFOX_3 = loop_0_tAFOX_3.addElement("subjectRefName");
                                            } else {
                                                loop_0_9_tAFOX_3 = loop_0_tAFOX_3
                                                        .addElement("relations_common:subjectRefName");
                                            }
                                            loop_0_9_tAFOX_3.setName("relations_common:subjectRefName");
                                            org.dom4j.Element loop_0_10_tAFOX_3;
                                            if (loop_0_tAFOX_3
                                                    .getNamespaceForPrefix("relations_common") == null) {
                                                loop_0_10_tAFOX_3 = loop_0_tAFOX_3
                                                        .addElement("objectDocumentType");
                                            } else {
                                                loop_0_10_tAFOX_3 = loop_0_tAFOX_3
                                                        .addElement("relations_common:objectDocumentType");
                                            }
                                            if (valueMap_tAFOX_3.get("objectDoctype") != null) {
                                                nestXMLTool_tAFOX_3.setText(loop_0_10_tAFOX_3,
                                                        valueMap_tAFOX_3.get("objectDoctype"));
                                            }
                                            loop_0_10_tAFOX_3.setName("relations_common:objectDocumentType");

                                            tos_count_tAdvancedFileOutputXML_3++;

                                            /**
                                             * [tAdvancedFileOutputXML_3
                                             * main ] stop
                                             */

                                        } // End of branch "obj2move_XML"

                                    } // close loop of lookup
                                      // 'barcode_no_obj_yet' //
                                      // G_TM_M_043

                                } // End of branch "obj_IDs"

                                /**
                                 * [tFileInputDelimited_10 end ] start
                                 */

                                currentComponent = "tFileInputDelimited_10";

                            }
                        } finally {
                            if (!((Object) ("/tmp/all_crateObj.tab." + TalendDate.getDate("CCYY-MM-DD") + "-"
                                    + context.infile_min) instanceof java.io.InputStream)) {
                                if (fid_tFileInputDelimited_10 != null) {
                                    fid_tFileInputDelimited_10.close();
                                }
                            }
                            if (fid_tFileInputDelimited_10 != null) {
                                globalMap.put("tFileInputDelimited_10_NB_LINE",
                                        fid_tFileInputDelimited_10.getRowNumber());
                            }
                        }

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

                        /**
                         * [tFileInputDelimited_10 end ] stop
                         */

                        /**
                         * [tMap_1 end ] start
                         */

                        currentComponent = "tMap_1";

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

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

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

                        /**
                         * [tMap_1 end ] stop
                         */

                        /**
                         * [tAdvancedFileOutputXML_3 end ] start
                         */

                        currentComponent = "tAdvancedFileOutputXML_3";

                        java.io.FileOutputStream stream_tAFOX_3 = new java.io.FileOutputStream(
                                fileName_tAFOX_3);
                        org.dom4j.io.XMLWriter output_tAFOX_3 = new org.dom4j.io.XMLWriter(stream_tAFOX_3,
                                format_tAFOX_3);
                        if (doc_tAFOX_3.getRootElement() != null) {
                            nestXMLTool_tAFOX_3.replaceDefaultNameSpace(doc_tAFOX_3.getRootElement());
                            output_tAFOX_3.write(doc_tAFOX_3);
                        }
                        output_tAFOX_3.close();
                        globalMap.put("tAdvancedFileOutputXML_3_NB_LINE", nb_line_tAFOX_3);

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

                        /**
                         * [tAdvancedFileOutputXML_3 end ] stop
                         */

                        /**
                         * [tAdvancedFileOutputXML_2 end ] start
                         */

                        currentComponent = "tAdvancedFileOutputXML_2";

                        java.io.FileOutputStream stream_tAFOX_2 = new java.io.FileOutputStream(
                                fileName_tAFOX_2);
                        org.dom4j.io.XMLWriter output_tAFOX_2 = new org.dom4j.io.XMLWriter(stream_tAFOX_2,
                                format_tAFOX_2);
                        if (doc_tAFOX_2.getRootElement() != null) {
                            nestXMLTool_tAFOX_2.replaceDefaultNameSpace(doc_tAFOX_2.getRootElement());
                            output_tAFOX_2.write(doc_tAFOX_2);
                        }
                        output_tAFOX_2.close();
                        globalMap.put("tAdvancedFileOutputXML_2_NB_LINE", nb_line_tAFOX_2);

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

                        /**
                         * [tAdvancedFileOutputXML_2 end ] stop
                         */

                        /**
                         * [tFileOutputDelimited_4 end ] start
                         */

                        currentComponent = "tFileOutputDelimited_4";

                    } finally {
                        if (outtFileOutputDelimited_4 != null) {
                            outtFileOutputDelimited_4.flush();
                            outtFileOutputDelimited_4.close();
                        }
                        globalMap.put("tFileOutputDelimited_4_NB_LINE", nb_line_tFileOutputDelimited_4);
                        globalMap.put("tFileOutputDelimited_4_FILE_NAME", fileName_tFileOutputDelimited_4);
                    } // finally

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

                    /**
                     * [tFileOutputDelimited_4 end ] stop
                     */

                    /**
                     * [tFileOutputDelimited_5 end ] start
                     */

                    currentComponent = "tFileOutputDelimited_5";

                } finally {
                    if (outtFileOutputDelimited_5 != null) {
                        outtFileOutputDelimited_5.flush();
                        outtFileOutputDelimited_5.close();
                    }
                    globalMap.put("tFileOutputDelimited_5_NB_LINE", nb_line_tFileOutputDelimited_5);
                    globalMap.put("tFileOutputDelimited_5_FILE_NAME", fileName_tFileOutputDelimited_5);
                } // finally

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

                /**
                 * [tFileOutputDelimited_5 end ] stop
                 */

                /**
                 * [tFileOutputDelimited_1 end ] start
                 */

                currentComponent = "tFileOutputDelimited_1";

            } finally {
                if (outtFileOutputDelimited_1 != null) {
                    outtFileOutputDelimited_1.flush();
                    outtFileOutputDelimited_1.close();
                }
                globalMap.put("tFileOutputDelimited_1_NB_LINE", nb_line_tFileOutputDelimited_1);
                globalMap.put("tFileOutputDelimited_1_FILE_NAME", fileName_tFileOutputDelimited_1);
            } // finally

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

            /**
             * [tFileOutputDelimited_1 end ] stop
             */

            /**
             * [tAdvancedFileOutputXML_1 end ] start
             */

            currentComponent = "tAdvancedFileOutputXML_1";

            java.io.FileOutputStream stream_tAFOX_1 = new java.io.FileOutputStream(fileName_tAFOX_1);
            org.dom4j.io.XMLWriter output_tAFOX_1 = new org.dom4j.io.XMLWriter(stream_tAFOX_1, format_tAFOX_1);
            if (doc_tAFOX_1.getRootElement() != null) {
                nestXMLTool_tAFOX_1.replaceDefaultNameSpace(doc_tAFOX_1.getRootElement());
                output_tAFOX_1.write(doc_tAFOX_1);
            }
            output_tAFOX_1.close();
            globalMap.put("tAdvancedFileOutputXML_1_NB_LINE", nb_line_tAFOX_1);

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

            /**
             * [tAdvancedFileOutputXML_1 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_1"
        globalMap.put("tHash_Lookup_barcode_no_obj_yet", null);

    }

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

From source file:pahma_etl.tmslocation_barcode_mvcrate_1_1.TMSlocation_barcode_mvCrate.java

License:LGPL

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

    final boolean execStat = this.execStat;

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

    try {/*  w ww.java2  s.  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_1Process(globalMap);

            obj_IDsStruct obj_IDs = new obj_IDsStruct();
            IDStruct ID = new IDStruct();
            unmatch_locStruct unmatch_loc = new unmatch_locStruct();
            move2obj_XMLStruct move2obj_XML = new move2obj_XMLStruct();
            row3Struct row3 = new row3Struct();
            obj2move_XMLStruct obj2move_XML = new obj2move_XMLStruct();
            row1Struct row1 = new row1Struct();

            /**
             * [tFileOutputDelimited_5 begin ] start
             */

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

            int tos_count_tFileOutputDelimited_5 = 0;

            String fileName_tFileOutputDelimited_5 = "";
            fileName_tFileOutputDelimited_5 = (new java.io.File("../temp/location/barcodeMvCrate_ID."
                    + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".txt")).getAbsolutePath()
                            .replace("\\", "/");
            String fullName_tFileOutputDelimited_5 = null;
            String extension_tFileOutputDelimited_5 = null;
            String directory_tFileOutputDelimited_5 = null;
            if ((fileName_tFileOutputDelimited_5.indexOf("/") != -1)) {
                if (fileName_tFileOutputDelimited_5.lastIndexOf(".") < fileName_tFileOutputDelimited_5
                        .lastIndexOf("/")) {
                    fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5;
                    extension_tFileOutputDelimited_5 = "";
                } else {
                    fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5.substring(0,
                            fileName_tFileOutputDelimited_5.lastIndexOf("."));
                    extension_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5
                            .substring(fileName_tFileOutputDelimited_5.lastIndexOf("."));
                }
                directory_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5.substring(0,
                        fileName_tFileOutputDelimited_5.lastIndexOf("/"));
            } else {
                if (fileName_tFileOutputDelimited_5.lastIndexOf(".") != -1) {
                    fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5.substring(0,
                            fileName_tFileOutputDelimited_5.lastIndexOf("."));
                    extension_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5
                            .substring(fileName_tFileOutputDelimited_5.lastIndexOf("."));
                } else {
                    fullName_tFileOutputDelimited_5 = fileName_tFileOutputDelimited_5;
                    extension_tFileOutputDelimited_5 = "";
                }
                directory_tFileOutputDelimited_5 = "";
            }
            boolean isFileGenerated_tFileOutputDelimited_5 = true;
            java.io.File filetFileOutputDelimited_5 = new java.io.File(fileName_tFileOutputDelimited_5);
            globalMap.put("tFileOutputDelimited_5_FILE_NAME", fileName_tFileOutputDelimited_5);

            int nb_line_tFileOutputDelimited_5 = 0;
            int splitEvery_tFileOutputDelimited_5 = 1000;
            int splitedFileNo_tFileOutputDelimited_5 = 0;
            int currentRow_tFileOutputDelimited_5 = 0;

            final String OUT_DELIM_tFileOutputDelimited_5 = /**
                                                            * Start field
                                                            * tFileOutputDelimited_5:FIELDSEPARATOR
                                                            */
                    ";"/** End field tFileOutputDelimited_5:FIELDSEPARATOR */
            ;

            final String OUT_DELIM_ROWSEP_tFileOutputDelimited_5 = /**
                                                                   * Start
                                                                   * field tFileOutputDelimited_5:ROWSEPARATOR
                                                                   */
                    "\n"/** End field tFileOutputDelimited_5:ROWSEPARATOR */
            ;

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

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

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

                    outtFileOutputDelimited_5.write("Item_Num");

                    outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                    outtFileOutputDelimited_5.write("moveID");

                    outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                    outtFileOutputDelimited_5.write("loc_reject");

                    outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                    outtFileOutputDelimited_5.write("handler_reject");

                    outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                    outtFileOutputDelimited_5.write("obj_reject");

                    outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                    outtFileOutputDelimited_5.write("loc_refname");

                    outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                    outtFileOutputDelimited_5.write("crate_refname");

                    outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                    outtFileOutputDelimited_5.write("loc_handler_refname");

                    outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                    outtFileOutputDelimited_5.write("capture_datetime");

                    outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                    outtFileOutputDelimited_5.write("moveCSID");

                    outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                    outtFileOutputDelimited_5.write("move2obj_CSID");

                    outtFileOutputDelimited_5.write(OUT_DELIM_tFileOutputDelimited_5);

                    outtFileOutputDelimited_5.write("obj2move_CSID");

                    outtFileOutputDelimited_5.write(OUT_DELIM_ROWSEP_tFileOutputDelimited_5);
                    outtFileOutputDelimited_5.flush();
                }

                /**
                 * [tFileOutputDelimited_5 begin ] stop
                 */

                /**
                 * [tFileOutputDelimited_4 begin ] start
                 */

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

                int tos_count_tFileOutputDelimited_4 = 0;

                String fileName_tFileOutputDelimited_4 = "";
                fileName_tFileOutputDelimited_4 = (new java.io.File("../temp/location/barcodeMvCrate_unmatched."
                        + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".txt"))
                                .getAbsolutePath().replace("\\", "/");
                String fullName_tFileOutputDelimited_4 = null;
                String extension_tFileOutputDelimited_4 = null;
                String directory_tFileOutputDelimited_4 = null;
                if ((fileName_tFileOutputDelimited_4.indexOf("/") != -1)) {
                    if (fileName_tFileOutputDelimited_4.lastIndexOf(".") < fileName_tFileOutputDelimited_4
                            .lastIndexOf("/")) {
                        fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4;
                        extension_tFileOutputDelimited_4 = "";
                    } else {
                        fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4.substring(0,
                                fileName_tFileOutputDelimited_4.lastIndexOf("."));
                        extension_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4
                                .substring(fileName_tFileOutputDelimited_4.lastIndexOf("."));
                    }
                    directory_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4.substring(0,
                            fileName_tFileOutputDelimited_4.lastIndexOf("/"));
                } else {
                    if (fileName_tFileOutputDelimited_4.lastIndexOf(".") != -1) {
                        fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4.substring(0,
                                fileName_tFileOutputDelimited_4.lastIndexOf("."));
                        extension_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4
                                .substring(fileName_tFileOutputDelimited_4.lastIndexOf("."));
                    } else {
                        fullName_tFileOutputDelimited_4 = fileName_tFileOutputDelimited_4;
                        extension_tFileOutputDelimited_4 = "";
                    }
                    directory_tFileOutputDelimited_4 = "";
                }
                boolean isFileGenerated_tFileOutputDelimited_4 = true;
                java.io.File filetFileOutputDelimited_4 = new java.io.File(fileName_tFileOutputDelimited_4);
                globalMap.put("tFileOutputDelimited_4_FILE_NAME", fileName_tFileOutputDelimited_4);

                int nb_line_tFileOutputDelimited_4 = 0;
                int splitEvery_tFileOutputDelimited_4 = 1000;
                int splitedFileNo_tFileOutputDelimited_4 = 0;
                int currentRow_tFileOutputDelimited_4 = 0;

                final String OUT_DELIM_tFileOutputDelimited_4 = /**
                                                                * Start
                                                                * field tFileOutputDelimited_4:FIELDSEPARATOR
                                                                */
                        ";"/** End field tFileOutputDelimited_4:FIELDSEPARATOR */
                ;

                final String OUT_DELIM_ROWSEP_tFileOutputDelimited_4 = /**
                                                                       * 
                                                                       * Start field tFileOutputDelimited_4:ROWSEPARATOR
                                                                       */
                        "\n"/** End field tFileOutputDelimited_4:ROWSEPARATOR */
                ;

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

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

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

                        outtFileOutputDelimited_4.write("Item_Num");

                        outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                        outtFileOutputDelimited_4.write("moveID");

                        outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                        outtFileOutputDelimited_4.write("reject_loc");

                        outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                        outtFileOutputDelimited_4.write("reject_handler");

                        outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                        outtFileOutputDelimited_4.write("reject_obj");

                        outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                        outtFileOutputDelimited_4.write("newLocation");

                        outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                        outtFileOutputDelimited_4.write("currCrate");

                        outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                        outtFileOutputDelimited_4.write("loc_refname");

                        outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                        outtFileOutputDelimited_4.write("crate_refname");

                        outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                        outtFileOutputDelimited_4.write("loc_handler");

                        outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                        outtFileOutputDelimited_4.write("loc_handler_refname");

                        outtFileOutputDelimited_4.write(OUT_DELIM_tFileOutputDelimited_4);

                        outtFileOutputDelimited_4.write("Capture_timestamp");

                        outtFileOutputDelimited_4.write(OUT_DELIM_ROWSEP_tFileOutputDelimited_4);
                        outtFileOutputDelimited_4.flush();
                    }

                    /**
                     * [tFileOutputDelimited_4 begin ] stop
                     */

                    /**
                     * [tSortRow_8_SortOut begin ] start
                     */

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

                    int tos_count_tSortRow_8_SortOut = 0;

                    class Comparablemove2obj_XMLStruct extends move2obj_XMLStruct
                            implements Comparable<Comparablemove2obj_XMLStruct> {

                        public int compareTo(Comparablemove2obj_XMLStruct other) {

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

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

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

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

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

                    java.util.List<Comparablemove2obj_XMLStruct> list_tSortRow_8_SortOut = new java.util.ArrayList<Comparablemove2obj_XMLStruct>();

                    /**
                     * [tSortRow_8_SortOut begin ] stop
                     */

                    /**
                     * [tSortRow_6_SortOut begin ] start
                     */

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

                    int tos_count_tSortRow_6_SortOut = 0;

                    class Comparableobj2move_XMLStruct extends obj2move_XMLStruct
                            implements Comparable<Comparableobj2move_XMLStruct> {

                        public int compareTo(Comparableobj2move_XMLStruct other) {

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

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

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

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

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

                    java.util.List<Comparableobj2move_XMLStruct> list_tSortRow_6_SortOut = new java.util.ArrayList<Comparableobj2move_XMLStruct>();

                    /**
                     * [tSortRow_6_SortOut begin ] stop
                     */

                    /**
                     * [tMap_1 begin ] start
                     */

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

                    int tos_count_tMap_1 = 0;

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

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

                    barcode_no_obj_yetStruct barcode_no_obj_yetHashKey = new barcode_no_obj_yetStruct();
                    barcode_no_obj_yetStruct barcode_no_obj_yetDefault = new barcode_no_obj_yetStruct();
                    // ###############################

                    // ###############################
                    // # Vars initialization
                    class Var__tMap_1__Struct {
                        String trim_locrefname;
                        String item_locref;
                        String trim_craterefname;
                        boolean loc_reject;
                        boolean handler_reject;
                        boolean obj_reject;
                        String move2obj_CSID;
                        String obj2move_CSID;
                        String obj_uri;
                        String obj_refname;
                        String move_uri;
                        String move_refname;
                        String rel_m2o_uri;
                        String rel_m2o_refname;
                        String rel_o2m_uri;
                        String rel_o2m_refname;
                    }
                    Var__tMap_1__Struct Var__tMap_1 = new Var__tMap_1__Struct();
                    // ###############################

                    // ###############################
                    // # Outputs initialization
                    IDStruct ID_tmp = new IDStruct();
                    unmatch_locStruct unmatch_loc_tmp = new unmatch_locStruct();
                    move2obj_XMLStruct move2obj_XML_tmp = new move2obj_XMLStruct();
                    obj2move_XMLStruct obj2move_XML_tmp = new obj2move_XMLStruct();
                    // ###############################

                    /**
                     * [tMap_1 begin ] stop
                     */

                    /**
                     * [tFileInputDelimited_10 begin ] start
                     */

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

                    int tos_count_tFileInputDelimited_10 = 0;

                    class RowHelper_tFileInputDelimited_10 {

                        public void valueToConn(org.talend.fileprocess.FileInputDelimited fid,
                                obj_IDsStruct obj_IDs) throws Exception {

                            obj_IDs.obj_nuxeoID = fid.get(0).trim();

                            obj_IDs.obj_CSID = fid.get(1).trim();

                            obj_IDs.objectNumber = fid.get(2).trim();

                            obj_IDs.objectID = fid.get(3).trim();

                            obj_IDs.currCrate_refname = fid.get(4).trim();

                            obj_IDs.currLoc_refname = fid.get(5).trim();

                        }

                    }
                    RowHelper_tFileInputDelimited_10 rowHelper_tFileInputDelimited_10 = new RowHelper_tFileInputDelimited_10();

                    int nb_line_tFileInputDelimited_10 = 0;
                    org.talend.fileprocess.FileInputDelimited fid_tFileInputDelimited_10 = null;
                    try {

                        Object filename_tFileInputDelimited_10 = "/tmp/all_crateObj.tab."
                                + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min;
                        if (filename_tFileInputDelimited_10 instanceof java.io.InputStream) {

                            int footer_value_tFileInputDelimited_10 = 0,
                                    random_value_tFileInputDelimited_10 = -1;
                            if (footer_value_tFileInputDelimited_10 > 0
                                    || random_value_tFileInputDelimited_10 > 0) {
                                throw new Exception(
                                        "When the input source is a stream,footer and random shouldn't be bigger than 0.");
                            }

                        }
                        try {
                            fid_tFileInputDelimited_10 = new org.talend.fileprocess.FileInputDelimited(
                                    "/tmp/all_crateObj.tab." + TalendDate.getDate("CCYY-MM-DD") + "-"
                                            + context.infile_min,
                                    "US-ASCII", "\t", "\n", false, 0, 0, -1, -1, false);
                        } catch (Exception e) {

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

                        }

                        while (fid_tFileInputDelimited_10 != null && fid_tFileInputDelimited_10.nextRecord()) {

                            obj_IDs = null;

                            boolean whetherReject_tFileInputDelimited_10 = false;
                            obj_IDs = new obj_IDsStruct();
                            try {

                                rowHelper_tFileInputDelimited_10.valueToConn(fid_tFileInputDelimited_10,
                                        obj_IDs);

                            } catch (Exception e) {
                                whetherReject_tFileInputDelimited_10 = true;

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

                            }

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

                            currentComponent = "tFileInputDelimited_10";

                            tos_count_tFileInputDelimited_10++;

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

                                /**
                                 * [tMap_1 main ] start
                                 */

                                currentComponent = "tMap_1";

                                boolean hasCasePrimitiveKeyWithNull_tMap_1 = false;

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

                                // /////////////////////////////////////////////
                                // Starting Lookup Table
                                // "barcode_no_obj_yet"
                                // /////////////////////////////////////////////

                                boolean forceLoopbarcode_no_obj_yet = false;

                                barcode_no_obj_yetStruct barcode_no_obj_yetObjectFromLookup = null;

                                if (!rejectedInnerJoin_tMap_1) { // G_TM_M_020

                                    hasCasePrimitiveKeyWithNull_tMap_1 = false;

                                    barcode_no_obj_yetHashKey.crate_refname = obj_IDs.currCrate_refname;

                                    barcode_no_obj_yetHashKey.hashCodeDirty = true;

                                    tHash_Lookup_barcode_no_obj_yet.lookup(barcode_no_obj_yetHashKey);

                                    if (!tHash_Lookup_barcode_no_obj_yet.hasNext()) { // G_TM_M_090

                                        forceLoopbarcode_no_obj_yet = true;

                                    } // G_TM_M_090

                                } // G_TM_M_020

                                else { // G 20 - G 21
                                    forceLoopbarcode_no_obj_yet = true;
                                } // G 21

                                barcode_no_obj_yetStruct barcode_no_obj_yet = null;

                                while ((tHash_Lookup_barcode_no_obj_yet != null
                                        && tHash_Lookup_barcode_no_obj_yet.hasNext())
                                        || forceLoopbarcode_no_obj_yet) { // G_TM_M_043

                                    // CALL close loop of lookup
                                    // 'barcode_no_obj_yet'

                                    barcode_no_obj_yetStruct fromLookup_barcode_no_obj_yet = null;
                                    barcode_no_obj_yet = barcode_no_obj_yetDefault;

                                    if (!forceLoopbarcode_no_obj_yet) { // G
                                        // 46

                                        fromLookup_barcode_no_obj_yet = tHash_Lookup_barcode_no_obj_yet.next();

                                        if (fromLookup_barcode_no_obj_yet != null) {
                                            barcode_no_obj_yet = fromLookup_barcode_no_obj_yet;
                                        }

                                    } // G 46

                                    forceLoopbarcode_no_obj_yet = false;

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

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

                                        Var__tMap_1__Struct Var = Var__tMap_1;
                                        Var.trim_locrefname = StringHandling
                                                .TRIM(barcode_no_obj_yet.loc_refname);
                                        Var.item_locref = StringHandling.TRIM(obj_IDs.objectNumber) + "->"
                                                + StringHandling.TRIM(barcode_no_obj_yet.loc_refname) + " : "
                                                + barcode_no_obj_yet.crate_refname;
                                        Var.trim_craterefname = StringHandling
                                                .TRIM(barcode_no_obj_yet.crate_refname);
                                        Var.loc_reject = Relational.ISNULL(barcode_no_obj_yet.loc_refname)
                                                || Relational.ISNULL(barcode_no_obj_yet.crate_refname);
                                        Var.handler_reject = Relational
                                                .ISNULL(barcode_no_obj_yet.person_scanning);
                                        Var.obj_reject = Relational.ISNULL(obj_IDs.obj_CSID);
                                        Var.move2obj_CSID = Guid.getUUID();
                                        Var.obj2move_CSID = Guid.getUUID();
                                        Var.obj_uri = "/collectionobjects/" + obj_IDs.obj_CSID;
                                        Var.obj_refname = "urn:cspace:pahma.cspace.berkeley.edu:collectionobjects:id("
                                                + obj_IDs.obj_CSID + ")'" + obj_IDs.objectNumber + "'";
                                        Var.move_uri = "/movements/" + barcode_no_obj_yet.move_CSID;
                                        Var.move_refname = "urn:cspace:pahma.cspace.berkeley.edu:movements:id("
                                                + barcode_no_obj_yet.move_CSID + ")";
                                        Var.rel_m2o_uri = "/relations/" + Var.move2obj_CSID;
                                        Var.rel_m2o_refname = "urn:cspace:pahma.cspace.berkeley.edu:collectionobjects:id("
                                                + Var.move2obj_CSID + ")";
                                        Var.rel_o2m_uri = "/relations/" + Var.obj2move_CSID;
                                        Var.rel_o2m_refname = "urn:cspace:pahma.cspace.berkeley.edu:collectionobjects:id("
                                                + Var.obj2move_CSID + ")";// ###############################
                                        // ###############################
                                        // # Output tables

                                        ID = null;
                                        unmatch_loc = null;
                                        move2obj_XML = null;
                                        obj2move_XML = null;

                                        // # Output table : 'ID'
                                        ID_tmp.Item_Num = StringHandling.TRIM(obj_IDs.objectNumber);
                                        ID_tmp.moveID = barcode_no_obj_yet.moveID;
                                        ID_tmp.loc_reject = Var.loc_reject;
                                        ID_tmp.handler_reject = Var.handler_reject;
                                        ID_tmp.obj_reject = Var.obj_reject;
                                        ID_tmp.loc_refname = barcode_no_obj_yet.loc_refname;
                                        ID_tmp.crate_refname = barcode_no_obj_yet.crate_refname;
                                        ID_tmp.loc_handler_refname = barcode_no_obj_yet.person_refname;
                                        ID_tmp.capture_datetime = barcode_no_obj_yet.datetimeTZ;
                                        ID_tmp.moveCSID = barcode_no_obj_yet.move_CSID;
                                        ID_tmp.move2obj_CSID = Var.move2obj_CSID;
                                        ID_tmp.obj2move_CSID = Var.obj2move_CSID;
                                        ID = ID_tmp;

                                        // # Output table : 'unmatch_loc'
                                        // # Filter conditions
                                        if (

                                        Var.loc_reject || Var.obj_reject || Var.handler_reject

                                        ) {
                                            unmatch_loc_tmp.Item_Num = StringHandling
                                                    .TRIM(obj_IDs.objectNumber);
                                            unmatch_loc_tmp.moveID = barcode_no_obj_yet.moveID;
                                            unmatch_loc_tmp.reject_loc = Var.loc_reject;
                                            unmatch_loc_tmp.reject_handler = Var.handler_reject;
                                            unmatch_loc_tmp.reject_obj = Var.obj_reject;
                                            unmatch_loc_tmp.newLocation = barcode_no_obj_yet.new_location;
                                            unmatch_loc_tmp.currCrate = barcode_no_obj_yet.current_crate;
                                            unmatch_loc_tmp.loc_refname = barcode_no_obj_yet.loc_refname;
                                            unmatch_loc_tmp.crate_refname = barcode_no_obj_yet.crate_refname;
                                            unmatch_loc_tmp.loc_handler = barcode_no_obj_yet.person_scanning;
                                            unmatch_loc_tmp.loc_handler_refname = barcode_no_obj_yet.person_refname;
                                            unmatch_loc_tmp.Capture_timestamp = barcode_no_obj_yet.date_time;
                                            unmatch_loc = unmatch_loc_tmp;
                                        } // closing filter/reject

                                        // # Output table : 'move2obj_XML'
                                        move2obj_XML_tmp.objectNum = StringHandling.TRIM(obj_IDs.objectNumber);
                                        move2obj_XML_tmp.obj_CSID = obj_IDs.obj_CSID;
                                        move2obj_XML_tmp.obj_uri = Var.obj_uri;
                                        move2obj_XML_tmp.obj_refname = Var.obj_refname;
                                        move2obj_XML_tmp.objectDocType = "CollectionObject";
                                        move2obj_XML_tmp.moveID = barcode_no_obj_yet.moveID;
                                        move2obj_XML_tmp.move_CSID = barcode_no_obj_yet.move_CSID;
                                        move2obj_XML_tmp.move_URI = Var.move_uri;
                                        move2obj_XML_tmp.move_refname = Var.move_refname;
                                        move2obj_XML_tmp.subjectDocType = "Movement";
                                        move2obj_XML_tmp.loc_refName = Var.trim_locrefname;
                                        move2obj_XML_tmp.move_timestamp = barcode_no_obj_yet.datetimeTZ;
                                        move2obj_XML_tmp.move2obj_CSID = Var.move2obj_CSID;
                                        move2obj_XML = move2obj_XML_tmp;

                                        // # Output table : 'obj2move_XML'
                                        obj2move_XML_tmp.objectNum = StringHandling.TRIM(obj_IDs.objectNumber);
                                        obj2move_XML_tmp.obj_CSID = obj_IDs.obj_CSID;
                                        obj2move_XML_tmp.obj_uri = Var.obj_uri;
                                        obj2move_XML_tmp.obj_refname = Var.obj_refname;
                                        obj2move_XML_tmp.subjectDoctype = "CollectionObject";
                                        obj2move_XML_tmp.moveID = barcode_no_obj_yet.moveID;
                                        obj2move_XML_tmp.move_CSID = barcode_no_obj_yet.move_CSID;
                                        obj2move_XML_tmp.move_URI = Var.move_uri;
                                        obj2move_XML_tmp.move_refname = Var.move_refname;
                                        obj2move_XML_tmp.objectDoctype = "Movement";
                                        obj2move_XML_tmp.loc_refName = Var.trim_locrefname;
                                        obj2move_XML_tmp.move_timestamp = barcode_no_obj_yet.datetimeTZ;
                                        obj2move_XML_tmp.obj2move_CSID = Var.obj2move_CSID;
                                        obj2move_XML = obj2move_XML_tmp;
                                        // ###############################

                                    } // end of Var scope

                                    rejectedInnerJoin_tMap_1 = false;

                                    tos_count_tMap_1++;

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

                                        /**
                                         * [tFileOutputDelimited_5 main ]
                                         * start
                                         */

                                        currentComponent = "tFileOutputDelimited_5";

                                        StringBuilder sb_tFileOutputDelimited_5 = new StringBuilder();

                                        if (ID.Item_Num != null) {

                                            sb_tFileOutputDelimited_5.append(

                                                    ID.Item_Num

                                            );

                                        }

                                        sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                        if (ID.moveID != null) {

                                            sb_tFileOutputDelimited_5.append(

                                                    ID.moveID

                                            );

                                        }

                                        sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                        if (ID.loc_reject != null) {

                                            sb_tFileOutputDelimited_5.append(

                                                    ID.loc_reject

                                            );

                                        }

                                        sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                        if (ID.handler_reject != null) {

                                            sb_tFileOutputDelimited_5.append(

                                                    ID.handler_reject

                                            );

                                        }

                                        sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                        if (ID.obj_reject != null) {

                                            sb_tFileOutputDelimited_5.append(

                                                    ID.obj_reject

                                            );

                                        }

                                        sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                        if (ID.loc_refname != null) {

                                            sb_tFileOutputDelimited_5.append(

                                                    ID.loc_refname

                                            );

                                        }

                                        sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                        if (ID.crate_refname != null) {

                                            sb_tFileOutputDelimited_5.append(

                                                    ID.crate_refname

                                            );

                                        }

                                        sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                        if (ID.loc_handler_refname != null) {

                                            sb_tFileOutputDelimited_5.append(

                                                    ID.loc_handler_refname

                                            );

                                        }

                                        sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                        if (ID.capture_datetime != null) {

                                            sb_tFileOutputDelimited_5.append(

                                                    ID.capture_datetime

                                            );

                                        }

                                        sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                        if (ID.moveCSID != null) {

                                            sb_tFileOutputDelimited_5.append(

                                                    ID.moveCSID

                                            );

                                        }

                                        sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                        if (ID.move2obj_CSID != null) {

                                            sb_tFileOutputDelimited_5.append(

                                                    ID.move2obj_CSID

                                            );

                                        }

                                        sb_tFileOutputDelimited_5.append(OUT_DELIM_tFileOutputDelimited_5);

                                        if (ID.obj2move_CSID != null) {

                                            sb_tFileOutputDelimited_5.append(

                                                    ID.obj2move_CSID

                                            );

                                        }

                                        sb_tFileOutputDelimited_5
                                                .append(OUT_DELIM_ROWSEP_tFileOutputDelimited_5);

                                        nb_line_tFileOutputDelimited_5++;

                                        outtFileOutputDelimited_5.write(sb_tFileOutputDelimited_5.toString());

                                        tos_count_tFileOutputDelimited_5++;

                                        /**
                                         * [tFileOutputDelimited_5 main ]
                                         * stop
                                         */

                                    } // End of branch "ID"

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

                                        /**
                                         * [tFileOutputDelimited_4 main ]
                                         * start
                                         */

                                        currentComponent = "tFileOutputDelimited_4";

                                        StringBuilder sb_tFileOutputDelimited_4 = new StringBuilder();

                                        if (unmatch_loc.Item_Num != null) {

                                            sb_tFileOutputDelimited_4.append(

                                                    unmatch_loc.Item_Num

                                            );

                                        }

                                        sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                        if (unmatch_loc.moveID != null) {

                                            sb_tFileOutputDelimited_4.append(

                                                    unmatch_loc.moveID

                                            );

                                        }

                                        sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                        sb_tFileOutputDelimited_4.append(

                                                unmatch_loc.reject_loc

                                        );

                                        sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                        if (unmatch_loc.reject_handler != null) {

                                            sb_tFileOutputDelimited_4.append(

                                                    unmatch_loc.reject_handler

                                            );

                                        }

                                        sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                        if (unmatch_loc.reject_obj != null) {

                                            sb_tFileOutputDelimited_4.append(

                                                    unmatch_loc.reject_obj

                                            );

                                        }

                                        sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                        if (unmatch_loc.newLocation != null) {

                                            sb_tFileOutputDelimited_4.append(

                                                    unmatch_loc.newLocation

                                            );

                                        }

                                        sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                        if (unmatch_loc.currCrate != null) {

                                            sb_tFileOutputDelimited_4.append(

                                                    unmatch_loc.currCrate

                                            );

                                        }

                                        sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                        if (unmatch_loc.loc_refname != null) {

                                            sb_tFileOutputDelimited_4.append(

                                                    unmatch_loc.loc_refname

                                            );

                                        }

                                        sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                        if (unmatch_loc.crate_refname != null) {

                                            sb_tFileOutputDelimited_4.append(

                                                    unmatch_loc.crate_refname

                                            );

                                        }

                                        sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                        if (unmatch_loc.loc_handler != null) {

                                            sb_tFileOutputDelimited_4.append(

                                                    unmatch_loc.loc_handler

                                            );

                                        }

                                        sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                        if (unmatch_loc.loc_handler_refname != null) {

                                            sb_tFileOutputDelimited_4.append(

                                                    unmatch_loc.loc_handler_refname

                                            );

                                        }

                                        sb_tFileOutputDelimited_4.append(OUT_DELIM_tFileOutputDelimited_4);

                                        if (unmatch_loc.Capture_timestamp != null) {

                                            sb_tFileOutputDelimited_4.append(

                                                    unmatch_loc.Capture_timestamp

                                            );

                                        }

                                        sb_tFileOutputDelimited_4
                                                .append(OUT_DELIM_ROWSEP_tFileOutputDelimited_4);

                                        nb_line_tFileOutputDelimited_4++;

                                        outtFileOutputDelimited_4.write(sb_tFileOutputDelimited_4.toString());

                                        tos_count_tFileOutputDelimited_4++;

                                        /**
                                         * [tFileOutputDelimited_4 main ]
                                         * stop
                                         */

                                    } // End of branch "unmatch_loc"

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

                                        /**
                                         * [tSortRow_8_SortOut main ] start
                                         */

                                        currentComponent = "tSortRow_8_SortOut";

                                        Comparablemove2obj_XMLStruct arrayRowtSortRow_8_SortOut = new Comparablemove2obj_XMLStruct();

                                        arrayRowtSortRow_8_SortOut.objectNum = move2obj_XML.objectNum;
                                        arrayRowtSortRow_8_SortOut.obj_CSID = move2obj_XML.obj_CSID;
                                        arrayRowtSortRow_8_SortOut.obj_uri = move2obj_XML.obj_uri;
                                        arrayRowtSortRow_8_SortOut.obj_refname = move2obj_XML.obj_refname;
                                        arrayRowtSortRow_8_SortOut.objectDocType = move2obj_XML.objectDocType;
                                        arrayRowtSortRow_8_SortOut.moveID = move2obj_XML.moveID;
                                        arrayRowtSortRow_8_SortOut.move_CSID = move2obj_XML.move_CSID;
                                        arrayRowtSortRow_8_SortOut.move_URI = move2obj_XML.move_URI;
                                        arrayRowtSortRow_8_SortOut.move_refname = move2obj_XML.move_refname;
                                        arrayRowtSortRow_8_SortOut.subjectDocType = move2obj_XML.subjectDocType;
                                        arrayRowtSortRow_8_SortOut.loc_refName = move2obj_XML.loc_refName;
                                        arrayRowtSortRow_8_SortOut.move_timestamp = move2obj_XML.move_timestamp;
                                        arrayRowtSortRow_8_SortOut.move2obj_CSID = move2obj_XML.move2obj_CSID;
                                        list_tSortRow_8_SortOut.add(arrayRowtSortRow_8_SortOut);

                                        tos_count_tSortRow_8_SortOut++;

                                        /**
                                         * [tSortRow_8_SortOut main ] stop
                                         */

                                    } // End of branch "move2obj_XML"

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

                                        /**
                                         * [tSortRow_6_SortOut main ] start
                                         */

                                        currentComponent = "tSortRow_6_SortOut";

                                        Comparableobj2move_XMLStruct arrayRowtSortRow_6_SortOut = new Comparableobj2move_XMLStruct();

                                        arrayRowtSortRow_6_SortOut.objectNum = obj2move_XML.objectNum;
                                        arrayRowtSortRow_6_SortOut.obj_CSID = obj2move_XML.obj_CSID;
                                        arrayRowtSortRow_6_SortOut.obj_uri = obj2move_XML.obj_uri;
                                        arrayRowtSortRow_6_SortOut.obj_refname = obj2move_XML.obj_refname;
                                        arrayRowtSortRow_6_SortOut.subjectDoctype = obj2move_XML.subjectDoctype;
                                        arrayRowtSortRow_6_SortOut.moveID = obj2move_XML.moveID;
                                        arrayRowtSortRow_6_SortOut.move_CSID = obj2move_XML.move_CSID;
                                        arrayRowtSortRow_6_SortOut.move_URI = obj2move_XML.move_URI;
                                        arrayRowtSortRow_6_SortOut.move_refname = obj2move_XML.move_refname;
                                        arrayRowtSortRow_6_SortOut.objectDoctype = obj2move_XML.objectDoctype;
                                        arrayRowtSortRow_6_SortOut.loc_refName = obj2move_XML.loc_refName;
                                        arrayRowtSortRow_6_SortOut.move_timestamp = obj2move_XML.move_timestamp;
                                        arrayRowtSortRow_6_SortOut.obj2move_CSID = obj2move_XML.obj2move_CSID;
                                        list_tSortRow_6_SortOut.add(arrayRowtSortRow_6_SortOut);

                                        tos_count_tSortRow_6_SortOut++;

                                        /**
                                         * [tSortRow_6_SortOut main ] stop
                                         */

                                    } // End of branch "obj2move_XML"

                                } // close loop of lookup
                                  // 'barcode_no_obj_yet' // G_TM_M_043

                            } // End of branch "obj_IDs"

                            /**
                             * [tFileInputDelimited_10 end ] start
                             */

                            currentComponent = "tFileInputDelimited_10";

                        }
                    } finally {
                        if (!((Object) ("/tmp/all_crateObj.tab." + TalendDate.getDate("CCYY-MM-DD") + "-"
                                + context.infile_min) instanceof java.io.InputStream)) {
                            if (fid_tFileInputDelimited_10 != null) {
                                fid_tFileInputDelimited_10.close();
                            }
                        }
                        if (fid_tFileInputDelimited_10 != null) {
                            globalMap.put("tFileInputDelimited_10_NB_LINE",
                                    fid_tFileInputDelimited_10.getRowNumber());
                        }
                    }

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

                    /**
                     * [tFileInputDelimited_10 end ] stop
                     */

                    /**
                     * [tMap_1 end ] start
                     */

                    currentComponent = "tMap_1";

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

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

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

                    /**
                     * [tMap_1 end ] stop
                     */

                    /**
                     * [tSortRow_6_SortOut end ] start
                     */

                    currentComponent = "tSortRow_6_SortOut";

                    obj2move_XMLStruct[] array_tSortRow_6_SortOut = list_tSortRow_6_SortOut
                            .toArray(new Comparableobj2move_XMLStruct[0]);

                    java.util.Arrays.sort(array_tSortRow_6_SortOut);

                    globalMap.put("tSortRow_6", array_tSortRow_6_SortOut);

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

                    /**
                     * [tSortRow_6_SortOut end ] stop
                     */

                    /**
                     * [tAdvancedFileOutputXML_3 begin ] start
                     */

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

                    int tos_count_tAdvancedFileOutputXML_3 = 0;

                    int nb_line_tAFOX_3 = 0;

                    boolean needRoot_tAFOX_3 = true;

                    String fileName_tAFOX_3 = "../temp/relation/barcodeMvCrate_obj2move."
                            + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".xml";
                    Boolean alreadyExistsFile_tAFOX_3 = new java.io.File(fileName_tAFOX_3).exists();
                    fileName_tAFOX_3 = new java.io.File(fileName_tAFOX_3).getAbsolutePath().replace("\\", "/");
                    String file_tAFOX_3 = "";

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

                    if (!createFiletAFOX_3.exists()) {
                        (new java.io.File(fileName_tAFOX_3.substring(0, fileName_tAFOX_3.lastIndexOf("/"))))
                                .mkdirs();
                        needRoot_tAFOX_3 = true;
                    }

                    int currentRowCount_tAFOX_3 = 0;
                    int currentFileCount_tAFOX_3 = 0;
                    String suffix_tAFOX_3 = "";

                    if (fileName_tAFOX_3.substring(fileName_tAFOX_3.lastIndexOf("/")).lastIndexOf(".") > 0) {
                        suffix_tAFOX_3 = fileName_tAFOX_3.substring(fileName_tAFOX_3.lastIndexOf("."));
                    }
                    fileName_tAFOX_3 = file_tAFOX_3 + "0" + suffix_tAFOX_3;

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

                    class NestXMLTool_tAFOX_3 {
                        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_3 nestXMLTool_tAFOX_3 = new NestXMLTool_tAFOX_3();
                    // sort group root element for judgement of group
                    java.util.List<org.dom4j.Element> groupElementList_tAFOX_3 = new java.util.ArrayList<org.dom4j.Element>();
                    org.dom4j.Element root4Group_tAFOX_3 = null;
                    org.dom4j.Document doc_tAFOX_3 = null;

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

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

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

                    int[] orders_tAFOX_3 = new int[1];

                    /**
                     * [tAdvancedFileOutputXML_3 begin ] stop
                     */

                    /**
                     * [tSortRow_6_SortIn begin ] start
                     */

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

                    int tos_count_tSortRow_6_SortIn = 0;

                    obj2move_XMLStruct[] array_tSortRow_6_SortIn = (obj2move_XMLStruct[]) globalMap
                            .get("tSortRow_6");

                    int nb_line_tSortRow_6_SortIn = 0;

                    obj2move_XMLStruct current_tSortRow_6_SortIn = null;

                    for (int i_tSortRow_6_SortIn = 0; i_tSortRow_6_SortIn < array_tSortRow_6_SortIn.length; i_tSortRow_6_SortIn++) {
                        current_tSortRow_6_SortIn = array_tSortRow_6_SortIn[i_tSortRow_6_SortIn];
                        row1.objectNum = current_tSortRow_6_SortIn.objectNum;
                        row1.obj_CSID = current_tSortRow_6_SortIn.obj_CSID;
                        row1.obj_uri = current_tSortRow_6_SortIn.obj_uri;
                        row1.obj_refname = current_tSortRow_6_SortIn.obj_refname;
                        row1.subjectDoctype = current_tSortRow_6_SortIn.subjectDoctype;
                        row1.moveID = current_tSortRow_6_SortIn.moveID;
                        row1.move_CSID = current_tSortRow_6_SortIn.move_CSID;
                        row1.move_URI = current_tSortRow_6_SortIn.move_URI;
                        row1.move_refname = current_tSortRow_6_SortIn.move_refname;
                        row1.objectDoctype = current_tSortRow_6_SortIn.objectDoctype;
                        row1.loc_refName = current_tSortRow_6_SortIn.loc_refName;
                        row1.move_timestamp = current_tSortRow_6_SortIn.move_timestamp;
                        row1.obj2move_CSID = current_tSortRow_6_SortIn.obj2move_CSID;
                        // increase number of line sorted
                        nb_line_tSortRow_6_SortIn++;

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

                        currentComponent = "tSortRow_6_SortIn";

                        tos_count_tSortRow_6_SortIn++;

                        /**
                         * [tSortRow_6_SortIn main ] stop
                         */

                        /**
                         * [tAdvancedFileOutputXML_3 main ] start
                         */

                        currentComponent = "tAdvancedFileOutputXML_3";

                        nb_line_tAFOX_3++;
                        valueMap_tAFOX_3.clear();
                        valueMap_tAFOX_3.put("objectNum",
                                (row1.objectNum != null ? row1.objectNum.toString() : null));
                        valueMap_tAFOX_3.put("obj_CSID",
                                (row1.obj_CSID != null ? row1.obj_CSID.toString() : null));
                        valueMap_tAFOX_3.put("obj_uri", (row1.obj_uri.toString()));
                        valueMap_tAFOX_3.put("obj_refname", (row1.obj_refname.toString()));
                        valueMap_tAFOX_3.put("subjectDoctype",
                                (row1.subjectDoctype != null ? row1.subjectDoctype.toString() : null));
                        valueMap_tAFOX_3.put("moveID", (row1.moveID != null ? row1.moveID.toString() : null));
                        valueMap_tAFOX_3.put("move_CSID",
                                (row1.move_CSID != null ? row1.move_CSID.toString() : null));
                        valueMap_tAFOX_3.put("move_URI",
                                (row1.move_URI != null ? row1.move_URI.toString() : null));
                        valueMap_tAFOX_3.put("move_refname", (row1.move_refname.toString()));
                        valueMap_tAFOX_3.put("objectDoctype",
                                (row1.objectDoctype != null ? row1.objectDoctype.toString() : null));
                        valueMap_tAFOX_3.put("loc_refName",
                                (row1.loc_refName != null ? row1.loc_refName.toString() : null));
                        valueMap_tAFOX_3.put("move_timestamp",
                                (row1.move_timestamp != null ? row1.move_timestamp.toString() : null));
                        valueMap_tAFOX_3.put("obj2move_CSID", (row1.obj2move_CSID.toString()));
                        org.dom4j.Element subTreeRootParent_tAFOX_3 = null;

                        // build root xml tree
                        if (needRoot_tAFOX_3) {
                            needRoot_tAFOX_3 = false;
                            if (orders_tAFOX_3.length > 0) {
                                orders_tAFOX_3[0] = 0;
                            }
                            org.dom4j.Element root_tAFOX_3 = doc_tAFOX_3.addElement("imports");
                            subTreeRootParent_tAFOX_3 = root_tAFOX_3;
                            root4Group_tAFOX_3 = subTreeRootParent_tAFOX_3;
                        } else {
                            subTreeRootParent_tAFOX_3 = root4Group_tAFOX_3;
                        }
                        // build group xml tree
                        // build loop xml tree
                        org.dom4j.Element loop_tAFOX_3 = org.dom4j.DocumentHelper.createElement("import");
                        if (orders_tAFOX_3[0] == 0) {
                            orders_tAFOX_3[0] = 0;
                        }
                        if (1 < orders_tAFOX_3.length) {
                            orders_tAFOX_3[1] = 0;
                        }
                        subTreeRootParent_tAFOX_3.elements().add(orders_tAFOX_3[0]++, loop_tAFOX_3);
                        loop_tAFOX_3.addAttribute("service", "Relations");
                        loop_tAFOX_3.addAttribute("type", "Relation");
                        if (valueMap_tAFOX_3.get("obj2move_CSID") != null) {
                            loop_tAFOX_3.addAttribute("CSID", valueMap_tAFOX_3.get("obj2move_CSID"));
                        }
                        org.dom4j.Element loop_0_tAFOX_3 = loop_tAFOX_3.addElement("schema");
                        loop_0_tAFOX_3.addNamespace("relations_common",
                                TalendString.replaceSpecialCharForXML("http://collectionspace.org/relation"));
                        loop_0_tAFOX_3.addAttribute("name", "relations_common");
                        org.dom4j.Element loop_0_0_tAFOX_3;
                        if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_0_tAFOX_3 = loop_0_tAFOX_3.addElement("relationshipType");
                        } else {
                            loop_0_0_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:relationshipType");
                        }
                        nestXMLTool_tAFOX_3.parseAndAdd(loop_0_0_tAFOX_3, "affects");

                        loop_0_0_tAFOX_3.setName("relations_common:relationshipType");
                        org.dom4j.Element loop_0_1_tAFOX_3;
                        if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_1_tAFOX_3 = loop_0_tAFOX_3.addElement("subjectDocumentType");
                        } else {
                            loop_0_1_tAFOX_3 = loop_0_tAFOX_3
                                    .addElement("relations_common:subjectDocumentType");
                        }
                        if (valueMap_tAFOX_3.get("subjectDoctype") != null) {
                            nestXMLTool_tAFOX_3.setText(loop_0_1_tAFOX_3,
                                    valueMap_tAFOX_3.get("subjectDoctype"));
                        }
                        loop_0_1_tAFOX_3.setName("relations_common:subjectDocumentType");
                        org.dom4j.Element loop_0_2_tAFOX_3;
                        if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_2_tAFOX_3 = loop_0_tAFOX_3.addElement("predicateDisplayName");
                        } else {
                            loop_0_2_tAFOX_3 = loop_0_tAFOX_3
                                    .addElement("relations_common:predicateDisplayName");
                        }
                        loop_0_2_tAFOX_3.setName("relations_common:predicateDisplayName");
                        org.dom4j.Element loop_0_3_tAFOX_3;
                        if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_3_tAFOX_3 = loop_0_tAFOX_3.addElement("predicate");
                        } else {
                            loop_0_3_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:predicate");
                        }
                        loop_0_3_tAFOX_3.setName("relations_common:predicate");
                        org.dom4j.Element loop_0_4_tAFOX_3;
                        if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_4_tAFOX_3 = loop_0_tAFOX_3.addElement("objectCsid");
                        } else {
                            loop_0_4_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:objectCsid");
                        }
                        if (valueMap_tAFOX_3.get("move_CSID") != null) {
                            nestXMLTool_tAFOX_3.setText(loop_0_4_tAFOX_3, valueMap_tAFOX_3.get("move_CSID"));
                        }
                        loop_0_4_tAFOX_3.setName("relations_common:objectCsid");
                        org.dom4j.Element loop_0_5_tAFOX_3;
                        if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_5_tAFOX_3 = loop_0_tAFOX_3.addElement("objectUri");
                        } else {
                            loop_0_5_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:objectUri");
                        }
                        if (valueMap_tAFOX_3.get("move_URI") != null) {
                            nestXMLTool_tAFOX_3.setText(loop_0_5_tAFOX_3, valueMap_tAFOX_3.get("move_URI"));
                        }
                        loop_0_5_tAFOX_3.setName("relations_common:objectUri");
                        org.dom4j.Element loop_0_6_tAFOX_3;
                        if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_6_tAFOX_3 = loop_0_tAFOX_3.addElement("objectRefName");
                        } else {
                            loop_0_6_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:objectRefName");
                        }
                        if (valueMap_tAFOX_3.get("move_refname") != null) {
                            nestXMLTool_tAFOX_3.setText(loop_0_6_tAFOX_3, valueMap_tAFOX_3.get("move_refname"));
                        }
                        loop_0_6_tAFOX_3.setName("relations_common:objectRefName");
                        org.dom4j.Element loop_0_7_tAFOX_3;
                        if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_7_tAFOX_3 = loop_0_tAFOX_3.addElement("subjectCsid");
                        } else {
                            loop_0_7_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:subjectCsid");
                        }
                        if (valueMap_tAFOX_3.get("obj_CSID") != null) {
                            nestXMLTool_tAFOX_3.setText(loop_0_7_tAFOX_3, valueMap_tAFOX_3.get("obj_CSID"));
                        }
                        loop_0_7_tAFOX_3.setName("relations_common:subjectCsid");
                        org.dom4j.Element loop_0_8_tAFOX_3;
                        if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_8_tAFOX_3 = loop_0_tAFOX_3.addElement("subjectUri");
                        } else {
                            loop_0_8_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:subjectUri");
                        }
                        if (valueMap_tAFOX_3.get("obj_uri") != null) {
                            nestXMLTool_tAFOX_3.setText(loop_0_8_tAFOX_3, valueMap_tAFOX_3.get("obj_uri"));
                        }
                        loop_0_8_tAFOX_3.setName("relations_common:subjectUri");
                        org.dom4j.Element loop_0_9_tAFOX_3;
                        if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_9_tAFOX_3 = loop_0_tAFOX_3.addElement("subjectRefName");
                        } else {
                            loop_0_9_tAFOX_3 = loop_0_tAFOX_3.addElement("relations_common:subjectRefName");
                        }
                        if (valueMap_tAFOX_3.get("obj_refname") != null) {
                            nestXMLTool_tAFOX_3.setText(loop_0_9_tAFOX_3, valueMap_tAFOX_3.get("obj_refname"));
                        }
                        loop_0_9_tAFOX_3.setName("relations_common:subjectRefName");
                        org.dom4j.Element loop_0_10_tAFOX_3;
                        if (loop_0_tAFOX_3.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_10_tAFOX_3 = loop_0_tAFOX_3.addElement("objectDocumentType");
                        } else {
                            loop_0_10_tAFOX_3 = loop_0_tAFOX_3
                                    .addElement("relations_common:objectDocumentType");
                        }
                        if (valueMap_tAFOX_3.get("objectDoctype") != null) {
                            nestXMLTool_tAFOX_3.setText(loop_0_10_tAFOX_3,
                                    valueMap_tAFOX_3.get("objectDoctype"));
                        }
                        loop_0_10_tAFOX_3.setName("relations_common:objectDocumentType");
                        currentRowCount_tAFOX_3++;
                        if (currentRowCount_tAFOX_3 == 1000) {
                            needRoot_tAFOX_3 = true;
                            fileName_tAFOX_3 = file_tAFOX_3 + currentFileCount_tAFOX_3 + suffix_tAFOX_3;
                            currentRowCount_tAFOX_3 = 0;
                            currentFileCount_tAFOX_3++;
                            groupbyList_tAFOX_3.clear();

                            java.io.FileOutputStream stream_tAFOX_3 = new java.io.FileOutputStream(
                                    fileName_tAFOX_3);
                            org.dom4j.io.XMLWriter output_tAFOX_3 = new org.dom4j.io.XMLWriter(stream_tAFOX_3,
                                    format_tAFOX_3);
                            nestXMLTool_tAFOX_3.replaceDefaultNameSpace(doc_tAFOX_3.getRootElement());
                            output_tAFOX_3.write(doc_tAFOX_3);
                            output_tAFOX_3.close();
                            doc_tAFOX_3 = org.dom4j.DocumentHelper.createDocument();
                            groupElementList_tAFOX_3.clear();
                        }

                        tos_count_tAdvancedFileOutputXML_3++;

                        /**
                         * [tAdvancedFileOutputXML_3 main ] stop
                         */

                        /**
                         * [tSortRow_6_SortIn end ] start
                         */

                        currentComponent = "tSortRow_6_SortIn";

                    }

                    globalMap.put("tSortRow_6_SortIn_NB_LINE", nb_line_tSortRow_6_SortIn);

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

                    /**
                     * [tSortRow_6_SortIn end ] stop
                     */

                    /**
                     * [tAdvancedFileOutputXML_3 end ] start
                     */

                    currentComponent = "tAdvancedFileOutputXML_3";

                    if (currentRowCount_tAFOX_3 > 0) {
                        java.io.FileOutputStream stream_tAFOX_3 = new java.io.FileOutputStream(
                                file_tAFOX_3 + currentFileCount_tAFOX_3 + suffix_tAFOX_3);
                        org.dom4j.io.XMLWriter output_tAFOX_3 = new org.dom4j.io.XMLWriter(stream_tAFOX_3,
                                format_tAFOX_3);
                        if (doc_tAFOX_3.getRootElement() != null) {
                            nestXMLTool_tAFOX_3.replaceDefaultNameSpace(doc_tAFOX_3.getRootElement());
                            output_tAFOX_3.write(doc_tAFOX_3);
                        }
                        output_tAFOX_3.close();
                    }
                    globalMap.put("tAdvancedFileOutputXML_3_NB_LINE", nb_line_tAFOX_3);

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

                    /**
                     * [tAdvancedFileOutputXML_3 end ] stop
                     */

                    /**
                     * [tSortRow_8_SortOut end ] start
                     */

                    currentComponent = "tSortRow_8_SortOut";

                    move2obj_XMLStruct[] array_tSortRow_8_SortOut = list_tSortRow_8_SortOut
                            .toArray(new Comparablemove2obj_XMLStruct[0]);

                    java.util.Arrays.sort(array_tSortRow_8_SortOut);

                    globalMap.put("tSortRow_8", array_tSortRow_8_SortOut);

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

                    /**
                     * [tSortRow_8_SortOut end ] stop
                     */

                    /**
                     * [tAdvancedFileOutputXML_2 begin ] start
                     */

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

                    int tos_count_tAdvancedFileOutputXML_2 = 0;

                    int nb_line_tAFOX_2 = 0;

                    boolean needRoot_tAFOX_2 = true;

                    String fileName_tAFOX_2 = "../temp/relation/barcodeMvCrate_move2obj."
                            + TalendDate.getDate("CCYY-MM-DD") + "-" + context.infile_min + ".xml";
                    Boolean alreadyExistsFile_tAFOX_2 = new java.io.File(fileName_tAFOX_2).exists();
                    fileName_tAFOX_2 = new java.io.File(fileName_tAFOX_2).getAbsolutePath().replace("\\", "/");
                    String file_tAFOX_2 = "";

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

                    if (!createFiletAFOX_2.exists()) {
                        (new java.io.File(fileName_tAFOX_2.substring(0, fileName_tAFOX_2.lastIndexOf("/"))))
                                .mkdirs();
                        needRoot_tAFOX_2 = true;
                    }

                    int currentRowCount_tAFOX_2 = 0;
                    int currentFileCount_tAFOX_2 = 0;
                    String suffix_tAFOX_2 = "";

                    if (fileName_tAFOX_2.substring(fileName_tAFOX_2.lastIndexOf("/")).lastIndexOf(".") > 0) {
                        suffix_tAFOX_2 = fileName_tAFOX_2.substring(fileName_tAFOX_2.lastIndexOf("."));
                    }
                    fileName_tAFOX_2 = file_tAFOX_2 + "0" + suffix_tAFOX_2;

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

                    class NestXMLTool_tAFOX_2 {
                        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_2 nestXMLTool_tAFOX_2 = new NestXMLTool_tAFOX_2();
                    // sort group root element for judgement of group
                    java.util.List<org.dom4j.Element> groupElementList_tAFOX_2 = new java.util.ArrayList<org.dom4j.Element>();
                    org.dom4j.Element root4Group_tAFOX_2 = null;
                    org.dom4j.Document doc_tAFOX_2 = null;

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

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

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

                    int[] orders_tAFOX_2 = new int[1];

                    /**
                     * [tAdvancedFileOutputXML_2 begin ] stop
                     */

                    /**
                     * [tSortRow_8_SortIn begin ] start
                     */

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

                    int tos_count_tSortRow_8_SortIn = 0;

                    move2obj_XMLStruct[] array_tSortRow_8_SortIn = (move2obj_XMLStruct[]) globalMap
                            .get("tSortRow_8");

                    int nb_line_tSortRow_8_SortIn = 0;

                    move2obj_XMLStruct current_tSortRow_8_SortIn = null;

                    for (int i_tSortRow_8_SortIn = 0; i_tSortRow_8_SortIn < array_tSortRow_8_SortIn.length; i_tSortRow_8_SortIn++) {
                        current_tSortRow_8_SortIn = array_tSortRow_8_SortIn[i_tSortRow_8_SortIn];
                        row3.objectNum = current_tSortRow_8_SortIn.objectNum;
                        row3.obj_CSID = current_tSortRow_8_SortIn.obj_CSID;
                        row3.obj_uri = current_tSortRow_8_SortIn.obj_uri;
                        row3.obj_refname = current_tSortRow_8_SortIn.obj_refname;
                        row3.objectDocType = current_tSortRow_8_SortIn.objectDocType;
                        row3.moveID = current_tSortRow_8_SortIn.moveID;
                        row3.move_CSID = current_tSortRow_8_SortIn.move_CSID;
                        row3.move_URI = current_tSortRow_8_SortIn.move_URI;
                        row3.move_refname = current_tSortRow_8_SortIn.move_refname;
                        row3.subjectDocType = current_tSortRow_8_SortIn.subjectDocType;
                        row3.loc_refName = current_tSortRow_8_SortIn.loc_refName;
                        row3.move_timestamp = current_tSortRow_8_SortIn.move_timestamp;
                        row3.move2obj_CSID = current_tSortRow_8_SortIn.move2obj_CSID;
                        // increase number of line sorted
                        nb_line_tSortRow_8_SortIn++;

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

                        currentComponent = "tSortRow_8_SortIn";

                        tos_count_tSortRow_8_SortIn++;

                        /**
                         * [tSortRow_8_SortIn main ] stop
                         */

                        /**
                         * [tAdvancedFileOutputXML_2 main ] start
                         */

                        currentComponent = "tAdvancedFileOutputXML_2";

                        nb_line_tAFOX_2++;
                        valueMap_tAFOX_2.clear();
                        valueMap_tAFOX_2.put("objectNum",
                                (row3.objectNum != null ? row3.objectNum.toString() : null));
                        valueMap_tAFOX_2.put("obj_CSID",
                                (row3.obj_CSID != null ? row3.obj_CSID.toString() : null));
                        valueMap_tAFOX_2.put("obj_uri", (row3.obj_uri.toString()));
                        valueMap_tAFOX_2.put("obj_refname", (row3.obj_refname.toString()));
                        valueMap_tAFOX_2.put("objectDocType",
                                (row3.objectDocType != null ? row3.objectDocType.toString() : null));
                        valueMap_tAFOX_2.put("moveID", (row3.moveID != null ? row3.moveID.toString() : null));
                        valueMap_tAFOX_2.put("move_CSID",
                                (row3.move_CSID != null ? row3.move_CSID.toString() : null));
                        valueMap_tAFOX_2.put("move_URI",
                                (row3.move_URI != null ? row3.move_URI.toString() : null));
                        valueMap_tAFOX_2.put("move_refname", (row3.move_refname.toString()));
                        valueMap_tAFOX_2.put("subjectDocType",
                                (row3.subjectDocType != null ? row3.subjectDocType.toString() : null));
                        valueMap_tAFOX_2.put("loc_refName",
                                (row3.loc_refName != null ? row3.loc_refName.toString() : null));
                        valueMap_tAFOX_2.put("move_timestamp",
                                (row3.move_timestamp != null ? row3.move_timestamp.toString() : null));
                        valueMap_tAFOX_2.put("move2obj_CSID", (row3.move2obj_CSID.toString()));
                        org.dom4j.Element subTreeRootParent_tAFOX_2 = null;

                        // build root xml tree
                        if (needRoot_tAFOX_2) {
                            needRoot_tAFOX_2 = false;
                            if (orders_tAFOX_2.length > 0) {
                                orders_tAFOX_2[0] = 0;
                            }
                            org.dom4j.Element root_tAFOX_2 = doc_tAFOX_2.addElement("imports");
                            subTreeRootParent_tAFOX_2 = root_tAFOX_2;
                            root4Group_tAFOX_2 = subTreeRootParent_tAFOX_2;
                        } else {
                            subTreeRootParent_tAFOX_2 = root4Group_tAFOX_2;
                        }
                        // build group xml tree
                        // build loop xml tree
                        org.dom4j.Element loop_tAFOX_2 = org.dom4j.DocumentHelper.createElement("import");
                        if (orders_tAFOX_2[0] == 0) {
                            orders_tAFOX_2[0] = 0;
                        }
                        if (1 < orders_tAFOX_2.length) {
                            orders_tAFOX_2[1] = 0;
                        }
                        subTreeRootParent_tAFOX_2.elements().add(orders_tAFOX_2[0]++, loop_tAFOX_2);
                        loop_tAFOX_2.addAttribute("service", "Relations");
                        loop_tAFOX_2.addAttribute("type", "Relation");
                        if (valueMap_tAFOX_2.get("move2obj_CSID") != null) {
                            loop_tAFOX_2.addAttribute("CSID", valueMap_tAFOX_2.get("move2obj_CSID"));
                        }
                        org.dom4j.Element loop_0_tAFOX_2 = loop_tAFOX_2.addElement("schema");
                        loop_0_tAFOX_2.addNamespace("relations_common",
                                TalendString.replaceSpecialCharForXML("http://collectionspace.org/relation"));
                        loop_0_tAFOX_2.addAttribute("name", "relations_common");
                        org.dom4j.Element loop_0_0_tAFOX_2;
                        if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_0_tAFOX_2 = loop_0_tAFOX_2.addElement("relationshipType");
                        } else {
                            loop_0_0_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:relationshipType");
                        }
                        nestXMLTool_tAFOX_2.parseAndAdd(loop_0_0_tAFOX_2, "affects");

                        loop_0_0_tAFOX_2.setName("relations_common:relationshipType");
                        org.dom4j.Element loop_0_1_tAFOX_2;
                        if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_1_tAFOX_2 = loop_0_tAFOX_2.addElement("subjectCsid");
                        } else {
                            loop_0_1_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:subjectCsid");
                        }
                        if (valueMap_tAFOX_2.get("move_CSID") != null) {
                            nestXMLTool_tAFOX_2.setText(loop_0_1_tAFOX_2, valueMap_tAFOX_2.get("move_CSID"));
                        }
                        loop_0_1_tAFOX_2.setName("relations_common:subjectCsid");
                        org.dom4j.Element loop_0_2_tAFOX_2;
                        if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_2_tAFOX_2 = loop_0_tAFOX_2.addElement("subjectDocumentType");
                        } else {
                            loop_0_2_tAFOX_2 = loop_0_tAFOX_2
                                    .addElement("relations_common:subjectDocumentType");
                        }
                        if (valueMap_tAFOX_2.get("subjectDocType") != null) {
                            nestXMLTool_tAFOX_2.setText(loop_0_2_tAFOX_2,
                                    valueMap_tAFOX_2.get("subjectDocType"));
                        }
                        loop_0_2_tAFOX_2.setName("relations_common:subjectDocumentType");
                        org.dom4j.Element loop_0_3_tAFOX_2;
                        if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_3_tAFOX_2 = loop_0_tAFOX_2.addElement("subjectUri");
                        } else {
                            loop_0_3_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:subjectUri");
                        }
                        if (valueMap_tAFOX_2.get("move_URI") != null) {
                            nestXMLTool_tAFOX_2.setText(loop_0_3_tAFOX_2, valueMap_tAFOX_2.get("move_URI"));
                        }
                        loop_0_3_tAFOX_2.setName("relations_common:subjectUri");
                        org.dom4j.Element loop_0_4_tAFOX_2;
                        if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_4_tAFOX_2 = loop_0_tAFOX_2.addElement("subjectRefName");
                        } else {
                            loop_0_4_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:subjectRefName");
                        }
                        if (valueMap_tAFOX_2.get("move_refname") != null) {
                            nestXMLTool_tAFOX_2.setText(loop_0_4_tAFOX_2, valueMap_tAFOX_2.get("move_refname"));
                        }
                        loop_0_4_tAFOX_2.setName("relations_common:subjectRefName");
                        org.dom4j.Element loop_0_5_tAFOX_2;
                        if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_5_tAFOX_2 = loop_0_tAFOX_2.addElement("predicateDisplayName");
                        } else {
                            loop_0_5_tAFOX_2 = loop_0_tAFOX_2
                                    .addElement("relations_common:predicateDisplayName");
                        }
                        loop_0_5_tAFOX_2.setName("relations_common:predicateDisplayName");
                        org.dom4j.Element loop_0_6_tAFOX_2;
                        if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_6_tAFOX_2 = loop_0_tAFOX_2.addElement("predicate");
                        } else {
                            loop_0_6_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:predicate");
                        }
                        loop_0_6_tAFOX_2.setName("relations_common:predicate");
                        org.dom4j.Element loop_0_7_tAFOX_2;
                        if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_7_tAFOX_2 = loop_0_tAFOX_2.addElement("objectCsid");
                        } else {
                            loop_0_7_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:objectCsid");
                        }
                        if (valueMap_tAFOX_2.get("obj_CSID") != null) {
                            nestXMLTool_tAFOX_2.setText(loop_0_7_tAFOX_2, valueMap_tAFOX_2.get("obj_CSID"));
                        }
                        loop_0_7_tAFOX_2.setName("relations_common:objectCsid");
                        org.dom4j.Element loop_0_8_tAFOX_2;
                        if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_8_tAFOX_2 = loop_0_tAFOX_2.addElement("objectUri");
                        } else {
                            loop_0_8_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:objectUri");
                        }
                        if (valueMap_tAFOX_2.get("obj_uri") != null) {
                            nestXMLTool_tAFOX_2.setText(loop_0_8_tAFOX_2, valueMap_tAFOX_2.get("obj_uri"));
                        }
                        loop_0_8_tAFOX_2.setName("relations_common:objectUri");
                        org.dom4j.Element loop_0_9_tAFOX_2;
                        if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_9_tAFOX_2 = loop_0_tAFOX_2.addElement("objectRefName");
                        } else {
                            loop_0_9_tAFOX_2 = loop_0_tAFOX_2.addElement("relations_common:objectRefName");
                        }
                        if (valueMap_tAFOX_2.get("obj_refname") != null) {
                            nestXMLTool_tAFOX_2.setText(loop_0_9_tAFOX_2, valueMap_tAFOX_2.get("obj_refname"));
                        }
                        loop_0_9_tAFOX_2.setName("relations_common:objectRefName");
                        org.dom4j.Element loop_0_10_tAFOX_2;
                        if (loop_0_tAFOX_2.getNamespaceForPrefix("relations_common") == null) {
                            loop_0_10_tAFOX_2 = loop_0_tAFOX_2.addElement("objectDocumentType");
                        } else {
                            loop_0_10_tAFOX_2 = loop_0_tAFOX_2
                                    .addElement("relations_common:objectDocumentType");
                        }
                        if (valueMap_tAFOX_2.get("objectDocType") != null) {
                            nestXMLTool_tAFOX_2.setText(loop_0_10_tAFOX_2,
                                    valueMap_tAFOX_2.get("objectDocType"));
                        }
                        loop_0_10_tAFOX_2.setName("relations_common:objectDocumentType");
                        currentRowCount_tAFOX_2++;
                        if (currentRowCount_tAFOX_2 == 1000) {
                            needRoot_tAFOX_2 = true;
                            fileName_tAFOX_2 = file_tAFOX_2 + currentFileCount_tAFOX_2 + suffix_tAFOX_2;
                            currentRowCount_tAFOX_2 = 0;
                            currentFileCount_tAFOX_2++;
                            groupbyList_tAFOX_2.clear();

                            java.io.FileOutputStream stream_tAFOX_2 = new java.io.FileOutputStream(
                                    fileName_tAFOX_2);
                            org.dom4j.io.XMLWriter output_tAFOX_2 = new org.dom4j.io.XMLWriter(stream_tAFOX_2,
                                    format_tAFOX_2);
                            nestXMLTool_tAFOX_2.replaceDefaultNameSpace(doc_tAFOX_2.getRootElement());
                            output_tAFOX_2.write(doc_tAFOX_2);
                            output_tAFOX_2.close();
                            doc_tAFOX_2 = org.dom4j.DocumentHelper.createDocument();
                            groupElementList_tAFOX_2.clear();
                        }

                        tos_count_tAdvancedFileOutputXML_2++;

                        /**
                         * [tAdvancedFileOutputXML_2 main ] stop
                         */

                        /**
                         * [tSortRow_8_SortIn end ] start
                         */

                        currentComponent = "tSortRow_8_SortIn";

                    }

                    globalMap.put("tSortRow_8_SortIn_NB_LINE", nb_line_tSortRow_8_SortIn);

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

                    /**
                     * [tSortRow_8_SortIn end ] stop
                     */

                    /**
                     * [tAdvancedFileOutputXML_2 end ] start
                     */

                    currentComponent = "tAdvancedFileOutputXML_2";

                    if (currentRowCount_tAFOX_2 > 0) {
                        java.io.FileOutputStream stream_tAFOX_2 = new java.io.FileOutputStream(
                                file_tAFOX_2 + currentFileCount_tAFOX_2 + suffix_tAFOX_2);
                        org.dom4j.io.XMLWriter output_tAFOX_2 = new org.dom4j.io.XMLWriter(stream_tAFOX_2,
                                format_tAFOX_2);
                        if (doc_tAFOX_2.getRootElement() != null) {
                            nestXMLTool_tAFOX_2.replaceDefaultNameSpace(doc_tAFOX_2.getRootElement());
                            output_tAFOX_2.write(doc_tAFOX_2);
                        }
                        output_tAFOX_2.close();
                    }
                    globalMap.put("tAdvancedFileOutputXML_2_NB_LINE", nb_line_tAFOX_2);

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

                    /**
                     * [tAdvancedFileOutputXML_2 end ] stop
                     */

                    /**
                     * [tFileOutputDelimited_4 end ] start
                     */

                    currentComponent = "tFileOutputDelimited_4";

                } finally {
                    if (outtFileOutputDelimited_4 != null) {
                        outtFileOutputDelimited_4.flush();
                        outtFileOutputDelimited_4.close();
                    }
                    globalMap.put("tFileOutputDelimited_4_NB_LINE", nb_line_tFileOutputDelimited_4);
                    globalMap.put("tFileOutputDelimited_4_FILE_NAME", fileName_tFileOutputDelimited_4);
                } // finally

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

                /**
                 * [tFileOutputDelimited_4 end ] stop
                 */

                /**
                 * [tFileOutputDelimited_5 end ] start
                 */

                currentComponent = "tFileOutputDelimited_5";

            } finally {
                if (outtFileOutputDelimited_5 != null) {
                    outtFileOutputDelimited_5.flush();
                    outtFileOutputDelimited_5.close();
                }
                globalMap.put("tFileOutputDelimited_5_NB_LINE", nb_line_tFileOutputDelimited_5);
                globalMap.put("tFileOutputDelimited_5_FILE_NAME", fileName_tFileOutputDelimited_5);
            } // finally

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

            /**
             * [tFileOutputDelimited_5 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 "tSortRow_8_SortIn"
        globalMap.put("tSortRow_8", null);

        // free memory for "tSortRow_6_SortIn"
        globalMap.put("tSortRow_6", null);

        // free memory for "tMap_1"
        globalMap.put("tHash_Lookup_barcode_no_obj_yet", null);

    }

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

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 {// www  .  j ava2  s  . co  m

        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:pm.inout.PM_IndexFileXML.java

License:Open Source License

/**
 * Delete irreversible all invalid pictures and metadata.
 * /*from w w w.jav a  2  s . c om*/
 */
public int deletePictureInvalid(File dirOrigFile) {
    int size = pictureInvalid.size();
    if (size == 0) {
        return 0;
    }
    Element rootElement = document.getRootElement();
    for (String id : pictureInvalid.keySet()) {
        // alle Dateien lschen
        File orig = new File(dirOrigFile, id);
        PM_Utils.getFileThumbnail(orig).delete();
        for (File f : PM_Utils.getFilesBearbeitet(orig)) {
            f.delete();
        }
        orig.delete();
        // XML-Element lschen   
        rootElement.remove(pictureInvalid.get(id));
    }
    pictureInvalid.clear();
    if (size != 0) {
        writeDocument();
    }

    return size;
}

From source file:pt.webdetails.cdf.dd.model.meta.writer.cdexml.XmlComponentTypeWriter.java

License:Mozilla Public License

public void write(java.lang.Object output, IThingWriteContext context, Thing t) throws ThingWriteException {
    //TODO: use methods instead of comments to segment this
    ComponentType comp = (ComponentType) t;
    Branch parent = (Branch) output; // Element or Document

    Element compElem = parent.addElement("DesignerComponent");

    writeHeader(comp, compElem);//  w w w.  j a  va 2s . c  om

    Attribute cdeModelIgnoreAttr = comp.tryGetAttribute("cdeModelIgnore");
    Attribute cdeModelPrefixAttr = comp.tryGetAttribute("cdeModelPrefix");
    int ignoreCount = 0;
    if (cdeModelIgnoreAttr != null) {
        ignoreCount++;
    }
    if (cdeModelPrefixAttr != null) {
        ignoreCount++;
    }

    if (comp.getAttributeCount() > ignoreCount) {
        writeMetadata(comp, compElem);
    }

    // ----------------
    // CONTENTS
    Element contentsElem = compElem.addElement("Contents");

    Element modelElem = contentsElem.addElement("Model");
    if (cdeModelIgnoreAttr != null) {
        modelElem.addAttribute("ignore", cdeModelIgnoreAttr.getValue());
    }

    if (cdeModelPrefixAttr != null) {
        modelElem.addAttribute("prefix", cdeModelPrefixAttr.getValue());
    }

    // Property Usages
    for (String defName : comp.getDefinitionNames()) {
        Element definitionElem;
        Iterable<PropertyTypeUsage> propUsages = comp.getPropertiesByDefinition(defName);
        if (StringUtils.isEmpty(defName)) {
            definitionElem = modelElem;
        } else {
            definitionElem = modelElem.addElement("Definition");
            definitionElem.addAttribute("name", defName);
        }

        for (PropertyTypeUsage propUsage : propUsages) {
            String propName = propUsage.getProperty().getName();

            // TODO: exclusion of "system" properties should not be done
            // in such an explicit way.
            if (!"name".equalsIgnoreCase(propName) && !"priority".equalsIgnoreCase(propName)) {
                Element propertyElem = definitionElem.addElement("Property");

                propertyElem.setText(propName);

                String propAlias = propUsage.getAlias();
                if (propAlias != null && !propAlias.equals(propName)) {
                    propertyElem.addAttribute("name", propAlias);
                }
            }
        }
    }

    // ------------------------
    // CONTENTS / IMPLEMENTATION
    Element implElem = null;

    String implPath = comp.getImplementationPath();
    if (StringUtils.isNotEmpty(implPath)) {
        implElem = contentsElem.addElement("Implementation");

        implElem.addElement("Code").addAttribute("src", comp.getImplementationPath());
    }

    if (comp.getResourceCount() > 0) {
        if (implElem == null) {
            implElem = contentsElem.addElement("Implementation");
        }

        Element depsElem = implElem.addElement("Dependencies");
        Element stylesElem = implElem.addElement("Styles");
        Element rawElem = implElem.addElement("Raw");

        for (Resource res : comp.getResources()) {
            Element resElem;
            if (res.getType() == Resource.Type.SCRIPT) {
                // Script
                resElem = depsElem.addElement("Dependency");

                resElem.addAttribute("src", res.getSource());
                resElem.setText(res.getName());
            } else if (res.getType() == Resource.Type.STYLE) {
                resElem = stylesElem.addElement("Style");

                resElem.addAttribute("src", res.getSource());
                resElem.setText(res.getName());
            } else if (res.getType() == Resource.Type.RAW) {
                resElem = rawElem.addElement("Code"); // TODO: couldn't find any example using this so I made up the item tag name "Code"...

                resElem.addAttribute("name", res.getName());
                resElem.setText(res.getSource());
            } else {
                continue;
            }

            resElem.addAttribute("version", res.getVersion()).addAttribute("app", res.getApp());
        }

        if (!depsElem.hasContent()) {
            implElem.remove(depsElem);
        }
        if (!stylesElem.hasContent()) {
            implElem.remove(stylesElem);
        }
        if (!rawElem.hasContent()) {
            implElem.remove(rawElem);
        }
    }

    // OwnProperties
    if (comp.getPropertyUsageCount() > 0) {
        Element custPropsElem = null;

        IThingWriterFactory factory = context.getFactory();
        for (PropertyTypeUsage propUsage : comp.getPropertyUsages()) {
            if (propUsage.isOwned()) {
                if (custPropsElem == null) {
                    if (implElem == null) {
                        implElem = contentsElem.addElement("Implementation");
                    }

                    custPropsElem = implElem.addElement("CustomProperties");
                }

                PropertyType prop = propUsage.getProperty();
                IThingWriter writer;
                try {
                    writer = factory.getWriter(prop);
                } catch (UnsupportedThingException ex) {
                    throw new ThingWriteException(ex);
                }

                writer.write(custPropsElem, context, prop);
            }
        }
    }
}

From source file:revaligner.service.FileAligner.java

public boolean verifysegments() throws Exception {
    System.out.println("verifying segments mapping....");
    boolean isValid = false;
    ExtractionSupportImpl extractionSupportImpl = new ExtractionSupportImpl(
            Locale.makeLocale(this.sourcelanguage), Locale.makeLocale(this.targetlanguage));
    Configuration config = new BaseConfiguration();
    config.setProperty("extraction.tokens.extract", "all");
    extractionSupportImpl.setConfiguration(config);

    org.dom4j.Document document_source = XmlParser.parseXmlFile(this.sourcetxlf_seg);
    org.dom4j.Element root_source = document_source.getRootElement();

    List list_source = root_source.selectNodes("//*[name() = 'trans-unit']");
    int numberOfPara_source = list_source.size();

    List<org.dom4j.Element> text_source = new ArrayList();
    Iterator iter_source = list_source.iterator();
    while (iter_source.hasNext()) {
        org.dom4j.Element source = ((org.dom4j.Element) iter_source.next()).element("source");
        text_source.add(source);// w  w  w  .j ava2s  .  c  o m
    }
    List<String> mergedsegtext = new ArrayList();
    org.dom4j.Document alignedxml = XmlParser.parseXmlFile(this.alignedfile);
    org.dom4j.Element root = alignedxml.getRootElement();
    List groups = root.selectNodes("//*[name() = 'group']");
    for (int i = 0; i < groups.size(); i++) {
        org.dom4j.Element group = (org.dom4j.Element) groups.get(i);
        List units = group.elements("unit");
        ArrayList<String> keys = new ArrayList();
        ArrayList<String> key_left = new ArrayList();
        ArrayList<String> key_right = new ArrayList();
        ArrayList<String> org_keys = new ArrayList();
        for (int j = 0; j < units.size(); j++) {
            org.dom4j.Element unit = (org.dom4j.Element) units.get(j);
            org.dom4j.Element src_para = unit.element("src_para");
            if (src_para != null) {
                List segs = src_para.element("segments").elements("src_seg");
                for (int z = 0; z < segs.size(); z++) {
                    org.dom4j.Element seg = (org.dom4j.Element) segs.get(z);
                    keys.add(seg.getText().replaceAll("(?s)<del>.*?</del>", "").replaceAll("<(/)*ins>", "")
                            .replace("<br>", "").replace("&lt;", "<").replace("&gt;", ">").replace("&amp;", "&")
                            .trim());
                    org_keys.add(seg.getText());
                    if ((z == 0) && (z == segs.size() - 1)) {
                        key_left.add(src_para.attributeValue("lefttrim"));
                        key_right.add(src_para.attributeValue("righttrim"));
                    } else if (z == 0) {
                        key_left.add(src_para.attributeValue("lefttrim"));
                        key_right.add("true");
                    } else if (z == segs.size() - 1) {
                        key_left.add("true");
                        key_right.add(src_para.attributeValue("righttrim"));
                    } else {
                        key_left.add("true");
                        key_right.add("true");
                    }
                }
            }
        }
        SegmenterFactory factory = new SegmenterFactory();
        Configuration segconfig = createConfigForSegmenter(false, this.sourcelanguage);
        Segmenter segmenter = factory.getSegmenter("trados", Locale.makeLocale(this.sourcelanguage), segconfig);
        List<String> finsegs = segmenter.segment(
                group.elementText("text").replaceAll("(?s)<del>.*?</del>", "").replaceAll("<(/)*ins>", "")
                        .replace("<br>", "").replace("&lt;", "<").replace("&gt;", ">").replace("&amp;", "&"));
        ArrayList<ArrayList<Integer>> indices = new ArrayList();
        int key_start_index = 0;
        ArrayList<Integer> indice;
        for (int k = 0; k < finsegs.size(); k++) {
            String finsegtext = (String) finsegs.get(k);

            String combined_key = "";
            indice = new ArrayList();
            for (int x = key_start_index; x < keys.size(); x++) {
                combined_key = combined_key + (String) keys.get(x);

                indice.add(Integer.valueOf(x));
                if (combined_key.replace("", " ").trim().replaceAll("(\\s)+", "")
                        .equals(finsegtext.replace("", " ").trim().replaceAll("(\\s)+", ""))) {
                    indices.add(indice);
                    key_start_index = x + 1;
                    break;
                }
            }
        }
        for (int m = 0; m < indices.size(); m++) {
            ArrayList<Integer> temp_indice = (ArrayList) indices.get(m);
            String temp = "";
            for (int it : temp_indice) {
                temp = temp + (String) org_keys.get(it);
            }
            mergedsegtext.add(temp);
        }
    }
    List<String> rejectedtexts = new ArrayList();
    Workbook wb = new Workbook();
    Worksheet ws = wb.getWorksheets().get(0);
    Cells cells = ws.getCells();
    int count = Math.max(text_source.size(), mergedsegtext.size());
    int t_count = 0;
    for (int i = 0; i < count; i++) {
        String t_src = "";
        String t_fom = "";
        if (i < text_source.size()) {
            org.dom4j.Element src = (org.dom4j.Element) text_source.get(i);
            for (int j = 0; j < src.content().size(); j++) {
                if ((src.content().get(j) instanceof org.dom4j.Text)) {
                    t_src = t_src + ((org.dom4j.Text) src.content().get(j)).getText().replace("&", "&amp;")
                            .replace("<", "&lt;").replace(">", "&gt;");
                } else if ((src.content().get(j) instanceof org.dom4j.Element)) {
                    org.dom4j.Element e = (org.dom4j.Element) src.content().get(j);
                    if ((e.getName().equals("x")) && (e.attribute("ctype").getValue().equals("x-tab"))) {
                        t_src = t_src + " ";
                    } else if ((e.getName().equals("x")) && (e.attribute("ctype").getValue().equals("lb"))) {
                        t_src = t_src + "<br> ";
                    }
                }
            }
        }
        cells.get(i, 0).setHtmlString(t_src);
        if (i < mergedsegtext.size()) {
            t_fom = ((String) mergedsegtext.get(i)).replace("<ins>", "<u>").replace("</ins>", "</u>")
                    .replace("<del>", "<strike>").replace("</del>", "</strike>");
        }
        String accepted_t_fom = t_fom.replaceAll("(?s)<strike>.*?</strike>", "").replace("<u>", "")
                .replace("</u>", "").replace("&amp;paradel;", "").replace("<br>", "");
        String rejected_t_fom = t_fom.replaceAll("(?s)<u>.*?</u>", "").replace("<strike>", "")
                .replace("</strike>", "").replace("&amp;paradel;", "").replace("<br>", "");
        if (extractionSupportImpl.isExtractable(accepted_t_fom)) {
            String input = "<html>" + t_fom.replace("<br> ", "&#8629;<br>").replace("&amp;paradel;",
                    "<strike>&para;</strike><br>") + "</html>";

            cells.get(t_count, 1).setHtmlString(input);
            t_count++;
            if ((i < mergedsegtext.size())
                    && (TrackChangeHelper.getTrackChangeType((String) mergedsegtext.get(i)) == 3)) {
                rejectedtexts.add(rejected_t_fom);
            } else {
                rejectedtexts.add("");
            }
        }
    }
    wb.save(this.prjfolder + File.separator + "verifySegs.xlsx");
    if (numberOfPara_source == t_count) {
        System.out.println("result: TRUE source: " + numberOfPara_source + " formatted: " + t_count);
        isValid = true;

        String timestamp = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'").format(new Date());
        for (int r = 0; r < list_source.size(); r++) {
            if (!((String) rejectedtexts.get(r)).equals("")) {
                org.dom4j.Element transunit = (org.dom4j.Element) list_source.get(r);
                org.dom4j.Element originalbase = transunit.addElement("alt-trans");
                org.dom4j.Element source = transunit.element("source");
                org.dom4j.Element target = transunit.element("target");
                source.addAttribute("gs4tr:seginfo",
                        "<root username=\"TC Aligner\" timestamp=\"" + timestamp + "\"/>");
                if (target != null) {
                    transunit.elements().add(transunit.elements().indexOf(target) + 1, originalbase.clone());
                } else {
                    transunit.elements().add(transunit.elements().indexOf(source) + 1, originalbase.clone());
                }
                transunit.remove(originalbase);

                org.dom4j.Element original = transunit.element("alt-trans");
                original.addAttribute("alttranstype", "x-previous-source-version");
                original.addAttribute("gs4tr:seginfo",
                        "<root username=\"Original\" timestamp=\"" + timestamp + "\"/>");
                org.dom4j.Element original_source = original.addElement("source");
                original_source.addText((String) rejectedtexts.get(r));
                original.addElement("target");
            }
        }
        OutputStreamWriter writer = new OutputStreamWriter(
                new BufferedOutputStream(new FileOutputStream(this.sourcetxlf_seg)), "UTF8");
        document_source.write(writer);
        writer.close();
    } else {
        System.out.println("result: false source: " + numberOfPara_source + " formatted: " + t_count);
    }
    return isValid;
}

From source file:revaligner.service.FileAligner.java

public void update_seg(JSONArray targets, JSONArray trg_seqs, JSONArray missing_targets,
        JSONArray missing_trg_seqs, JSONArray locks, int cnt, JSONArray edited, JSONArray review,
        JSONArray ignore) throws Exception {
    File alignedFile = new File(this.alignedfile);
    if (!alignedFile.exists()) {
        throw new FileNotFoundException("Could not find aligned xml file");
    }/*from  ww w.j  a  va 2s.  c  om*/
    ExtractionSupportImpl extractionSupportImpl = new ExtractionSupportImpl(
            Locale.makeLocale(this.sourcelanguage), Locale.makeLocale(this.targetlanguage));
    Configuration config = new BaseConfiguration();
    config.setProperty("extraction.tokens.extract", "all");
    extractionSupportImpl.setConfiguration(config);

    List<String> trg_list = new ArrayList();
    for (int i = 0; i < targets.length(); i++) {
        trg_list.add(targets.getString(i));
    }
    List<String> trg_seq_list = new ArrayList();
    for (int i = 0; i < trg_seqs.length(); i++) {
        trg_seq_list.add(trg_seqs.getString(i));
    }
    List<String> missing_list = new ArrayList();
    for (int i = 0; i < missing_targets.length(); i++) {
        missing_list.add(missing_targets.getString(i));
    }
    List<String> missing_seq_list = new ArrayList();
    for (int i = 0; i < missing_trg_seqs.length(); i++) {
        missing_seq_list.add(missing_trg_seqs.getString(i));
    }
    List<String> locks_list = new ArrayList();
    for (int i = 0; i < locks.length(); i++) {
        locks_list.add(locks.getString(i));
    }
    this.nullcnt = cnt;

    List<String> edited_list = new ArrayList();
    for (int i = 0; i < edited.length(); i++) {
        edited_list.add(edited.getString(i));
    }
    List<String> review_list = new ArrayList();
    for (int i = 0; i < review.length(); i++) {
        review_list.add(review.getString(i));
    }
    List<String> ignore_list = new ArrayList();
    for (int i = 0; i < ignore.length(); i++) {
        ignore_list.add(ignore.getString(i));
    }
    int segcnt = 0;
    org.dom4j.Document document = XmlParser.parseXmlFile(this.alignedfile);
    org.dom4j.Element root = document.getRootElement();
    List<org.dom4j.Element> groups = document.getRootElement().element("aligned").elements("group");
    for (int i = 0; i < groups.size(); i++) {
        org.dom4j.Element group = (org.dom4j.Element) groups.get(i);

        List<org.dom4j.Element> units = group.elements("unit");
        for (int j = 0; j < units.size(); j++) {
            org.dom4j.Element unit = (org.dom4j.Element) units.get(j);
            unit.addAttribute("alignsegs", "true");
            org.dom4j.Element src_para = unit.element("src_para");
            if (src_para != null) {
                List<org.dom4j.Element> src_segs = src_para.element("segments").elements("src_seg");
                for (int z = 0; z < src_segs.size(); z++) {
                    org.dom4j.Element src_seg = (org.dom4j.Element) src_segs.get(z);
                    String seq = i + " - " + j + " - " + z;
                    if (locks_list.contains(seq)) {
                        src_seg.attribute("locked").setValue("true");
                    } else {
                        src_seg.attribute("locked").setValue("false");
                    }
                    if (review_list.contains(seq)) {
                        src_seg.attribute("needreview").setValue("true");
                    } else {
                        src_seg.attribute("needreview").setValue("false");
                    }
                    if (ignore_list.contains(seq)) {
                        src_seg.attribute("ignored").setValue("true");
                    } else {
                        src_seg.attribute("ignored").setValue("false");
                    }
                }
                org.dom4j.Element trg_para = unit.element("trg_para");
                trg_para.remove(trg_para.element("text"));
                List<org.dom4j.Element> trg_segs = trg_para.element("segments").elements("trg_seg");
                for (int z = 0; z < trg_segs.size(); z++) {
                    org.dom4j.Element trg_seg = (org.dom4j.Element) trg_segs.get(z);
                    if (z >= src_segs.size()) {
                        trg_para.element("segments").remove(trg_seg);
                    } else if (segcnt < trg_list.size()) {
                        trg_seg.addAttribute("id", decodehtmlstring((String) trg_seq_list.get(segcnt)));
                        if ((edited_list.contains(decodehtmlstring((String) trg_seq_list.get(segcnt))))
                                || (decodehtmlstring((String) trg_seq_list.get(segcnt)).startsWith("n - "))) {
                            trg_seg.addAttribute("edited", "true");
                        }
                        String text = decodehtmlstring((String) trg_list.get(segcnt));
                        trg_seg.addAttribute("isExtractable",
                                Boolean.toString(extractionSupportImpl.isExtractable(text)));
                        trg_seg.setText(text);
                        segcnt++;
                    } else {
                        trg_para.element("segments").remove(trg_seg);
                    }
                }
                if (trg_para.element("segments").elements("trg_seg").size() == 0) {
                    group.remove(unit);
                }
            } else {
                org.dom4j.Element trg_para = unit.element("trg_para");
                trg_para.remove(trg_para.element("text"));
                List<org.dom4j.Element> trg_segs = trg_para.element("segments").elements("trg_seg");
                for (int z = 0; z < trg_segs.size(); z++) {
                    org.dom4j.Element trg_seg = (org.dom4j.Element) trg_segs.get(z);
                    if (segcnt < trg_list.size()) {
                        trg_seg.addAttribute("id", decodehtmlstring((String) trg_seq_list.get(segcnt)));
                        if ((edited_list.contains(decodehtmlstring((String) trg_seq_list.get(segcnt))))
                                || (decodehtmlstring((String) trg_seq_list.get(segcnt)).startsWith("n - "))) {
                            trg_seg.addAttribute("edited", "true");
                        }
                        String text = decodehtmlstring((String) trg_list.get(segcnt));
                        trg_seg.addAttribute("isExtractable",
                                Boolean.toString(extractionSupportImpl.isExtractable(text)));
                        trg_seg.setText(text);
                        segcnt++;
                    } else {
                        trg_para.element("segments").remove(trg_seg);
                    }
                }
                if (trg_para.element("segments").elements("trg_seg").size() == 0) {
                    group.remove(unit);
                }
            }
        }
        if (group.elements("unit").size() == 0) {
            groups.remove(i);
            i--;
        }
    }
    if (segcnt < trg_list.size()) {
        org.dom4j.Element group = root.element("aligned").addElement("group");
        group.addAttribute("id", Integer.toString(groups.size()));
        org.dom4j.Element unit = group.addElement("unit");
        unit.addAttribute("id", "0");
        org.dom4j.Element trg_para = unit.addElement("trg_para");
        trg_para.addAttribute("id", Integer.toString(groups.size()) + " - 0");
        org.dom4j.Element trgsegs = trg_para.addElement("segments");
        for (int x = segcnt; x < trg_list.size(); x++) {
            String text = decodehtmlstring((String) trg_list.get(x));
            org.dom4j.Element trg_seg = trgsegs.addElement("trg_seg");
            trg_seg.addAttribute("id", decodehtmlstring((String) trg_seq_list.get(x)));
            if ((edited_list.contains(decodehtmlstring((String) trg_seq_list.get(x))))
                    || (decodehtmlstring((String) trg_seq_list.get(x)).startsWith("n - "))) {
                trg_seg.addAttribute("edited", "true");
            }
            trg_seg.addAttribute("isExtractable", Boolean.toString(extractionSupportImpl.isExtractable(text)));
            trg_seg.setText(text);
        }
    }
    org.dom4j.Element orphans = root.element("orphans");
    orphans.clearContent();
    org.dom4j.Element unit = orphans.addElement("unit");
    unit.addAttribute("id", "0");
    org.dom4j.Element trg_para = unit.addElement("trg_para");
    trg_para.addAttribute("id", "0 - 0");
    org.dom4j.Element trg_segs = trg_para.addElement("segments");
    for (int i = 0; i < missing_list.size(); i++) {
        org.dom4j.Element trg_seg = trg_segs.addElement("trg_seg");
        String text = decodehtmlstring((String) missing_list.get(i));
        trg_seg.addAttribute("id", decodehtmlstring((String) missing_seq_list.get(i)));
        if ((edited_list.contains(decodehtmlstring((String) missing_seq_list.get(i))))
                || (decodehtmlstring((String) trg_seq_list.get(i)).startsWith("n - "))) {
            trg_seg.addAttribute("edited", "true");
        }
        trg_seg.addAttribute("isExtractable", Boolean.toString(extractionSupportImpl.isExtractable(text)));
        trg_seg.setText(text);
    }
    new File(this.alignedfile).delete();
    OutputStreamWriter writer = new OutputStreamWriter(
            new BufferedOutputStream(new FileOutputStream(this.alignedfile)), "UTF8");
    document.write(writer);
    writer.close();
    if (new File(this.auto_saved_alignedfile).exists()) {
        new File(this.auto_saved_alignedfile).delete();
    }
}

From source file:revaligner.service.FileAligner.java

public void auto_update_seg(JSONArray targets, JSONArray trg_seqs, JSONArray missing_targets,
        JSONArray missing_trg_seqs, JSONArray locks, int cnt, JSONArray edited, JSONArray review,
        JSONArray ignore) throws Exception {
    File alignedFile = new File(this.alignedfile);
    if (!alignedFile.exists()) {
        throw new FileNotFoundException("Could not find aligned xml file");
    }/*  w  w  w.ja  va 2  s  .c  o m*/
    ExtractionSupportImpl extractionSupportImpl = new ExtractionSupportImpl(
            Locale.makeLocale(this.sourcelanguage), Locale.makeLocale(this.targetlanguage));
    Configuration config = new BaseConfiguration();
    config.setProperty("extraction.tokens.extract", "all");
    extractionSupportImpl.setConfiguration(config);

    List<String> trg_list = new ArrayList();
    for (int i = 0; i < targets.length(); i++) {
        trg_list.add(targets.getString(i));
    }
    List<String> trg_seq_list = new ArrayList();
    for (int i = 0; i < trg_seqs.length(); i++) {
        trg_seq_list.add(trg_seqs.getString(i));
    }
    List<String> missing_list = new ArrayList();
    for (int i = 0; i < missing_targets.length(); i++) {
        missing_list.add(missing_targets.getString(i));
    }
    List<String> missing_seq_list = new ArrayList();
    for (int i = 0; i < missing_trg_seqs.length(); i++) {
        missing_seq_list.add(missing_trg_seqs.getString(i));
    }
    List<String> locks_list = new ArrayList();
    for (int i = 0; i < locks.length(); i++) {
        locks_list.add(locks.getString(i));
    }
    this.nullcnt = cnt;

    List<String> edited_list = new ArrayList();
    for (int i = 0; i < edited.length(); i++) {
        edited_list.add(edited.getString(i));
    }
    List<String> review_list = new ArrayList();
    for (int i = 0; i < review.length(); i++) {
        review_list.add(review.getString(i));
    }
    List<String> ignore_list = new ArrayList();
    for (int i = 0; i < ignore.length(); i++) {
        ignore_list.add(ignore.getString(i));
    }
    int segcnt = 0;
    org.dom4j.Document document = XmlParser.parseXmlFile(this.alignedfile);
    org.dom4j.Element root = document.getRootElement();
    List<org.dom4j.Element> groups = document.getRootElement().element("aligned").elements("group");
    for (int i = 0; i < groups.size(); i++) {
        org.dom4j.Element group = (org.dom4j.Element) groups.get(i);

        List<org.dom4j.Element> units = group.elements("unit");
        for (int j = 0; j < units.size(); j++) {
            org.dom4j.Element unit = (org.dom4j.Element) units.get(j);
            unit.addAttribute("alignsegs", "true");
            org.dom4j.Element src_para = unit.element("src_para");
            if (src_para != null) {
                List<org.dom4j.Element> src_segs = src_para.element("segments").elements("src_seg");
                for (int z = 0; z < src_segs.size(); z++) {
                    org.dom4j.Element src_seg = (org.dom4j.Element) src_segs.get(z);
                    String seq = i + " - " + j + " - " + z;
                    if (locks_list.contains(seq)) {
                        src_seg.attribute("locked").setValue("true");
                    } else {
                        src_seg.attribute("locked").setValue("false");
                    }
                    if (review_list.contains(seq)) {
                        src_seg.attribute("needreview").setValue("true");
                    } else {
                        src_seg.attribute("needreview").setValue("false");
                    }
                    if (ignore_list.contains(seq)) {
                        src_seg.attribute("ignored").setValue("true");
                    } else {
                        src_seg.attribute("ignored").setValue("false");
                    }
                }
                org.dom4j.Element trg_para = unit.element("trg_para");
                trg_para.remove(trg_para.element("text"));
                List<org.dom4j.Element> trg_segs = trg_para.element("segments").elements("trg_seg");
                for (int z = 0; z < trg_segs.size(); z++) {
                    org.dom4j.Element trg_seg = (org.dom4j.Element) trg_segs.get(z);
                    if (z >= src_segs.size()) {
                        trg_para.element("segments").remove(trg_seg);
                    } else if (segcnt < trg_list.size()) {
                        trg_seg.addAttribute("id", decodehtmlstring((String) trg_seq_list.get(segcnt)));
                        if ((edited_list.contains(decodehtmlstring((String) trg_seq_list.get(segcnt))))
                                || (decodehtmlstring((String) trg_seq_list.get(segcnt)).startsWith("n - "))) {
                            trg_seg.addAttribute("edited", "true");
                        }
                        String text = decodehtmlstring((String) trg_list.get(segcnt));
                        trg_seg.addAttribute("isExtractable",
                                Boolean.toString(extractionSupportImpl.isExtractable(text)));
                        trg_seg.setText(text);
                        segcnt++;
                    } else {
                        trg_para.element("segments").remove(trg_seg);
                    }
                }
                if (trg_para.element("segments").elements("trg_seg").size() == 0) {
                    group.remove(unit);
                }
            } else {
                org.dom4j.Element trg_para = unit.element("trg_para");
                trg_para.remove(trg_para.element("text"));
                List<org.dom4j.Element> trg_segs = trg_para.element("segments").elements("trg_seg");
                for (int z = 0; z < trg_segs.size(); z++) {
                    org.dom4j.Element trg_seg = (org.dom4j.Element) trg_segs.get(z);
                    if (segcnt < trg_list.size()) {
                        trg_seg.addAttribute("id", decodehtmlstring((String) trg_seq_list.get(segcnt)));
                        if ((edited_list.contains(decodehtmlstring((String) trg_seq_list.get(segcnt))))
                                || (decodehtmlstring((String) trg_seq_list.get(segcnt)).startsWith("n - "))) {
                            trg_seg.addAttribute("edited", "true");
                        }
                        String text = decodehtmlstring((String) trg_list.get(segcnt));
                        trg_seg.addAttribute("isExtractable",
                                Boolean.toString(extractionSupportImpl.isExtractable(text)));
                        trg_seg.setText(text);
                        segcnt++;
                    } else {
                        trg_para.element("segments").remove(trg_seg);
                    }
                }
                if (trg_para.element("segments").elements("trg_seg").size() == 0) {
                    group.remove(unit);
                }
            }
        }
        if (group.elements("unit").size() == 0) {
            groups.remove(i);
            i--;
        }
    }
    if (segcnt < trg_list.size()) {
        org.dom4j.Element group = root.element("aligned").addElement("group");
        group.addAttribute("id", Integer.toString(groups.size()));
        org.dom4j.Element unit = group.addElement("unit");
        unit.addAttribute("id", "0");
        org.dom4j.Element trg_para = unit.addElement("trg_para");
        org.dom4j.Element trgsegs = trg_para.addElement("segments");
        for (int x = segcnt; x < trg_list.size(); x++) {
            String text = decodehtmlstring((String) trg_list.get(x));
            org.dom4j.Element trg_seg = trgsegs.addElement("trg_seg");
            trg_seg.addAttribute("id", decodehtmlstring((String) trg_seq_list.get(x)));
            if ((edited_list.contains(decodehtmlstring((String) trg_seq_list.get(x))))
                    || (decodehtmlstring((String) trg_seq_list.get(x)).startsWith("n - "))) {
                trg_seg.addAttribute("edited", "true");
            }
            trg_seg.addAttribute("isExtractable", Boolean.toString(extractionSupportImpl.isExtractable(text)));
            trg_seg.setText(text);
        }
    }
    org.dom4j.Element orphans = root.element("orphans");
    orphans.clearContent();
    org.dom4j.Element unit = orphans.addElement("unit");
    unit.addAttribute("id", "0");
    org.dom4j.Element trg_para = unit.addElement("trg_para");
    org.dom4j.Element trg_segs = trg_para.addElement("segments");
    for (int i = 0; i < missing_list.size(); i++) {
        org.dom4j.Element trg_seg = trg_segs.addElement("trg_seg");
        String text = decodehtmlstring((String) missing_list.get(i));
        trg_seg.addAttribute("id", decodehtmlstring((String) missing_seq_list.get(i)));
        if ((edited_list.contains(decodehtmlstring((String) missing_seq_list.get(i))))
                || (decodehtmlstring((String) trg_seq_list.get(i)).startsWith("n - "))) {
            trg_seg.addAttribute("edited", "true");
        }
        trg_seg.addAttribute("isExtractable", Boolean.toString(extractionSupportImpl.isExtractable(text)));
        trg_seg.setText(text);
    }
    this.auto_saved_alignedfile = (this.alignedfile + ".temp");
    if (new File(this.auto_saved_alignedfile).exists()) {
        new File(this.auto_saved_alignedfile).delete();
    }
    OutputStreamWriter writer = new OutputStreamWriter(
            new BufferedOutputStream(new FileOutputStream(this.auto_saved_alignedfile)), "UTF8");
    document.write(writer);
    writer.close();
}