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

The following examples show how to use com.rometools.rome.feed.rss.Item#getPubDate() . 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: ConverterForRSS093.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 Date pubDate = item.getPubDate();
    final Date publishedDate = syndEntry.getPublishedDate();
    if (pubDate != null && publishedDate == null) {
        syndEntry.setPublishedDate(pubDate); // c
    }

    return syndEntry;
}
 
Example 2
Source File: RSS093Generator.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 Date pubDate = item.getPubDate();
    if (pubDate != null) {
        eItem.addContent(generateSimpleElement("pubDate", DateParser.formatRFC822(pubDate, Locale.US)));
    }

    final Date expirationDate = item.getExpirationDate();
    if (expirationDate != null) {
        eItem.addContent(generateSimpleElement("expirationDate", DateParser.formatRFC822(expirationDate, Locale.US)));
    }
}