for (BaseContentEntry<?> child : getNonPageEntries(entries)) { if (getType(child) == ATTACHMENT) { if (child.getContent() != null) { String src = ((OutOfLineContent) child.getContent()).getUri(); File attachmentFile = new File(directory, src); MediaSource mediaSource = new MediaFileSource(attachmentFile,
/** * Creates a new hAtom "entry-content entry-title" anchor, containing the * given entry's out of line content link in the href attribute, and title as * its text. */ static XmlElement getOutOfLineContentElement(BaseContentEntry<?> entry) { checkNotNull(entry); XmlElement element = new XmlElement("a"); element.setAttribute("class", "entry-content entry-title"); String title = entry.getTitle().getPlainText(); String href; if (getType(entry) == ATTACHMENT) { href = title; } else if (getType(entry) == WEB_ATTACHMENT) { href = ((OutOfLineContent) entry.getContent()).getUri(); } else { LOGGER.log(Level.WARNING, "Only attachments have out of line content!"); href = ""; } element.setAttribute("href", href); element.addText(title); return element; }
/** * Creates a new hAtom "entry-title" element for the given entry. */ static XmlElement getTitleElement(BaseContentEntry<?> entry) { checkNotNull(entry); String title = entry.getTitle().getPlainText(); if (getType(entry) == ATTACHMENT) { return getHyperLink(title, title).setAttribute("class", "entry-title"); } else if (getType(entry) == WEB_ATTACHMENT) { String href = ((OutOfLineContent) entry.getContent()).getUri(); return getHyperLink(href, title).setAttribute("class", "entry-title"); } return new XmlElement("span").setAttribute("class", "entry-title") .addText(title); }