Java Code Examples for com.rometools.rome.feed.rss.Channel#getLastBuildDate()

The following examples show how to use com.rometools.rome.feed.rss.Channel#getLastBuildDate() . 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: RSS091UserlandGenerator.java    From rome with Apache License 2.0 4 votes vote down vote up
@Override
protected void populateChannel(final Channel channel, final Element eChannel) {

    super.populateChannel(channel, eChannel);

    final String language = channel.getLanguage();
    if (language != null) {
        eChannel.addContent(generateSimpleElement("language", language));
    }

    final String rating = channel.getRating();
    if (rating != null) {
        eChannel.addContent(generateSimpleElement("rating", rating));
    }

    final String copyright = channel.getCopyright();
    if (copyright != null) {
        eChannel.addContent(generateSimpleElement("copyright", copyright));
    }

    final Date pubDate = channel.getPubDate();
    if (pubDate != null) {
        eChannel.addContent(generateSimpleElement("pubDate", DateParser.formatRFC822(pubDate, Locale.US)));
    }

    final Date lastBuildDate = channel.getLastBuildDate();
    if (lastBuildDate != null) {
        eChannel.addContent(generateSimpleElement("lastBuildDate", DateParser.formatRFC822(lastBuildDate, Locale.US)));
    }

    final String docs = channel.getDocs();
    if (docs != null) {
        eChannel.addContent(generateSimpleElement("docs", docs));
    }

    final String managingEditor = channel.getManagingEditor();
    if (managingEditor != null) {
        eChannel.addContent(generateSimpleElement("managingEditor", managingEditor));
    }

    final String webMaster = channel.getWebMaster();
    if (webMaster != null) {
        eChannel.addContent(generateSimpleElement("webMaster", webMaster));
    }

    final List<Integer> skipHours = channel.getSkipHours();
    if (skipHours != null && !skipHours.isEmpty()) {
        eChannel.addContent(generateSkipHoursElement(skipHours));
    }

    final List<String> skipDays = channel.getSkipDays();
    if (skipDays != null && !skipDays.isEmpty()) {
        eChannel.addContent(generateSkipDaysElement(skipDays));
    }

}
 
Example 2
Source File: ConverterForRSS091Userland.java    From rome with Apache License 2.0 2 votes vote down vote up
@Override
public void copyInto(final WireFeed feed, final SyndFeed syndFeed) {

    final Channel channel = (Channel) feed;

    super.copyInto(channel, syndFeed);

    syndFeed.setLanguage(channel.getLanguage()); // c

    syndFeed.setCopyright(channel.getCopyright()); // c

    syndFeed.setDocs(channel.getDocs());

    syndFeed.setManagingEditor(channel.getManagingEditor());

    syndFeed.setWebMaster(channel.getWebMaster());

    syndFeed.setGenerator(channel.getGenerator());

    final Date pubDate = channel.getPubDate();

    if (pubDate != null) {
        syndFeed.setPublishedDate(pubDate); // c
    } else if (channel.getLastBuildDate() != null) {
        syndFeed.setPublishedDate(channel.getLastBuildDate()); // c
    }

    final String author = channel.getManagingEditor();

    if (author != null) {

        final List<String> creators = ((DCModule) syndFeed.getModule(DCModule.URI)).getCreators();

        if (!creators.contains(author)) {
            // using a set to remove duplicates
            final Set<String> s = new LinkedHashSet<String>();
            s.addAll(creators); // DC creators
            s.add(author); // feed native author
            creators.clear();
            creators.addAll(s);
        }
    }
}