org.xwiki.query.Query.execute()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(98)

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

Query.execute介绍

暂无

代码示例

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

@Override
public <T> List<T> execute() throws QueryException
{
  return this.query.execute();
}

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

private List<String> getAllTags() throws QueryException
  {
    String query =
      "select distinct elements(prop.list) from BaseObject as obj, "
        + "DBStringListProperty as prop where obj.className='XWiki.TagClass' "
        + "and obj.id=prop.id.id and prop.id.name='tags'";

    List<String> tags = queryManager.createQuery(query, Query.HQL).execute();
    Collections.sort(tags, String.CASE_INSENSITIVE_ORDER);

    return tags;
  }
}

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

@Override
  public <T> List<T> execute() throws QueryException
  {
    return getWrappedQuery().execute();
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-crypto-store-wiki

/**
   * Execute the query.
   *
   * @return the query result.
   * @throws java.io.IOException on encoding error.
   * @throws QueryException on query error.
   */
  protected <T> List<T> execute() throws IOException, QueryException
  {
    return getQuery().execute();
  }
}

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

private List<String> getDocumentsWithTag(String tag) throws QueryException
  {
    String query =
      "select doc.fullName from XWikiDocument as doc, BaseObject as obj, DBStringListProperty as prop "
        + "where obj.name=doc.fullName and obj.className='XWiki.TagClass' and obj.id=prop.id.id "
        + "and prop.id.name='tags' and :tag in elements(prop.list) order by doc.name asc";

    List<String> documentsWithTag = queryManager.createQuery(query, Query.HQL).bindValue("tag", tag).execute();

    return documentsWithTag;
  }
}

代码示例来源:origin: phenotips/phenotips

