syndEncl.setLength(link.getLength());
return syndEncl;
}
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();
if (sTitle.getType() != null) {
title.setType(sTitle.getType());
}
if (sTitle.getMode() != null) {
title.setMode(sTitle.getMode());
}
title.setValue(sTitle.getValue());
aFeed.setTitleEx(title);
}
// 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);
String sDesc = syndFeed.getDescription();
if (sDesc!=null) {
Content tagline = new Content();
tagline.setValue(sDesc);
aFeed.setTagline(tagline);
}
aFeed.setLanguage(syndFeed.getLanguage());
List authors = syndFeed.getAuthors();
if (authors!=null && authors.size() > 0) {
aFeed.setAuthors(createAtomPersons(authors));
}
aFeed.setCopyright(syndFeed.getCopyright());
aFeed.setModified(syndFeed.getPublishedDate());
List sEntries = syndFeed.getEntries();
if (sEntries!=null) {
aFeed.setEntries(createAtomEntries(sEntries));
}
return aFeed;
}