use of org.xwiki.rest.model.jaxb.Comments in project xwiki-platform by xwiki.
the class CommentsVersionResourceImpl method getCommentsVersion.
@Override
public Comments getCommentsVersion(String wikiName, String spaceName, String pageName, String version, Integer start, Integer number, Boolean withPrettyNames) throws XWikiRestException {
try {
DocumentInfo documentInfo = getDocumentInfo(wikiName, spaceName, pageName, null, version, true, false);
Document doc = documentInfo.getDocument();
Comments comments = objectFactory.createComments();
Vector<com.xpn.xwiki.api.Object> xwikiComments = doc.getComments();
RangeIterable<com.xpn.xwiki.api.Object> ri = new RangeIterable<com.xpn.xwiki.api.Object>(xwikiComments, start, number);
for (com.xpn.xwiki.api.Object xwikiComment : ri) {
comments.getComments().add(DomainObjectFactory.createComment(objectFactory, uriInfo.getBaseUri(), doc, xwikiComment, Utils.getXWikiApi(componentManager), withPrettyNames));
}
return comments;
} catch (XWikiException e) {
throw new XWikiRestException(e);
}
}
Aggregations