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

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

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

Document.delete介绍

[英]Delete the document if the #getContentAuthor of the script calling this method has permission to do so. The deleter is also set to the said content author.
[中]如果调用此方法的脚本的#getContentAuthor具有删除文档的权限,请删除该文档。删除者也被设置为所述内容作者。

代码示例

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

void deletePage(DocumentInfo documentInfo) throws XWikiException
  {
    Document doc = documentInfo.getDocument();

    doc.delete();
  }
}

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

/**
 * Remove a page.
 * 
 * @param token The authentication token.
 * @param pageId The pageId in the 'Space.Page' format.
 * @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 Boolean removePage(String token, String pageId) throws Exception
{
  XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
  LOG.debug(String.format("User %s has called removePage()", user.getName()));
  Document doc = XWikiUtils.getDocument(this.xwikiApi, pageId, true);
  if (doc != null) {
    if (doc.getLocked()) {
      throw new Exception(String.format("[Unable to remove page. Document '%s' locked by '%s']",
        doc.getName(), doc.getLockingUser()));
    }
    doc.delete();
  } else {
    throw new Exception(String.format("[Page '%s' cannot be accessed]", pageId));
  }
  return true;
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-application-manager-api

@Override
public void delete() throws XWikiException
{
  if (getObjectNumbers(sclass.getClassFullName()) == 1) {
    super.delete();
  } else {
    doc.removeObject(getBaseObject(false));
    save();
  }
  this.isNew = true;
}

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

try {
  if (!doc.getLocked()) {
    doc.delete();
  } else {

相关文章

微信公众号

最新文章

更多