/** * Returns whether it has the value. * * @return whether it has the value */ public boolean hasValue() { return getValue() != null; }
/** * Returns whether it has the value. * * @return whether it has the value */ public boolean hasValue() { return getValue() != null; }
private int getMaxRevision(List<BaseContentEntry<?>> revisions) { int max = 0; for (BaseContentEntry<?> revision : revisions) { max = Math.max(max, revision.getRevision().getValue()); } return max; } }
private void exportRevision(BasePageEntry<?> revision, File revisionsDirectory) { int number = revision.getRevision().getValue(); File file = new File(revisionsDirectory, number + ".html"); Appendable out = null; try { out = appendableFactory.getAppendable(file); revisionExporter.exportRevision(revision, out); } catch(IOException e) { LOGGER.log(Level.WARNING, "Failed writing to file: " + file, e); } finally { if (out instanceof Closeable) { try { ((Closeable) out).close(); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed closing file: " + file, e); } } } } }
/** * Creates a new "sites:revision" for the given entry. */ static XmlElement getRevisionElement(BaseContentEntry<?> entry) { checkNotNull(entry); XmlElement element = new XmlElement("span"); element.setAttribute("class", "sites:revision"); if (entry.getRevision() == null) { element.addText("1"); } else { element.addText(entry.getRevision().getValue().toString()); } return element; }
@Override public void exportRevision(BasePageEntry<?> revision, Appendable out) throws IOException { XmlElement html = new XmlElement("html"); XmlElement head = new XmlElement("head"); XmlElement title = new XmlElement("title"); title.addText(revision.getTitle().getPlainText() + " (Version " + revision.getRevision().getValue() + ")"); html.addElement(head.addElement(title)); XmlElement body = new XmlElement("body"); XmlElement mainDiv = new XmlElement("div"); mainDiv.setAttribute("class", "hentry " + getType(revision).toString()); mainDiv.setAttribute("id", revision.getId()); mainDiv.addElement(titleRenderer.renderTitle(revision)); mainDiv.addElement(revisionRenderer.renderRevision(revision)); if (getType(revision) == LIST_PAGE) { List<ListItemEntry> items = Lists.newArrayList(); // TODO(gk5885): remove extra cast for // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214 mainDiv.addElement(listRenderer.renderList((ListPageEntry) revision, items)); } html.addElement(body.addElement(mainDiv)); html.appendTo(out); } }
int maxRevision = getMaxRevision(revisions); for (BaseContentEntry<?> revision : revisions) { int number = revision.getRevision().getValue(); XmlElement row = new XmlElement("tr"); String href = (number == maxRevision) ? "index.html" :