}
return syndEntries;
}
protected SyndEntry createSyndEntry(final Feed feed, final Entry entry, final boolean preserveWireItem) {
final SyndEntryImpl syndEntry = new SyndEntryImpl();
if (preserveWireItem) {
syndEntry.setWireEntry(entry);
}
syndEntry.setModules(ModuleUtils.cloneModules(entry.getModules()));
final List<Element> foreignMarkup = entry.getForeignMarkup();
if (!foreignMarkup.isEmpty()) {
syndEntry.setForeignMarkup(foreignMarkup);
}
final Content eTitle = entry.getTitleEx();
if (eTitle != null) {
syndEntry.setTitleEx(createSyndContent(eTitle));
}
final Content summary = entry.getSummary();
if (summary != null) {
syndEntry.setDescription(createSyndContent(summary));
}
final List<Content> contents = entry.getContents();
if (Lists.isNotEmpty(contents)) {
final List<SyndContent> sContents = new ArrayList<SyndContent>();
for (final Content content : contents) {
sContents.add(createSyndContent(content));
}
syndEntry.setContents(sContents);
}
final List<SyndPerson> authors = entry.getAuthors();
if (Lists.isNotEmpty(authors)) {
syndEntry.setAuthors(ConverterForAtom03.createSyndPersons(authors));
final SyndPerson person0 = syndEntry.getAuthors().get(0);
syndEntry.setAuthor(person0.getName());
}
final List<SyndPerson> contributors = entry.getContributors();
if (Lists.isNotEmpty(contributors)) {
syndEntry.setContributors(ConverterForAtom03.createSyndPersons(contributors));
}
Date date = entry.getPublished();
if (date != null) {
syndEntry.setPublishedDate(date);
}
date = entry.getUpdated();
if (date != null) {
syndEntry.setUpdatedDate(date);
}
final List<Category> categories = entry.getCategories();
if (categories != null) {
final List<SyndCategory> syndCategories = new ArrayList<SyndCategory>();
for (final Category category : categories) {
final SyndCategory syndCategory = new SyndCategoryImpl();
syndCategory.setName(category.getTerm());
syndCategory.setTaxonomyUri(category.getSchemeResolved());
// TODO: categories MAY have labels
// syndCategory.setLabel(c.getLabel());
syndCategories.add(syndCategory);
}
syndEntry.setCategories(syndCategories);
}
// use first alternate link as THE link
final List<Link> alternateLinks = entry.getAlternateLinks();
if (Lists.isNotEmpty(alternateLinks)) {
final Link theLink = alternateLinks.get(0);
syndEntry.setLink(theLink.getHrefResolved());
}
// Create synd enclosures from enclosure links
final List<SyndEnclosure> syndEnclosures = new ArrayList<SyndEnclosure>();
final List<Link> otherLinks = entry.getOtherLinks();
if (Lists.isNotEmpty(otherLinks)) {
final List<Link> oLinks = otherLinks;
for (final Link link : oLinks) {
if ("enclosure".equals(link.getRel())) {
syndEnclosures.add(createSyndEnclosure(feed, entry, link));
}
}
}
syndEntry.setEnclosures(syndEnclosures);
// lump alternate and other links together
final List<SyndLink> syndLinks = new ArrayList<SyndLink>();
if (Lists.isNotEmpty(alternateLinks)) {
syndLinks.addAll(createSyndLinks(alternateLinks));
}
if (Lists.isNotEmpty(otherLinks)) {
syndLinks.addAll(createSyndLinks(otherLinks));
}
syndEntry.setLinks(syndLinks);
final String id = entry.getId();
if (id != null) {
syndEntry.setUri(entry.getId());
} else {
syndEntry.setUri(syndEntry.getLink());
}
// Convert source element Feed into SyndFeed and assign as SyndEntry
// source
final Feed source = entry.getSource();
if (source != null) {
final SyndFeed syndSource = new SyndFeedImpl(source);
syndEntry.setSource(syndSource);
}
return syndEntry;
}