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

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

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

Document.setContent介绍

暂无

代码示例

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

/**
 * Add a new space. It basically creates a SpaceKey.WebHome page with no content and the space title as its title.
 * 
 * @param token The authentication token.
 * @param spaceMap The map representing a Space object.
 * @return The newly created space as a Space object.
 * @throws Exception An invalid token is provided or the space cannot be created or it already exists and the user
 *             has not the rights to modify it
 */
public Map addSpace(String token, Map spaceMap) throws Exception
{
  XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
  LOG.debug(String.format("User %s has called addSpace()", user.getName()));
  Space space = new Space(spaceMap);
  if (this.xwikiApi.getSpaces().contains(space.getKey())) {
    throw new Exception(String.format("[Space '%s' already exists]", space.getKey()));
  }
  String spaceWebHomeId = String.format("%s.WebHome", space.getKey());
  Document spaceWebHome = this.xwikiApi.getDocument(spaceWebHomeId);
  if (spaceWebHome != null) {
    spaceWebHome.setContent("");
    spaceWebHome.setTitle(space.getName());
    spaceWebHome.save();
    return DomainObjectFactory.createSpace(spaceWebHome).toRawMap();
  } else {
    throw new Exception(String.format(
      "[Space cannot be created or it already exists and user '%s' has not the right to modify it]",
      user.getName()));
  }
}

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

doc.setContent(page.getContent());
save = true;

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

userApiDoc.setContent("{{include document=\"XWiki.XWikiUserSheet\"/}}");
  userApiDoc.setSyntax(Syntax.XWIKI_2_0);
} else {
  userApiDoc.setContent("#includeForm(\"XWiki.XWikiUserSheet\")");
  userApiDoc.setSyntax(Syntax.XWIKI_1_0);
  XWikiDocument tdoc = context.getWiki().getDocument(template, context);
  if ((!tdoc.isNew())) {
    userApiDoc.setContent(tdoc.getContent());
    userApiDoc.setSyntaxId(tdoc.getSyntaxId());

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

doc.setContent(page.getContent());
doc.setTitle(page.getTitle());

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

/**
 * Add a group from the request
 * @param context
 * @return
 */
public Group addGroup(XWikiContext context) throws XWikiException {
  XWikiRequest req = context.getRequest();
  String name = req.get("XWiki.DirectoryGroupClass_0_name");
  name = context.getWiki().clearName(name, context);
  XWikiDocument tmpDoc = context.getWiki().getDocument(DEFAULT_PLUGIN_SPACE, name, context);
  if (!tmpDoc.isNew())
    throw new PluginException(UserDirectoryPlugin.class, ERROR_USERDIRECTORYPLUGIN_ALREADYEXIST, "This document already exist, try another name");
  Document doc = tmpDoc.newDocument(context);
  doc.addObjectFromRequest("XWiki.DirectoryGroupClass");
  doc.setContent(getTemplate(context));
  doc.saveWithProgrammingRights();
  return new Group(doc, context);
}

相关文章

微信公众号

最新文章

更多