com.rometools.rome.feed.rss.Content Java Examples
The following examples show how to use
com.rometools.rome.feed.rss.Content.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HrmsRssViewBuilder.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@SuppressWarnings("unchecked") @Override protected List<Item> buildFeedItems(Map<String, Object> model, HttpServletRequest req, HttpServletResponse resp) throws Exception { // get data model which is passed by the Spring container List<HrmsNews> news = (List<HrmsNews>) model.get("allNews"); List<Item> items = new ArrayList<Item>(news.size()); for(HrmsNews topic : news ){ Item item = new Item(); Content content = new Content(); content.setValue(topic.getSummary()); item.setContent(content); item.setTitle(topic.getDescription()); item.setLink(topic.getLink()); item.setPubDate(new Date()); items.add(item); } return items; }
Example #2
Source File: ConverterForRSS091Userland.java From rome with Apache License 2.0 | 6 votes |
@Override protected Item createRSSItem(final SyndEntry sEntry) { final Item item = super.createRSSItem(sEntry); item.setComments(sEntry.getComments()); final SyndContent sContent = sEntry.getDescription(); if (sContent != null) { item.setDescription(createItemDescription(sContent)); } final List<SyndContent> contents = sEntry.getContents(); if (Lists.isNotEmpty(contents)) { final SyndContent syndContent = contents.get(0); final Content cont = new Content(); cont.setValue(syndContent.getValue()); cont.setType(syndContent.getType()); item.setContent(cont); } return item; }
Example #3
Source File: RSS10Parser.java From rome with Apache License 2.0 | 6 votes |
/** * Parses an item element of an RSS document looking for item information. * <p/> * It first invokes super.parseItem and then parses and injects the description property if * present. * <p/> * * @param rssRoot the root element of the RSS document in case it's needed for context. * @param eItem the item element to parse. * @return the parsed RSSItem bean. */ @Override protected Item parseItem(final Element rssRoot, final Element eItem, final Locale locale) { final Item item = super.parseItem(rssRoot, eItem, locale); final Element description = eItem.getChild("description", getRSSNamespace()); if (description != null) { item.setDescription(parseItemDescription(rssRoot, description)); } final Element encoded = eItem.getChild("encoded", getContentNamespace()); if (encoded != null) { final Content content = new Content(); content.setType(Content.HTML); content.setValue(encoded.getText()); item.setContent(content); } final String about = eItem.getAttributeValue("about", getRDFNamespace()); if (about != null) { item.setUri(about); } return item; }
Example #4
Source File: RSS091UserlandGenerator.java From rome with Apache License 2.0 | 6 votes |
@Override protected void populateItem(final Item item, final Element eItem, final int index) { super.populateItem(item, eItem, index); final Description description = item.getDescription(); if (description != null) { eItem.addContent(generateSimpleElement("description", description.getValue())); } final Namespace contentNamespace = getContentNamespace(); final Content content = item.getContent(); if (item.getModule(contentNamespace.getURI()) == null && content != null) { final Element elem = new Element("encoded", contentNamespace); elem.addContent(content.getValue()); eItem.addContent(elem); } }
Example #5
Source File: DocumentRssFeedView.java From jakduk-api with MIT License | 5 votes |
private Description createDescription(String content) { Description description = new Description(); description.setType(Content.HTML); description.setValue(content); return description; }
Example #6
Source File: ConverterForRSS10.java From rome with Apache License 2.0 | 5 votes |
@Override protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) { final SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem); final Description desc = item.getDescription(); if (desc != null) { final SyndContent descContent = new SyndContentImpl(); descContent.setType(desc.getType()); descContent.setValue(desc.getValue()); syndEntry.setDescription(descContent); } final Content cont = item.getContent(); if (cont != null) { final SyndContent contContent = new SyndContentImpl(); contContent.setType(cont.getType()); contContent.setValue(cont.getValue()); final List<SyndContent> contents = new ArrayList<SyndContent>(); contents.add(contContent); syndEntry.setContents(contents); } return syndEntry; }
Example #7
Source File: ConverterForRSS091Userland.java From rome with Apache License 2.0 | 5 votes |
@Override protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) { final SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem); final Description desc = item.getDescription(); syndEntry.setComments(item.getComments()); // DublinCoreTest will be failed without this row // I don't have better solution if (syndEntry.getPublishedDate() == null) syndEntry.setPublishedDate(item.getPubDate()); if (desc != null) { final SyndContent descContent = new SyndContentImpl(); descContent.setType(desc.getType()); descContent.setValue(desc.getValue()); syndEntry.setDescription(descContent); } final Content cont = item.getContent(); if (cont != null) { final SyndContent content = new SyndContentImpl(); content.setType(cont.getType()); content.setValue(cont.getValue()); final List<SyndContent> syndContents = new ArrayList<SyndContent>(); syndContents.add(content); syndEntry.setContents(syndContents); } return syndEntry; }
Example #8
Source File: ConverterForRSS10.java From rome with Apache License 2.0 | 4 votes |
protected Content createItemContent(final SyndContent sContent) { final Content cont = new Content(); cont.setValue(sContent.getValue()); cont.setType(sContent.getType()); return cont; }