Search in sources :

Example 1 with Link

use of org.intabulas.sandler.elements.Link in project jspwiki by apache.

the class AtomAPIServlet method listBlogs.

/**
 *  Creates and outputs a full list of all available blogs
 */
private Feed listBlogs() throws ProviderException, IOException {
    Collection pages = m_engine.getPageManager().getAllPages();
    Feed feed = SyndicationFactory.newSyndicationFeed();
    feed.setTitle("List of blogs at this site");
    feed.setModified(new Date());
    for (Iterator i = pages.iterator(); i.hasNext(); ) {
        WikiPage p = (WikiPage) i.next();
        // 
        // List only weblogs
        // FIXME: Unfortunately, a weblog is not known until it has
        // been executed once, because plugins are off during
        // the initial startup phase.
        // 
        log.debug(p.getName() + " = " + p.getAttribute(WeblogPlugin.ATTR_ISWEBLOG));
        if (!("true".equals(p.getAttribute(WeblogPlugin.ATTR_ISWEBLOG))))
            continue;
        String encodedName = TextUtil.urlEncodeUTF8(p.getName());
        WikiContext context = new WikiContext(m_engine, p);
        String title = TextUtil.replaceEntities(org.apache.wiki.rss.Feed.getSiteName(context));
        Link postlink = createLink("service.post", m_engine.getBaseURL() + "atom/" + encodedName, title);
        Link editlink = createLink("service.edit", m_engine.getBaseURL() + "atom/" + encodedName, title);
        Link feedlink = createLink("service.feed", m_engine.getBaseURL() + "atom.jsp?page=" + encodedName, title);
        feed.addLink(postlink);
        feed.addLink(feedlink);
        feed.addLink(editlink);
    }
    return feed;
}
Also used : WikiContext(org.apache.wiki.WikiContext) WikiPage(org.apache.wiki.WikiPage) Iterator(java.util.Iterator) Collection(java.util.Collection) Date(java.util.Date) Link(org.intabulas.sandler.elements.Link) Feed(org.intabulas.sandler.elements.Feed)

Aggregations

Collection (java.util.Collection)1 Date (java.util.Date)1 Iterator (java.util.Iterator)1 WikiContext (org.apache.wiki.WikiContext)1 WikiPage (org.apache.wiki.WikiPage)1 Feed (org.intabulas.sandler.elements.Feed)1 Link (org.intabulas.sandler.elements.Link)1