link.setTitle( syndLink.getTitle());
return link;
}
public WireFeed createRealFeed(SyndFeed syndFeed) {
Feed aFeed = new Feed(getType());
aFeed.setModules(ModuleUtils.cloneModules(syndFeed.getModules()));
aFeed.setEncoding(syndFeed.getEncoding());
aFeed.setId(syndFeed.getUri());
SyndContent sTitle = syndFeed.getTitleEx();
if (sTitle != null) {
Content title = new Content();
title.setType(sTitle.getType());
title.setValue(sTitle.getValue());
aFeed.setTitleEx(title);
}
SyndContent sDesc = syndFeed.getDescriptionEx();
if (sDesc != null) {
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
List alternateLinks = new ArrayList();
List otherLinks = new ArrayList();
List slinks = syndFeed.getLinks();
if (slinks != null) {
for (Iterator iter=slinks.iterator(); iter.hasNext();) {
SyndLink syndLink = (SyndLink)iter.next();
Link link = createAtomLink(syndLink);
if (link.getRel() == null ||
"".equals(link.getRel().trim()) ||
"alternate".equals(link.getRel())) {
alternateLinks.add(link);
} else {
otherLinks.add(link);
}
}
}
// no alternate link? then use THE link if there is one
if (alternateLinks.size() == 0 && syndFeed.getLink() != null) {
Link link = new Link();
link.setRel("alternate");
link.setHref(syndFeed.getLink());
alternateLinks.add(link);
}
if (alternateLinks.size() > 0) aFeed.setAlternateLinks(alternateLinks);
if (otherLinks.size() > 0) aFeed.setOtherLinks(otherLinks);
List sCats = syndFeed.getCategories();
List aCats = new ArrayList();
if (sCats != null) {
for (Iterator iter=sCats.iterator(); iter.hasNext();) {
SyndCategory sCat = (SyndCategory)iter.next();
Category aCat = new Category();
aCat.setTerm(sCat.getName());
// TODO: aCat.setLabel(sCat.getLabel());
aCat.setScheme(sCat.getTaxonomyUri());
aCats.add(aCat);
}
}
if (aCats.size() > 0) aFeed.setCategories(aCats);
List authors = syndFeed.getAuthors();
if (authors!=null && authors.size() > 0) {
aFeed.setAuthors(ConverterForAtom03.createAtomPersons(authors));
}
List contributors = syndFeed.getContributors();
if (contributors!=null && contributors.size() > 0) {
aFeed.setContributors(ConverterForAtom03.createAtomPersons(contributors));
}
aFeed.setRights(syndFeed.getCopyright());
aFeed.setUpdated(syndFeed.getPublishedDate());
List sEntries = syndFeed.getEntries();
if (sEntries!=null) {
aFeed.setEntries(createAtomEntries(sEntries));
}
if (((List)syndFeed.getForeignMarkup()).size() > 0) {
aFeed.setForeignMarkup(syndFeed.getForeignMarkup());
}
return aFeed;
}