}
return atomEntries;
}
protected Entry createAtomEntry(SyndEntry sEntry) {
Entry aEntry = new Entry();
aEntry.setModules(ModuleUtils.cloneModules(sEntry.getModules()));
aEntry.setId(sEntry.getUri());
aEntry.setTitle(sEntry.getTitle());
// separate SyndEntry's links collection into alternate and other links
List alternateLinks = new ArrayList();
List otherLinks = new ArrayList();
List slinks = sEntry.getLinks();
if (slinks != null) {
for (Iterator iter=slinks.iterator(); iter.hasNext();) {
SyndLink syndLink = (SyndLink)iter.next();
Link link = new Link();
link.setRel(syndLink.getRel());
link.setHref(syndLink.getHref());
link.setHreflang(syndLink.getHreflang());
link.setLength(syndLink.getLength());
if ("alternate".equals(syndLink.getRel())) {
alternateLinks.add(link);
} else {
otherLinks.add(link);
}
}
}
// no alternate link? then use THE link if there is one
if (alternateLinks.size() == 0 && sEntry.getLink() != null) {
Link link = new Link();
link.setRel("alternate");
link.setHref(sEntry.getLink());
alternateLinks.add(link);
}
if (alternateLinks.size() > 0) aEntry.setAlternateLinks(alternateLinks);
if (otherLinks.size() > 0) aEntry.setOtherLinks(otherLinks);
List sCats = sEntry.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) aEntry.setCategories(aCats);
SyndContent sDescription = sEntry.getDescription();
if (sDescription!=null) {
Content summary = new Content();
summary.setType(sDescription.getType());
summary.setValue(sDescription.getValue());
aEntry.setSummary(summary);
}
// take first item in contents collection as the content
List syndContents = sEntry.getContents();
if (syndContents != null && syndContents.size() > 0) {
SyndContent syndContent = (SyndContent)syndContents.get(0);
Content content = new Content();
content.setType(syndContent.getType());
content.setValue(syndContent.getValue());
aEntry.setSummary(content);
}
List authors = sEntry.getAuthors();
if (authors!=null && authors.size() > 0) {
aEntry.setAuthors(ConverterForAtom03.createAtomPersons(authors));
}
aEntry.setPublished(sEntry.getPublishedDate());
aEntry.setUpdated(sEntry.getUpdatedDate());
// TODO: @FID42 Atom 1.0 Date (Updated or Published) Not Set
if(aEntry.getUpdated() == null && sEntry.getPublishedDate() != null)
ROME.failed(Failure.ROME42);
return aEntry;
}