Package org.jitterbit.integration.data.location.file

Examples of org.jitterbit.integration.data.location.file.IgnoredLines


     * Returns the lines to ignore when reading files from this location.
     */
    @Override
    public final IgnoredLines getLinesToIgnore() {
        synchronized (getDataLock()) {
            return new IgnoredLines(
                            getIntProperty(LocatableProperties.IGNORE_FIRST_LINES, DEFAULT_IGNORE_FIRST_LINES),
                            getIntProperty(LocatableProperties.IGNORE_LAST_LINES, DEFAULT_IGNORE_LAST_LINES));
        }
    }
View Full Code Here


    /**
     * Sets the lines to ignore when reading files from this location.
     */
    @Override
    public final void setLinesToIgnore(IgnoredLines lines) {
        IgnoredLines old;
        synchronized (getDataLock()) {
            old = getLinesToIgnore();
            setProperty(LocatableProperties.IGNORE_FIRST_LINES, lines.getFirst());
            setProperty(LocatableProperties.IGNORE_LAST_LINES, lines.getLast());
        }
        if (!old.equals(lines)) {
            firePropertyChange(LINES_TO_IGNORE, old, lines);
        }
    }
View Full Code Here

        collectMessages(errors);
        return errors;
    }
   
    private void validateIgnoredLines() {
        IgnoredLines lines = location.getLinesToIgnore();
        errors.addAll(lines.validate());
    }
View Full Code Here

        validator = new FileLocationValidator(loc);
    }

    @Test
    public void ensureIgnoreFirstIsValidated() {
        loc.setLinesToIgnore(new IgnoredLines(-12, 0));
        assertTrue(validator.validate().contains(IgnoredLines.INVALID_IGNORE_FIRST));
        loc.setLinesToIgnore(new IgnoredLines(0, 0));
        assertFalse(validator.validate().contains(IgnoredLines.INVALID_IGNORE_FIRST));
    }
View Full Code Here

        assertFalse(validator.validate().contains(IgnoredLines.INVALID_IGNORE_FIRST));
    }

    @Test
    public void ensureIgnoreLastIsValidated() {
        loc.setLinesToIgnore(new IgnoredLines(0, -12));
        assertTrue(validator.validate().contains(IgnoredLines.INVALID_IGNORE_LAST));
        loc.setLinesToIgnore(new IgnoredLines(0, 0));
        assertFalse(validator.validate().contains(IgnoredLines.INVALID_IGNORE_LAST));
    }
View Full Code Here

        assertTrue(validator.validate().contains(RenamedFileName.NAME_CONTAINS_ILLEGAL_CHARS));
    }
   
    @Test
    public void ensureCollectorIsNotified() {
        loc.setLinesToIgnore(new IgnoredLines(12, -12));
        loc.setRenameFileTo("newName.txt");
        ValidationMessageCollectorImpl collector = new ValidationMessageCollectorImpl(ValidationContext.EMPTY);
        validator.setMessageCollector(collector);
        validator.validate();
        LocationValidationTestUtils.ensureOneFatalMessage(collector, IgnoredLines.INVALID_IGNORE_LAST);
View Full Code Here

    }

    @Test
    public void ensureGetAndSetIgnoredLinesWorks() {
        TestDataUtils.testGetterAndSetter(loc, FileLocation.LINES_TO_IGNORE, "getLinesToIgnore", "setLinesToIgnore",
                        new IgnoredLines(), new IgnoredLines(10, 0));
    }
View Full Code Here

     * Returns the lines to ignore when reading files from this location.
     */
    @Override
    public final IgnoredLines getLinesToIgnore() {
        synchronized (getDataLock()) {
            return new IgnoredLines(
                            getIntProperty(LocatableProperties.IGNORE_FIRST_LINES, DEFAULT_IGNORE_FIRST_LINES),
                            getIntProperty(LocatableProperties.IGNORE_LAST_LINES, DEFAULT_IGNORE_LAST_LINES));
        }
    }
View Full Code Here

    /**
     * Sets the lines to ignore when reading files from this location.
     */
    @Override
    public final void setLinesToIgnore(IgnoredLines lines) {
        IgnoredLines old;
        synchronized (getDataLock()) {
            old = getLinesToIgnore();
            setProperty(LocatableProperties.IGNORE_FIRST_LINES, String.valueOf(lines.getFirst()));
            setProperty(LocatableProperties.IGNORE_LAST_LINES, String.valueOf(lines.getLast()));
        }
        if (!old.equals(lines)) {
            firePropertyChange(LINES_TO_IGNORE, old, lines);
        }
    }
View Full Code Here

    private static JComponent getFieldForLayout(InputField field) {
        return InputFieldFactory.getCapsule(field, InputFieldFactory.HORIZONTAL_LABEL_LEFT);
    }

    public void apply(LineBasedSourceData loc) {
        IgnoredLines lines = new IgnoredLines(firstField.getIntValue(), lastField.getIntValue());
        loc.setLinesToIgnore(lines);
    }
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.data.location.file.IgnoredLines

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.