com.xpn.xwiki.api.Document.getComments()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中com.xpn.xwiki.api.Document.getComments()方法的一些代码示例,展示了Document.getComments()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Document.getComments()方法的具体详情如下:
包路径:com.xpn.xwiki.api.Document
类名称:Document
方法名:getComments

Document.getComments介绍

暂无

代码示例

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

public Vector<Object> getComments()
{
  return getComments(true);
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server

@GET
public Comment getComment(@PathParam("wikiName") String wikiName, @PathParam("spaceName") String spaceName,
  @PathParam("pageName") String pageName, @PathParam("id") Integer id,
  @QueryParam("start") @DefaultValue("0") Integer start, @QueryParam("number") @DefaultValue("-1") Integer number)
  throws XWikiException
{
  DocumentInfo documentInfo = getDocumentInfo(wikiName, spaceName, pageName, null, null, true, false);
  Document doc = documentInfo.getDocument();
  Vector<com.xpn.xwiki.api.Object> xwikiComments = doc.getComments();
  for (com.xpn.xwiki.api.Object xwikiComment : xwikiComments) {
    if (id.equals(xwikiComment.getNumber())) {
      return DomainObjectFactory.createComment(objectFactory, uriInfo.getBaseUri(), doc, xwikiComment);
    }
  }
  throw new WebApplicationException(Status.NOT_FOUND);
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server

@GET
  public Comment getCommentVersion(@PathParam("wikiName") String wikiName, @PathParam("spaceName") String spaceName,
    @PathParam("pageName") String pageName, @PathParam("version") String version, @PathParam("id") Integer id,
    @QueryParam("start") @DefaultValue("0") Integer start, @QueryParam("number") @DefaultValue("-1") Integer number)
    throws XWikiException
  {
    DocumentInfo documentInfo = getDocumentInfo(wikiName, spaceName, pageName, null, version, true, false);

    Document doc = documentInfo.getDocument();

    Vector<com.xpn.xwiki.api.Object> xwikiComments = doc.getComments();

    for (com.xpn.xwiki.api.Object xwikiComment : xwikiComments) {
      if (id.equals(xwikiComment.getNumber())) {
        return DomainObjectFactory.createComment(objectFactory, uriInfo.getBaseUri(), doc, xwikiComment);
      }
    }

    throw new WebApplicationException(Status.NOT_FOUND);
  }
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server

@GET
public Comments getComments(@PathParam("wikiName") String wikiName, @PathParam("spaceName") String spaceName,
  @PathParam("pageName") String pageName, @QueryParam("start") @DefaultValue("0") Integer start,
  @QueryParam("number") @DefaultValue("-1") Integer number) throws XWikiException
{
  DocumentInfo documentInfo = getDocumentInfo(wikiName, spaceName, pageName, null, null, 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));
  }
  return comments;
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server

@GET
  public Comments getCommentsVersion(@PathParam("wikiName") String wikiName,
    @PathParam("spaceName") String spaceName, @PathParam("pageName") String pageName,
    @PathParam("version") String version, @QueryParam("start") @DefaultValue("0") Integer start,
    @QueryParam("number") @DefaultValue("-1") Integer number) throws XWikiException
  {
    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));
    }

    return comments;
  }
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

/**
 * @param token The authentication token.
 * @param pageId The pageId in the 'Space.Page' format.
 * @return A list of maps representing Comment objects.
 * @throws Exception An invalid token is provided or if the page does not exist or the user has not the right to
 *             access it.
 */
public List getComments(String token, String pageId) throws Exception
{
  XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
  LOG.debug(String.format("User %s has called getComments()", user.getName()));
  List result = new ArrayList();
  Document doc = XWikiUtils.getDocument(this.xwikiApi, pageId, true);
  Vector<com.xpn.xwiki.api.Object> comments = doc.getComments();
  if (comments != null) {
    for (com.xpn.xwiki.api.Object commentObject : comments) {
      result.add(DomainObjectFactory.createComment(doc, commentObject).toRawMap());
    }
  }
  return result;
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server

if (!doc.getComments().isEmpty()) {
  String commentsUri;
  if (useVersion) {

相关文章

微信公众号

最新文章

更多