return link;
}
@Override
public WireFeed createRealFeed(final SyndFeed syndFeed) {
final Feed aFeed = new Feed(getType());
aFeed.setModules(ModuleUtils.cloneModules(syndFeed.getModules()));
aFeed.setEncoding(syndFeed.getEncoding());
aFeed.setStyleSheet(syndFeed.getStyleSheet());
aFeed.setId(syndFeed.getUri());
final SyndContent sTitle = syndFeed.getTitleEx();
if (sTitle != null) {
final Content title = new Content();
title.setType(sTitle.getType());
title.setValue(sTitle.getValue());
aFeed.setTitleEx(title);
}
final SyndContent sDesc = syndFeed.getDescriptionEx();
if (sDesc != null) {
final Content subtitle = new Content();
subtitle.setType(sDesc.getType());
subtitle.setValue(sDesc.getValue());
aFeed.setSubtitle(subtitle);
}
// separate SyndEntry's links collection into alternate and other links
final List<Link> alternateLinks = new ArrayList<Link>();
final List<Link> otherLinks = new ArrayList<Link>();
final List<SyndLink> slinks = syndFeed.getLinks();
if (slinks != null) {
for (final SyndLink syndLink : slinks) {
final Link link = createAtomLink(syndLink);
final String rel = link.getRel();
if (Strings.isBlank(rel) || "alternate".equals(rel)) {
alternateLinks.add(link);
} else {
otherLinks.add(link);
}
}
}
// no alternate link? then use THE link if there is one
if (alternateLinks.isEmpty() && syndFeed.getLink() != null) {
final Link link = new Link();
link.setRel("alternate");
link.setHref(syndFeed.getLink());
alternateLinks.add(link);
}
if (!alternateLinks.isEmpty()) {
aFeed.setAlternateLinks(alternateLinks);
}
if (!otherLinks.isEmpty()) {
aFeed.setOtherLinks(otherLinks);
}
final List<SyndCategory> sCats = syndFeed.getCategories();
final List<Category> aCats = new ArrayList<Category>();
if (sCats != null) {
for (final SyndCategory sCat : sCats) {
final Category aCat = new Category();
aCat.setTerm(sCat.getName());
// TODO: aCat.setLabel(sCat.getLabel());
aCat.setScheme(sCat.getTaxonomyUri());
aCats.add(aCat);
}
}
if (!aCats.isEmpty()) {
aFeed.setCategories(aCats);
}
final List<SyndPerson> authors = syndFeed.getAuthors();
if (Lists.isNotEmpty(authors)) {
aFeed.setAuthors(ConverterForAtom03.createAtomPersons(authors));
}
final List<SyndPerson> contributors = syndFeed.getContributors();
if (Lists.isNotEmpty(contributors)) {
aFeed.setContributors(ConverterForAtom03.createAtomPersons(contributors));
}
aFeed.setRights(syndFeed.getCopyright());
aFeed.setUpdated(syndFeed.getPublishedDate());
final List<SyndEntry> sEntries = syndFeed.getEntries();
if (sEntries != null) {
aFeed.setEntries(createAtomEntries(sEntries));
}
final List<Element> foreignMarkup = syndFeed.getForeignMarkup();
if (!foreignMarkup.isEmpty()) {
aFeed.setForeignMarkup(foreignMarkup);
}
return aFeed;
}