Package org.jitterbit.integration.data.structure.text

Examples of org.jitterbit.integration.data.structure.text.Segment


    }

    private void processRowsUnderRenamedSegment(Segment renamedSegment, String oldName, int rowIndex,
                    Segment topSegmentWithOldName) {
        for (int row = rowIndex + 1; row < getRowCount(); ++row) {
            Segment child = getSegment(row);
            if (topSegmentWithOldName == null && child.alias == renamedSegment) {
                // The renamed segment was used as the alias for the
                // current child segment. Since the alias has been
                // renamed we must now break the alias link:
                child.alias = null;
                copyFieldList(renamedSegment, child);
            }

            String parentName = child.getParentName();
            if (parentName != null && parentName.equals(oldName)) {
                // Update the parent field with the new name:
                setValueAt(renamedSegment.getName(), row, PARENT);
            }
        }
View Full Code Here


    }

    private void processRowsAboveRenamedSegment(Segment renamedSegment, int rowIndex, Segment topSegmentWithOldName) {
        // If the renamedSegment has been given the same name as any of
        // its predecessors, we use the alias:
        Segment topSegmentWithNewName = null;
        for (int row = 0; row < rowIndex; ++row) {
            Segment s = getSegment(row);
            if (s.getName().equals(renamedSegment.getName())) {
                topSegmentWithNewName = s;
                break;
            }
        }
        if (topSegmentWithNewName != null) {
View Full Code Here

        Map<Segment, CROM> map = Maps.newHashMap();
        CROM root=null;
        boolean isFixedField=text.isFixField();
        boolean bExtDefinedForRoot=false;
        for (Segment s : text.getSegmentList()) {
            Segment parent = s.findParent(text);
            CROM parent_crom=map.get(parent);
            CROM crom=new CROM(parent_crom, true, s.getName(), -1, CromType.CROM_t_Text);
            if(parent_crom==null){
              crom.addType(CROM.CROM_t_Root);
            }
View Full Code Here

public class SimpleTextStructureMappingTreeConverter {

    public MappingTreeStructure convert(SimpleTextStructure text, CallbackResult callback) {
        CROM root=new CROM(null, true, "", -1, CromType.CROM_t_Text);
        root.addType(CROM.CROM_t_Root);
        Segment seg=text.getSegment();
        CROM flat_node=new CROM(root, true, seg.getName(), -1, CromType.CROM_t_Text);
        flat_node.addType(CROM.CROM_t_Collection);
        if(text.getDelimiter()!=null || text.getStringQualifier()!=null){
          CROM_ext ext=flat_node.getExtension();
          if(ext==null)ext=new CROM_Text();        
            if(text.getDelimiter()!=null)ext.setDelimiter(Utils.getDelimiterString(text));
View Full Code Here

    }

    private static TextDocument createValidSimpleDelimitedDocument(int numberOfFields) {
        TextDocument doc = new TextDocument("Test");
        SimpleTextStructure struct = new SimpleTextStructure(doc.getName(), false);
        Segment seg = new Segment("seg_1");
        for (int n = 0; n < numberOfFields; ++n) {
            Field f = new Field(n, "F" + n, FieldDataType.String.name(), "", "", 0, false);
            seg.getFieldList().add(f);
        }
        struct.setSegment(seg);
        doc.setStructure(struct);
        doc.setDelimiter(FieldDelimiter.COMMA);
        return doc;
View Full Code Here

        return doc;
    }

    private static TextDocument createValidSimpleFixedFieldDocument() {
        TextDocument doc = new TextDocument("Test");
        Segment seg = new Segment("seg_1");
        SimpleTextStructure struct = new SimpleTextStructure(doc.getName(), true);
        Field field_1 = new Field(1, "A", FieldDataType.String.name(), "", "", 0, true);
        field_1.setBeginPosition(0);
        field_1.setLength(2);
        seg.getFieldList().add(field_1);
        Field field_2 = new Field(1, "B", FieldDataType.String.name(), "", "", 0, true);
        field_2.setBeginPosition(2);
        field_2.setLength(4);
        seg.getFieldList().add(field_2);
        struct.setSegment(seg);
        doc.setStructure(struct);
        doc.setDelimiter(FieldDelimiter.COMMA);
        return doc;
    }
View Full Code Here

        return doc;
    }

    private static ComplexTextStructure createValidComplexDelimitedTextStructure() {
        ComplexTextStructure s = new ComplexTextStructure("Complex", false);
        Segment root = Segment.newRootSegment();
        s.addSegment(root);
        Segment order = new Segment("Order");
        order.setOccurrence(SegmentOccurrence.ZeroOrMore);
        order.setParentName(root.getName());
        Field id = Field.newDelimitedIdentifier("O");
        order.fieldList.add(id);
        Field date = new Field(1, "Date", FieldDataType.Date.name(), "", "", 0, 0, 0, id);
        order.fieldList.add(date);
        s.addSegment(order);
View Full Code Here

        return s;
    }

    private static ComplexTextStructure createComplexDelimitedTextStructureWithEmptySegment() {
        ComplexTextStructure s = new ComplexTextStructure("Complex", false);
        Segment root = Segment.newRootSegment();
        s.addSegment(root);
        Segment order = new Segment("Order");
        order.setOccurrence(SegmentOccurrence.ZeroOrMore);
        order.setParentName(root.getName());
        s.addSegment(order);
        return s;
    }
View Full Code Here

        return s;
    }

    private static ComplexTextStructure createComplexDelimitedTextStructureWithDuplicatedFieldName() {
        ComplexTextStructure s = new ComplexTextStructure("Complex", false);
        Segment root = Segment.newRootSegment();
        s.addSegment(root);
        Segment order = new Segment("Order");
        order.setOccurrence(SegmentOccurrence.ZeroOrMore);
        order.setParentName(root.getName());
        Field id = Field.newDelimitedIdentifier("O");
        order.fieldList.add(id);
        Field date = new Field(1, "Date", FieldDataType.Date.name(), "", "", 0, 0, 0, id);
        order.fieldList.add(date);
        Field anotherDate = new Field(2, "Date", FieldDataType.Date.name(), "", "", 0, 0, 0, date);
View Full Code Here

    }

    private ComplexTextStructure createComplexText(Node tableNode) {
        // TODO: If the same table is used several times we should use segment aliases.
        ComplexTextStructure structure = new ComplexTextStructure("", false);
        Segment root = Segment.newRootSegment();
        structure.addSegment(root);
        addSegmentForTable(tableNode, root.getName(), structure, new HashSet<String>());
        return structure;
    }
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.data.structure.text.Segment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.