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

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

本文整理了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

  1. @Override
  2. public <T> List<T> execute() throws QueryException
  3. {
  4. return this.query.execute();
  5. }

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

  1. private List<String> getAllTags() throws QueryException
  2. {
  3. String query =
  4. "select distinct elements(prop.list) from BaseObject as obj, "
  5. + "DBStringListProperty as prop where obj.className='XWiki.TagClass' "
  6. + "and obj.id=prop.id.id and prop.id.name='tags'";
  7. List<String> tags = queryManager.createQuery(query, Query.HQL).execute();
  8. Collections.sort(tags, String.CASE_INSENSITIVE_ORDER);
  9. return tags;
  10. }
  11. }

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

  1. @Override
  2. public <T> List<T> execute() throws QueryException
  3. {
  4. return getWrappedQuery().execute();
  5. }
  6. }

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

  1. /**
  2. * Execute the query.
  3. *
  4. * @return the query result.
  5. * @throws java.io.IOException on encoding error.
  6. * @throws QueryException on query error.
  7. */
  8. protected <T> List<T> execute() throws IOException, QueryException
  9. {
  10. return getQuery().execute();
  11. }
  12. }

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

  1. private List<String> getDocumentsWithTag(String tag) throws QueryException
  2. {
  3. String query =
  4. "select doc.fullName from XWikiDocument as doc, BaseObject as obj, DBStringListProperty as prop "
  5. + "where obj.name=doc.fullName and obj.className='XWiki.TagClass' and obj.id=prop.id.id "
  6. + "and prop.id.name='tags' and :tag in elements(prop.list) order by doc.name asc";
  7. List<String> documentsWithTag = queryManager.createQuery(query, Query.HQL).bindValue("tag", tag).execute();
  8. return documentsWithTag;
  9. }
  10. }

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

  1. private List<String> runQuery(String queryString, String input)
  2. {
  3. String formattedInput = String.format(PhenotipsFamilyExport.INPUT_FORMAT, input.toLowerCase());
  4. // Query patients
  5. Query query = null;
  6. List<String> queryResults = null;
  7. try {
  8. query = this.qm.createQuery(queryString, Query.XWQL);
  9. query.bindValue(PhenotipsFamilyExport.INPUT_PARAMETER, formattedInput);
  10. queryResults = query.execute();
  11. } catch (QueryException e) {
  12. this.logger.error("Error while performing patients/families query: [{}] ", e.getMessage());
  13. return Collections.emptyList();
  14. }
  15. return queryResults;
  16. }

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

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

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

  1. @Override
  2. public long size()
  3. {
  4. long size = 0;
  5. try {
  6. getQuery();
  7. for (String wikiName : getWikis()) {
  8. size += (long) countQuery.setWiki(wikiName).execute().get(0);
  9. }
  10. } catch (QueryException e) {
  11. logger.error("Failed to count the documents.", e);
  12. }
  13. return size;
  14. }

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

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

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

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

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

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

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

  1. /**
  2. * Execute the query.
  3. *
  4. * @param subject the subject name
  5. * @return the query result.
  6. * @throws QueryException on query error.
  7. */
  8. protected <T> List<T> execute(PrincipalIndentifier subject) throws QueryException
  9. {
  10. return getQuery().bindValue(SUBJECT, subject.getName()).execute();
  11. }

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

  1. /**
  2. * Execute the query.
  3. *
  4. * @param issuer the issuer name.
  5. * @param serial the serial number.
  6. * @return the query result.
  7. * @throws QueryException on query error.
  8. */
  9. protected <T> List<T> execute(PrincipalIndentifier issuer, BigInteger serial) throws QueryException
  10. {
  11. return getQuery().bindValue(ISSUER, issuer.getName()).bindValue(SERIAL, serial.toString()).execute();
  12. }

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

  1. /**
  2. * Execute the query.
  3. *
  4. * @param keyId the subject key identifier.
  5. * @return the query result.
  6. * @throws IOException on encoding error.
  7. * @throws QueryException on query error.
  8. */
  9. protected <T> List<T> execute(byte[] keyId) throws IOException, QueryException
  10. {
  11. return getQuery().bindValue(KEYID, getEncoder().encode(keyId)).execute();
  12. }

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

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

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

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

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

  1. public List<String> getSpaces(XWikiContext context) throws XWikiException
  2. {
  3. try {
  4. return getStore().getQueryManager().getNamedQuery("getSpaces").execute();
  5. } catch (QueryException ex) {
  6. throw new XWikiException(0, 0, ex.getMessage(), ex);
  7. }
  8. }

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

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

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

  1. public void addAllWikiDocuments(XWikiContext context) throws XWikiException
  2. {
  3. XWiki wiki = context.getWiki();
  4. try {
  5. List<String> documentNames = wiki.getStore().getQueryManager().getNamedQuery("getAllDocuments").execute();
  6. for (String docName : documentNames) {
  7. add(docName, DocumentInfo.ACTION_OVERWRITE, context);
  8. }
  9. } catch (QueryException ex) {
  10. throw new PackageException(PackageException.ERROR_XWIKI_STORE_HIBERNATE_SEARCH,
  11. "Cannot retrieve the list of documents to export", ex);
  12. }
  13. }

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

  1. public List<String> getSpaceDocsName(String spaceName, XWikiContext context) throws XWikiException
  2. {
  3. try {
  4. return getStore().getQueryManager().getNamedQuery("getSpaceDocsName").bindValue("space", spaceName)
  5. .execute();
  6. } catch (QueryException ex) {
  7. throw new XWikiException(0, 0, ex.getMessage(), ex);
  8. }
  9. }

相关文章