com.rometools.rome.feed.synd.SyndLinkImpl Java Examples

The following examples show how to use com.rometools.rome.feed.synd.SyndLinkImpl. 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: ConverterForAtom10.java    From rome with Apache License 2.0 5 votes vote down vote up
public SyndLink createSyndLink(final Link link) {
    final SyndLink syndLink = new SyndLinkImpl();
    syndLink.setRel(link.getRel());
    syndLink.setType(link.getType());
    syndLink.setHref(link.getHrefResolved());
    syndLink.setHreflang(link.getHreflang());
    syndLink.setLength(link.getLength());
    syndLink.setTitle(link.getTitle());
    return syndLink;
}
 
Example #2
Source File: ConverterForAtom03.java    From rome with Apache License 2.0 5 votes vote down vote up
public SyndLink createSyndLink(final Link link) {
    final SyndLink syndLink = new SyndLinkImpl();
    syndLink.setRel(link.getRel());
    syndLink.setType(link.getType());
    syndLink.setHref(link.getHrefResolved());
    syndLink.setTitle(link.getTitle());
    return syndLink;
}
 
Example #3
Source File: FeedParser.java    From commafeed with Apache License 2.0 5 votes vote down vote up
/**
 * Adds atom links for rss feeds
 */
private void handleForeignMarkup(SyndFeed feed) {
	List<Element> foreignMarkup = feed.getForeignMarkup();
	if (foreignMarkup == null) {
		return;
	}
	for (Element element : foreignMarkup) {
		if ("link".equals(element.getName()) && ATOM_10_NS.equals(element.getNamespace())) {
			SyndLink link = new SyndLinkImpl();
			link.setRel(element.getAttributeValue("rel"));
			link.setHref(element.getAttributeValue("href"));
			feed.getLinks().add(link);
		}
	}
}
 
Example #4
Source File: ConverterForRSS094.java    From rome with Apache License 2.0 4 votes vote down vote up
@Override
protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) {

    final SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);

    // adding native feed author to DC creators list
    final String author = item.getAuthor();
    if (author != null) {
        final List<String> creators = ((DCModule) syndEntry.getModule(DCModule.URI)).getCreators();
        if (!creators.contains(author)) {

            // using a set to remove duplicates
            final Set<String> s = new LinkedHashSet<String>();

            // DC creators
            s.addAll(creators);

            // feed native author
            s.add(author);

            creators.clear();
            creators.addAll(s);
        }
    }

    final Guid guid = item.getGuid();
    final String itemLink = item.getLink();
    if (guid != null) {
        final String guidValue = guid.getValue();
        syndEntry.setUri(guidValue);
        if (itemLink == null && guid.isPermaLink()) {
            syndEntry.setLink(guidValue);
        }
    } else {
        syndEntry.setUri(itemLink);
    }

    if (item.getComments() != null) {
        final SyndLinkImpl comments = new SyndLinkImpl();
        comments.setRel("comments");
        comments.setHref(item.getComments());
        comments.setType("text/html");
    }

    return syndEntry;

}