gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-27 07:53:05 25 4
gpt4 key购买 nike

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

XWiki.getClass介绍

[英]Get the XWiki Class object defined in the passed Document name.

Note: This method doesn't require any rights for accessing the passed Document (as opposed to the com.xpn.xwiki.api.Document#getClass() method which does require to get a Document object first. This is thus useful in cases where the calling code doesn't have the access right to the specified Document. It is safe because there are no sensitive data stored in a Class definition.
[中]获取在传递的文档名中定义的XWiki类对象。
注意:此方法不需要访问传递的文档的任何权限(与com.xpn.xwiki.api.Document#getClass()方法不同,后者需要先获取文档对象。因此,在调用代码没有访问指定文档的权限的情况下,这非常有用。它是安全的,因为类定义中没有存储敏感数据。

代码示例

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

/**
 * Get a specific class.
 * 
 * @param token The authentication token.
 * @param className The class name.
 * @return A map representing a XWikiClass object.
 * @throws Exception An invalid token is provided or if the given class does not exist.
 */
public Map getClass(String token, String className) throws Exception
{
  XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
  LOG.debug(String.format("User %s has called getClass()", user.getName()));
  if (!this.xwikiApi.exists(className)) {
    throw new Exception(String.format("[Class '%s' does not exist]", className));
  }
  com.xpn.xwiki.api.Class userClass = this.xwikiApi.getClass(className);
  return DomainObjectFactory.createXWikiClass(userClass).toRawMap();
}

代码示例来源: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);
    }
  }
}

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

@GET
  public Class getClass(@PathParam("wikiName") String wikiName, @PathParam("className") String className)
    throws XWikiException
  {

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

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

      com.xpn.xwiki.api.Class xwikiClass = Utils.getXWikiApi(componentManager).getClass(className);
      if (xwikiClass == null) {
        throw new WebApplicationException(Status.NOT_FOUND);
      }

      return DomainObjectFactory.createClass(objectFactory, uriInfo.getBaseUri(), wikiName, xwikiClass);
    } finally {
      Utils.getXWiki(componentManager).setDatabase(database);
    }
  }
}

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

Utils.getXWikiContext(componentManager).setDatabase(wikiName);
com.xpn.xwiki.api.Class xwikiClass = Utils.getXWikiApi(componentManager).getClass(className);
if (xwikiClass == null) {
  throw new WebApplicationException(Status.NOT_FOUND);

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

Utils.getXWikiContext(componentManager).setDatabase(wikiName);
com.xpn.xwiki.api.Class xwikiClass = Utils.getXWikiApi(componentManager).getClass(className);
if (xwikiClass == null) {
  throw new WebApplicationException(Status.NOT_FOUND);

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

com.xpn.xwiki.api.Class xwikiClass = this.xwikiApi.getClass(object.getClassName());
for (Object propertyNameObject : xwikiClass.getPropertyNames()) {
  String propertyName = (String) propertyNameObject;

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