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;
}
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;
}
Aggregations