Package com.sun.syndication.feed.module

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


     *
     * @return frequency.
     */
    private static int getUpdateFrequency(SyndFeed aFeed)
    {
        SyModule module = (SyModule)aFeed.getModule(SyModule.URI);

        return module == null ? -1 : module.getUpdateFrequency();
    }
View Full Code Here


     *
     * @return period in ms or <code>-1</code> if not specified.
     */
    private static long getUpdatePeriod(SyndFeed aFeed)
    {
        SyModule module = (SyModule)aFeed.getModule(SyModule.URI);

        return module == null ? -1 : periodToValue(module.getUpdatePeriod());
    }
View Full Code Here

        return NAMESPACES;
    }

    public void generate(Module module, Element element) {

        SyModule syModule = (SyModule)module;

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

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

        if (syModule.getUpdateBase() != null) {
            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().trim()));
        }
        e = syndRoot.getChild("updateBase",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            sm.setUpdateBase(DateParser.parseDate(e.getText()));
        }
        return (foundSomething) ? sm : null;
    }
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().trim()));
        }
        e = syndRoot.getChild("updateBase",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            sm.setUpdateBase(DateParser.parseDate(e.getText()));
        }
        return (foundSomething) ? sm : null;
    }
View Full Code Here



        for(Module module : feed.getModules()) {
            if(module instanceof SyModule) {
                SyModule syModule = (SyModule)module;
                createStringProperty(r_feed,NS_RSS_SY + "updatePeriod", syModule.getUpdatePeriod());
                createIntProperty(r_feed, NS_RSS_SY + "updateFrequency", syModule.getUpdateFrequency());
                createDateProperty(r_feed, NS_RSS_SY + "updateBase", syModule.getUpdateBase());
            } else if(module instanceof DCModule) {
                parseDCModule(r_feed, (DCModule)module);
            }
        }
View Full Code Here

        // add dc:creator for managing editor
        createStringProperty(r_feed, NS_DC_TERMS + "creator", feed.getManagingEditor());

        for(Module module : feed.getModules()) {
            if(module instanceof SyModule) {
                SyModule syModule = (SyModule)module;
                createStringProperty(r_feed,NS_RSS_SY + "updatePeriod", syModule.getUpdatePeriod());
                createIntProperty(r_feed, NS_RSS_SY + "updateFrequency", syModule.getUpdateFrequency());
                createDateProperty(r_feed, NS_RSS_SY + "updateBase", syModule.getUpdateBase());
            } else if(module instanceof DCModule) {
                parseDCModule(r_feed, (DCModule)module);
            }
        }
View Full Code Here

        return NAMESPACES;
    }

    public void generate(Module module, Element element) {

        SyModule syModule = (SyModule)module;

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

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

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

     *             Shouldn't.
     */
    private void coreUpdateFrequencyTest(final String period, final int frequency, final Long expected)
            throws Exception
    {
        final SyModule syMod = context.mock(SyModule.class);

        setupFetchByUser();
        context.checking(new Expectations()
        {
            {
View Full Code Here

                List<FeedSubscriber> subscribers = getFeedSubscribers(mapEntry.getKey(), feed);

                // check for update frequency info
                if (updateFrequency == null)
                {
                    SyModule syMod = (SyModule) syndFeed.getModule(SyModule.URI);
                    if (syMod != null)
                    {
                        updateFrequency = getUpdateFrequency(syMod.getUpdatePeriod(), syMod.getUpdateFrequency());
                    }
                }

                if (syndFeed.getEntries().size() > 0)
                {
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.