gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-27 08:21:05 28 4
gpt4 key购买 nike

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

XWiki.getClassList介绍

[英]Get the list of available classes in the wiki
[中]获取wiki中可用类的列表

代码示例

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

/**
 * Get classes.
 * 
 * @param token The authentication token.
 * @return A list of maps representing XWikiClass objects.
 * @throws Exception An invalid token is provided.
 */
public List getClasses(String token) throws Exception
{
  XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
  LOG.debug(String.format("User %s has called getClasses()", user.getName()));
  List result = new ArrayList();
  List<String> classNames = this.xwikiApi.getClassList();
  for (String className : classNames) {
    result.add(DomainObjectFactory.createXWikiClassSummary(className).toRawMap());
  }
  return result;
}

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

@GET
  public Classes getClasses(@PathParam("wikiName") String wikiName,
    @QueryParam("start") @DefaultValue("0") Integer start, @QueryParam("number") @DefaultValue("-1") Integer number)
    throws XWikiException
  {

    String database = Utils.getXWikiContext(componentManager).getDatabase();

    try {
      Utils.getXWikiContext(componentManager).setDatabase(wikiName);

      List<String> classNames = Utils.getXWikiApi(componentManager).getClassList();
      Collections.sort(classNames);

      RangeIterable<String> ri = new RangeIterable<String>(classNames, start, number);

      Classes classes = objectFactory.createClasses();

      for (String className : ri) {
        com.xpn.xwiki.api.Class xwikiClass = Utils.getXWikiApi(componentManager).getClass(className);
        classes.getClazzs().add(
          DomainObjectFactory.createClass(objectFactory, uriInfo.getBaseUri(), wikiName, xwikiClass));
      }

      return classes;
    } finally {
      Utils.getXWiki(componentManager).setDatabase(database);
    }
  }
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com