Package org.jitterbit.integration.data.entity

Examples of org.jitterbit.integration.data.entity.TextDocument


        testStringQualifierValidationImpl(createValidSimpleFixedFieldDocument());
    }

    @Test
    public void testSimpleDelimitedStructureValidation() {
        TextDocument doc = createValidSimpleDelimitedDocument(2);
        SimpleTextStructure struct = (SimpleTextStructure) doc.getDataStructure();
        Field f0 = struct.getSegment().getFieldList().get(0);
        Field f1 = struct.getSegment().getFieldList().get(1);
        f1.setName(f0.getName());
        runValidation(doc, ValidationStatus.INVALID);
    }
View Full Code Here


        runValidation(doc, ValidationStatus.INVALID);
    }

    @Test
    public void testSimpleFixedFieldStructureValidation() {
        TextDocument doc = createValidSimpleFixedFieldDocument();
        SimpleTextStructure struct = (SimpleTextStructure) doc.getDataStructure();
        Field f0 = struct.getSegment().getFieldList().get(0);
        Field f1 = struct.getSegment().getFieldList().get(1);
        f1.setName(f0.getName());
        runValidation(doc, ValidationStatus.INVALID);
    }
View Full Code Here

        new TextDocumentValidator(doc, c).run();
        assertEquals(c.result().status(), expected);
    }

    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

        doc.setDelimiter(FieldDelimiter.COMMA);
        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

        doc.setDelimiter(FieldDelimiter.COMMA);
        return doc;
    }

    private static TextDocument createValidComplexDelimitedTextDocument() {
        TextDocument doc = new TextDocument("Test");
        doc.setStructure(createValidComplexDelimitedTextStructure());
        doc.setStringQualifier("\"");
        doc.setDelimiter(FieldDelimiter.COMMA);
        return doc;
    }
View Full Code Here

            fail();
        }
    }

    private void validateStructure(TextStructure struct) {
        TextDocument doc = new TextDocument("X");
        doc.setDelimiter(FieldDelimiter.COMMA);
        doc.setStructure(struct);
        ValidationMessageCollectorImpl collector = new ValidationMessageCollectorImpl(ValidationContext.EMPTY);
        TextDocumentValidator validator = new TextDocumentValidator(doc, collector);
        validator.run();
        assertSame(ValidationStatus.VALID, collector.result().status());
    }
View Full Code Here

        setTargetDocumentId(tx);
    }

    private void setTargetDocumentId(Transformation tx) {
        TargetPages targetPages = (TargetPages) getTargetPages();
        TextDocument doc = targetPages.getTextDocument();
        tx.setTargetTextDocumentId(doc.getID());
    }
View Full Code Here

        quotes = dbStructure.getBeginEndQuote();
        Folder parent = folders.getWizardFolder(EntityType.Document, true);
        DatabaseStructureTree tree = new DatabaseStructureTree(dbStructure);
        Node root = tree.getRoot();
        DatabaseObject table = root.getTable();
        TextDocument doc = createEmptyDocument(parent, table);
        TextStructure struct = createTextStructure(root);
        doc.setStructure(struct);
        insertIntoProject(parent, doc);
        return doc;
    }
View Full Code Here

        }
    }

    private TextDocument createEmptyDocument(Folder parent, DatabaseObject table) {
        String name = getName(parent, table);
        TextDocument doc = new TextDocument(name);
        doc.setDelimiter(FieldDelimiter.COMMA);
        doc.setStringQualifier("\"");
        doc.setQualifierMode(QualifierMode.WHEN_NEEDED);
        doc.setTransient(true);
        return doc;
    }
View Full Code Here

                System.out.println("Success: " + ((SimpleTextStructure) o).getFieldListSize());
                System.exit(0);
            }
        };
        SimpleStructureFileTemplateWizard wizard = new SimpleStructureFileTemplateWizard(
                        window, new TextDocument("Test"), "New Text Document", SegmentType.DELIMITED, callback);
        wizard.start();
    }
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.data.entity.TextDocument

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.