Package com.sun.syndication.feed.module

Examples of com.sun.syndication.feed.module.SyModule$Period


        return NAMESPACES;
    }

    public void generate(Module module, Element element) {

        SyModule syModule = (SyModule)module;

        Element updatePeriodElement = new Element("updatePeriod", SY_NS);
        updatePeriodElement.addContent(syModule.getUpdatePeriod().toString());
        element.addContent(updatePeriodElement);

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

        Element updateBaseElement = new Element("updateBase", SY_NS);
        updateBaseElement.addContent(DateParser.formatW3CDateTime(syModule.getUpdateBase()));
        element.addContent(updateBaseElement);
    }
View Full Code Here


        return Namespace.getNamespace(SyModule.URI);
    }

    public Module parse(Element syndRoot) {
        boolean foundSomething = false;
        SyModule sm = new SyModuleImpl();

        Element e = syndRoot.getChild("updatePeriod",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            sm.setUpdatePeriod(e.getText());
        }
        e = syndRoot.getChild("updateFrequency",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            sm.setUpdateFrequency(Integer.parseInt(e.getText()));
        }
        e = syndRoot.getChild("updateBase",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            sm.setUpdateBase(DateParser.parseDate(e.getText()));
        }
        return (foundSomething) ? sm : null;
    }
View Full Code Here

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

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

    }

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

            assertProperty(dc.getRights(),prefix+"copyright"); // in header is convenience method
        }
    }

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

        PERIODS.put(SyModule.YEARLY.toString(),SyModule.YEARLY);
    }

    public Module parse(Element syndRoot) {
        boolean foundSomething = false;
        SyModule sm = new SyModuleImpl();

        Element e = syndRoot.getChild("updatePeriod",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            sm.setUpdatePeriod((SyModule.Period)PERIODS.get(e.getText()));
        }
        e = syndRoot.getChild("updateFrequency",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            sm.setUpdateFrequency(Integer.parseInt(e.getText()));
        }
        e = syndRoot.getChild("updateBase",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            sm.setUpdateBase(DateParser.parseW3CDateTime(e.getText()));
        }
        return (foundSomething) ? sm : null;
    }
View Full Code Here

    }

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

            assertProperty(dc.getRights(),prefix+"copyright"); // in header is convenience method
        }
    }

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

        return Namespace.getNamespace(SyModule.URI);
    }

    public Module parse(Element syndRoot) {
        boolean foundSomething = false;
        SyModule sm = new SyModuleImpl();

        Element e = syndRoot.getChild("updatePeriod",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            sm.setUpdatePeriod(e.getText());
        }
        e = syndRoot.getChild("updateFrequency",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            sm.setUpdateFrequency(Integer.parseInt(e.getText()));
        }
        e = syndRoot.getChild("updateBase",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            sm.setUpdateBase(DateParser.parseW3CDateTime(e.getText()));
        }
        return (foundSomething) ? sm : null;
    }
View Full Code Here

        PERIODS.put(SyModuleI.YEARLY.toString(),SyModuleI.YEARLY);
    }

    public ModuleI parse(Element syndRoot) {
        boolean foundSomething = false;
        SyModuleI sm = new SyModule();

        Element e = syndRoot.getChild("updatePeriod",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            sm.setUpdatePeriod((SyModuleI.Period)PERIODS.get(e.getText()));
        }
        e = syndRoot.getChild("updateFrequency",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            sm.setUpdateFrequency(Integer.parseInt(e.getText()));
        }
        e = syndRoot.getChild("updateBase",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            sm.setUpdateBase(DateParser.parseW3CDateTime(e.getText()));
        }
        return (foundSomething) ? sm : null;
    }
View Full Code Here

TOP

Related Classes of com.sun.syndication.feed.module.SyModule$Period

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.