Java Code Examples for com.rometools.rome.feed.rss.Item#getDescription()

The following examples show how to use com.rometools.rome.feed.rss.Item#getDescription() . 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: RSS10Generator.java    From rome with Apache License 2.0 6 votes vote down vote up
@Override
protected void populateItem(final Item item, final Element eItem, final int index) {

    super.populateItem(item, eItem, index);

    final String link = item.getLink();
    final String uri = item.getUri();
    if (uri != null) {
        eItem.setAttribute("about", uri, getRDFNamespace());
    } else if (link != null) {
        eItem.setAttribute("about", link, getRDFNamespace());
    }

    final Description description = item.getDescription();
    if (description != null) {
        eItem.addContent(generateSimpleElement("description", description.getValue()));
    }

    if (item.getModule(getContentNamespace().getURI()) == null && item.getContent() != null) {
        final Element elem = new Element("encoded", getContentNamespace());
        elem.addContent(item.getContent().getValue());
        eItem.addContent(elem);
    }

}
 
Example 2
Source File: RSS091UserlandGenerator.java    From rome with Apache License 2.0 6 votes vote down vote up
@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 3
Source File: ConverterForRSS10.java    From rome with Apache License 2.0 5 votes vote down vote up
@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 4
Source File: ConverterForRSS091Userland.java    From rome with Apache License 2.0 5 votes vote down vote up
@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 5
Source File: RSS094Generator.java    From rome with Apache License 2.0 5 votes vote down vote up
@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 && description.getType() != null) {
        final Element eDescription = eItem.getChild("description", getFeedNamespace());
        eDescription.setAttribute(new Attribute("type", description.getType()));
    }
    eItem.removeChild("expirationDate", getFeedNamespace());
}
 
Example 6
Source File: RSS090DescriptionConverter.java    From commafeed with Apache License 2.0 5 votes vote down vote up
@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;
}