Package com.rometools.rome.feed.module

Examples of com.rometools.rome.feed.module.SyModule


    @Override
    public Module parse(final Element syndRoot, final Locale locale) {

        boolean foundSomething = false;

        final SyModule sm = new SyModuleImpl();

        final Element updatePeriod = syndRoot.getChild("updatePeriod", getDCNamespace());
        if (updatePeriod != null) {
            foundSomething = true;
            sm.setUpdatePeriod(updatePeriod.getText());
        }

        final Element updateFrequency = syndRoot.getChild("updateFrequency", getDCNamespace());
        if (updateFrequency != null) {
            foundSomething = true;
            sm.setUpdateFrequency(Integer.parseInt(updateFrequency.getText().trim()));
        }

        final Element updateBase = syndRoot.getChild("updateBase", getDCNamespace());
        if (updateBase != null) {
            foundSomething = true;
            sm.setUpdateBase(DateParser.parseDate(updateBase.getText(), locale));
        }

        if (foundSomething) {
            return sm;
        } else {
View Full Code Here


    }

    @Override
    public void generate(final Module module, final Element element) {

        final SyModule syModule = (SyModule) module;

        final String updatePeriod = syModule.getUpdatePeriod();
        if (updatePeriod != null) {
            final Element updatePeriodElement = new Element("updatePeriod", SY_NS);
            updatePeriodElement.addContent(updatePeriod);
            element.addContent(updatePeriodElement);
        }

        final Element updateFrequencyElement = new Element("updateFrequency", SY_NS);
        updateFrequencyElement.addContent(String.valueOf(syModule.getUpdateFrequency()));
        element.addContent(updateFrequencyElement);

        final Date updateBase = syModule.getUpdateBase();
        if (updateBase != null) {
            final Element updateBaseElement = new Element("updateBase", SY_NS);
            updateBaseElement.addContent(DateParser.formatW3CDateTime(updateBase, Locale.US));
            element.addContent(updateBaseElement);
        }
View Full Code Here

        assertProperty(dc.getCoverage(), prefix + "dc:coverage");
        assertProperty(dc.getRights(), prefix + "dc:rights");
    }

    public void testChannelSyModule() throws Exception {
        final SyModule sy = (SyModule) this.getCachedSyndFeed().getModule(SyModule.URI);
        assertNotNull(sy);
        assertEquals(sy.getUpdatePeriod(), SyModule.HOURLY);
        assertEquals(sy.getUpdateFrequency(), 100);
        final Date date = DateParser.parseW3CDateTime("2001-01-01T01:00+00:00", Locale.US);
        assertEquals(sy.getUpdateBase(), date);
    }
View Full Code Here

    }

    public void testModules() throws Exception {
        final DCModule dc = (DCModule) this.getCachedSyndFeed().getModule(DCModule.URI);
        assertNotNull(dc);
        final SyModule sy = (SyModule) this.getCachedSyndFeed().getModule(SyModule.URI);
        assertNotNull(sy);
    }
View Full Code Here

            // method
        }
    }

    public void testFeedSyModule() throws Exception {
        final SyModule sy = (SyModule) this.getCachedSyndFeed().getModule(SyModule.URI);
        assertNotNull(sy);
        assertEquals(sy.getUpdatePeriod(), SyModule.HOURLY);
        assertEquals(sy.getUpdateFrequency(), 100);
        final Date date = DateParser.parseW3CDateTime("2001-01-01T01:00+00:00", Locale.US);
        assertEquals(sy.getUpdateBase(), date);
    }
View Full Code Here

TOP

Related Classes of com.rometools.rome.feed.module.SyModule

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.