Search in sources :

Example 31 with SyndContentImpl

use of com.rometools.rome.feed.synd.SyndContentImpl in project commafeed by Athou.

the class RSS090DescriptionConverter method createSyndEntry.

@Override
protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) {
    SyndEntry entry = super.createSyndEntry(item, preserveWireItem);
    Description desc = item.getDescription();
    if (desc != null) {
        SyndContentImpl syndDesc = new SyndContentImpl();
        syndDesc.setValue(desc.getValue());
        entry.setDescription(syndDesc);
    }
    return entry;
}
Also used : Description(com.rometools.rome.feed.rss.Description) SyndEntry(com.rometools.rome.feed.synd.SyndEntry) SyndContentImpl(com.rometools.rome.feed.synd.SyndContentImpl)

Example 32 with SyndContentImpl

use of com.rometools.rome.feed.synd.SyndContentImpl in project cilla by shred.

the class FeedView method createEntry.

/**
 * Creates a {@link SyndEntry} from the given {@link Page}.
 *
 * @param page
 *            {@link Page} to create a {@link SyndEntry} for
 * @param uriPrefix
 *            URI prefix for this website
 * @return {@link SyndEntry} that was created
 */
private SyndEntry createEntry(Page page, String uriPrefix) {
    String pageUrl = linkService.linkTo().page(page).absolute().toString();
    String body = textFormatter.format(page.getTeaser(), () -> linkService.linkTo().page(page)).toString();
    for (FeedViewInterceptor it : interceptors) {
        body = it.filterDescription(page, body);
    }
    SyndEntry entry = new SyndEntryImpl();
    entry.setTitle(page.getTitle());
    entry.setLink(pageUrl);
    entry.setUri(buildTaxonomyUri(uriPrefix, "page", page.getId()));
    entry.setPublishedDate(page.getPublication());
    entry.setUpdatedDate(page.getModification());
    // Add a donation link if set
    if (page.isDonatable() && page.getDonateUrl() != null) {
        SyndLink link = new SyndLinkImpl();
        link.setRel("payment");
        link.setHref(page.getDonateUrl());
        entry.getLinks().add(link);
    }
    SyndContent description = new SyndContentImpl();
    description.setType("text/html");
    description.setValue(body);
    entry.setDescription(description);
    entry.getCategories().addAll(page.getCategories().stream().map(cat -> {
        SyndCategory category = new SyndCategoryImpl();
        category.setName(cat.getName());
        category.setTaxonomyUri(buildTaxonomyUri(uriPrefix, "category", cat.getId()));
        return category;
    }).collect(toList()));
    entry.getCategories().addAll(page.getTags().stream().map(tag -> {
        SyndCategory category = new SyndCategoryImpl();
        category.setName(tag.getName());
        category.setTaxonomyUri(buildTaxonomyUri(uriPrefix, "tag", tag.getName()));
        return category;
    }).collect(toList()));
    List<SyndPerson> authorList = new ArrayList<>();
    User creator = page.getCreator();
    SyndPerson author = new SyndPersonImpl();
    author.setName(creator.getName());
    author.setUri(buildTaxonomyUri(uriPrefix, "author", creator.getId()));
    authorList.add(author);
    entry.setAuthors(authorList);
    interceptors.forEach(it -> it.postProcessEntry(page, entry));
    return entry;
}
Also used : SyndCategory(com.rometools.rome.feed.synd.SyndCategory) User(org.shredzone.cilla.core.model.User) SyndEntry(com.rometools.rome.feed.synd.SyndEntry) SyndContentImpl(com.rometools.rome.feed.synd.SyndContentImpl) SyndLinkImpl(com.rometools.rome.feed.synd.SyndLinkImpl) ArrayList(java.util.ArrayList) FeedViewInterceptor(org.shredzone.cilla.view.interceptor.FeedViewInterceptor) SyndPerson(com.rometools.rome.feed.synd.SyndPerson) SyndPersonImpl(com.rometools.rome.feed.synd.SyndPersonImpl) SyndCategoryImpl(com.rometools.rome.feed.synd.SyndCategoryImpl) SyndContent(com.rometools.rome.feed.synd.SyndContent) SyndEntryImpl(com.rometools.rome.feed.synd.SyndEntryImpl) SyndLink(com.rometools.rome.feed.synd.SyndLink)

Aggregations

SyndContentImpl (com.rometools.rome.feed.synd.SyndContentImpl)32 SyndEntryImpl (com.rometools.rome.feed.synd.SyndEntryImpl)28 SyndEntry (com.rometools.rome.feed.synd.SyndEntry)26 SyndContent (com.rometools.rome.feed.synd.SyndContent)24 SyndFeedImpl (com.rometools.rome.feed.synd.SyndFeedImpl)15 ArrayList (java.util.ArrayList)14 SyndFeed (com.rometools.rome.feed.synd.SyndFeed)13 SyndFeedOutput (com.rometools.rome.io.SyndFeedOutput)5 StatusGroup (org.onebusaway.enterprise.webapp.actions.status.model.StatusGroup)4 StatusItem (org.onebusaway.enterprise.webapp.actions.status.model.StatusItem)4 SyndCategory (com.rometools.rome.feed.synd.SyndCategory)3 SyndImageImpl (com.rometools.rome.feed.synd.SyndImageImpl)3 SProject (org.bimserver.interfaces.objects.SProject)3 Preconditions (com.google.common.base.Preconditions)2 Hashing (com.google.common.hash.Hashing)2 MediaType (com.google.common.net.MediaType)2 SyndCategoryImpl (com.rometools.rome.feed.synd.SyndCategoryImpl)2 SyndImage (com.rometools.rome.feed.synd.SyndImage)2 SyndPerson (com.rometools.rome.feed.synd.SyndPerson)2 SyndPersonImpl (com.rometools.rome.feed.synd.SyndPersonImpl)2