private List<String> runQuery(String queryString, String input)
{
  String formattedInput = String.format(PhenotipsFamilyExport.INPUT_FORMAT, input.toLowerCase());
  // Query patients
  Query query = null;
  List<String> queryResults = null;
  try {
    query = this.qm.createQuery(queryString, Query.XWQL);
    query.bindValue(PhenotipsFamilyExport.INPUT_PARAMETER, formattedInput);
    queryResults = query.execute();
  } catch (QueryException e) {
    this.logger.error("Error while performing patients/families query: [{}] ", e.getMessage());
    return Collections.emptyList();
  }
  return queryResults;
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-icon-default

@Override
  public List<String> getIconSetNames() throws IconException
  {
    try {
      String xwql = "SELECT obj.name FROM Document doc, doc.object(IconThemesCode.IconThemeClass) obj "
          + "ORDER BY obj.name";
      Query query = queryManager.createQuery(xwql, Query.XWQL);
      return query.execute();
    } catch (QueryException e) {
      throw new IconException("Failed to get the name of all icon sets.", e);
    }
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-search-solr-api

@Override
public long size()
{
  long size = 0;
  try {
    getQuery();
    for (String wikiName : getWikis()) {
      size += (long) countQuery.setWiki(wikiName).execute().get(0);
    }
  } catch (QueryException e) {
    logger.error("Failed to count the documents.", e);
  }
  return size;
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-wikistream-instance-oldcore

@Override
public List<String> getSpaces(String wiki) throws WikiStreamException
{
  try {
    return this.queryManager.getNamedQuery("getSpaces").setWiki(wiki).execute();
  } catch (QueryException e) {
    throw new WikiStreamException(String.format("Failed to get the list of spaces in wiki [%s]", wiki), e);
  }
}

代码示例来源:origin: phenotips/phenotips

/**
 * Retrieves and collects patient entities that correspond to the provided external ID.
 *
 * @param patientsBuilder a patient entity set builder
 * @param eids external patient IDs, as a list
 * @throws QueryException if the query fails
 */
private void collectPatientsFromEids(@Nonnull final ImmutableSet.Builder<PrimaryEntity> patientsBuilder,
  @Nonnull final List<Object> eids) throws QueryException
{
  final Query q = this.qm.createQuery("from doc.object(PhenoTips.PatientClass) p where p.external_id in (:eids)",
    Query.XWQL);
  q.bindValue("eids", eids);
  final List<Object> patientIds = q.execute();
  addIds(patientsBuilder, patientIds);
}

代码示例来源:origin: org.phenotips/patient-data-sharing-receiver-api

protected Patient getPatientByGUID(String guid)
{
  try {
    Query q =
      this.queryManager.createQuery("from doc.object(PhenoTips.PatientClass) as o where o.guid = :guid",
        Query.XWQL).bindValue("guid", guid);
    List<String> results = q.<String>execute();
    if (results.size() == 1) {
      DocumentReference reference =
        this.stringResolver.resolve(results.get(0), Patient.DEFAULT_DATA_SPACE);
      return new PhenoTipsPatient((XWikiDocument) this.bridge.getDocument(reference));
    }
  } catch (Exception ex) {
    this.logger.warn("Failed to get patient with GUID [{}]: [{}] {}", guid, ex.getMessage(), ex);
  }
  return null;
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-crypto-store-wiki

/**
 * Execute the query.
 *
 * @param subject the subject name
 * @return the query result.
 * @throws QueryException on query error.
 */
protected <T> List<T> execute(PrincipalIndentifier subject) throws QueryException
{
  return getQuery().bindValue(SUBJECT, subject.getName()).execute();
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-crypto-store-wiki

/**
 * Execute the query.
 *
 * @param issuer the issuer name.
 * @param serial the serial number.
 * @return the query result.
 * @throws QueryException on query error.
 */
protected <T> List<T> execute(PrincipalIndentifier issuer, BigInteger serial) throws QueryException
{
  return getQuery().bindValue(ISSUER, issuer.getName()).bindValue(SERIAL, serial.toString()).execute();
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-crypto-store-wiki

/**
 * Execute the query.
 *
 * @param keyId the subject key identifier.
 * @return the query result.
 * @throws IOException on encoding error.
 * @throws QueryException on query error.
 */
protected <T> List<T> execute(byte[] keyId) throws IOException, QueryException
{
  return getQuery().bindValue(KEYID, getEncoder().encode(keyId)).execute();
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-rendering-wikimacro-store

/**
 * Search for all wiki macros in the current wiki.
 * 
 * @param xcontext the current request context
 * @return a list of documents containing wiki macros, each item as a List of 3 strings: space name, document name,
 *         last author of the document
 * @throws Exception if the database search fails
 */
private List<Object[]> getWikiMacroDocumentData(XWikiContext xcontext) throws Exception
{
  final QueryManager qm = xcontext.getWiki().getStore().getQueryManager();
  final Query q = qm.getNamedQuery("getWikiMacroDocuments");
  return (List<Object[]>) (List) q.execute();
}

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

public void refreshLinks(XWikiContext context) throws XWikiException
{
  try {
    // refreshes all Links of each doc of the wiki
    List<String> docs = getStore().getQueryManager().getNamedQuery("getAllDocuments").execute();
    for (int i = 0; i < docs.size(); i++) {
      XWikiDocument myDoc = this.getDocument(docs.get(i), context);
      myDoc.getStore().saveLinks(myDoc, context, true);
    }
  } catch (QueryException ex) {
    throw new XWikiException(0, 0, ex.getMessage(), ex);
  }
}

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

public List<String> getSpaces(XWikiContext context) throws XWikiException
{
  try {
    return getStore().getQueryManager().getNamedQuery("getSpaces").execute();
  } catch (QueryException ex) {
    throw new XWikiException(0, 0, ex.getMessage(), ex);
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-wiki-default

@Override
public List<String> getAllXWikiServerClassDocumentNames() throws WikiManagerException
{
  WikiDescriptorManager wikiDescriptorManager = wikiDescriptorManagerProvider.get();
  try {
    Query query = this.queryManager.createQuery(
        "from doc.object(XWiki.XWikiServerClass) as descriptor where doc.name like 'XWikiServer%' "
            + "and doc.fullName <> 'XWiki.XWikiServerClassTemplate'",
        Query.XWQL);
    query.setWiki(wikiDescriptorManager.getMainWikiId());
    query.addFilter(componentManager.<QueryFilter>getInstance(QueryFilter.class, "unique"));
    return query.execute();
  } catch (Exception e) {
    throw new WikiManagerException("Failed to locate XWiki.XWikiServerClass documents", e);
  }
}

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

public void addAllWikiDocuments(XWikiContext context) throws XWikiException
{
  XWiki wiki = context.getWiki();
  try {
    List<String> documentNames = wiki.getStore().getQueryManager().getNamedQuery("getAllDocuments").execute();
    for (String docName : documentNames) {
      add(docName, DocumentInfo.ACTION_OVERWRITE, context);
    }
  } catch (QueryException ex) {
    throw new PackageException(PackageException.ERROR_XWIKI_STORE_HIBERNATE_SEARCH,
      "Cannot retrieve the list of documents to export", ex);
  }
}

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

public List<String> getSpaceDocsName(String spaceName, XWikiContext context) throws XWikiException
{
  try {
    return getStore().getQueryManager().getNamedQuery("getSpaceDocsName").bindValue("space", spaceName)
      .execute();
  } catch (QueryException ex) {
    throw new XWikiException(0, 0, ex.getMessage(), ex);
  }
}

相关文章