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

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

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

Query.setLimit介绍

暂无

代码示例

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

  1. @Override
  2. public Query setLimit(int limit)
  3. {
  4. this.query.setLimit(limit);
  5. return this;
  6. }

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

  1. @Override
  2. public Query setLimit(int limit)
  3. {
  4. return getWrappedQuery().setLimit(limit);
  5. }

代码示例来源:origin: org.phenotips/family-studies-api

  1. private long getLastUsedId() throws QueryException
  2. {
  3. this.logger.debug("getLastUsedId()");
  4. long crtMaxID = 0;
  5. Query q = this.qm.createQuery("select family.identifier "
  6. + "from Document doc, "
  7. + " doc.object(PhenoTips.FamilyClass) as family "
  8. + "where family.identifier is not null "
  9. + "order by family.identifier desc", Query.XWQL).setLimit(1);
  10. List<Long> crtMaxIDList = q.execute();
  11. if (crtMaxIDList.size() > 0 && crtMaxIDList.get(0) != null) {
  12. crtMaxID = crtMaxIDList.get(0);
  13. }
  14. crtMaxID = Math.max(crtMaxID, 0);
  15. return crtMaxID;
  16. }

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

  1. @Override
  2. protected long getLastUsedId()
  3. {
  4. this.logger.debug("getLastUsedId()");
  5. long crtMaxID = 0;
  6. try {
  7. Query q = this.qm.createQuery("select family.identifier "
  8. + "from Document doc, "
  9. + " doc.object(PhenoTips.FamilyClass) as family "
  10. + "where family.identifier is not null "
  11. + "order by family.identifier desc", Query.XWQL).setLimit(1);
  12. List<Long> crtMaxIDList = q.execute();
  13. if (crtMaxIDList.size() > 0 && crtMaxIDList.get(0) != null) {
  14. crtMaxID = crtMaxIDList.get(0);
  15. }
  16. crtMaxID = Math.max(crtMaxID, 0);
  17. } catch (QueryException ex) {
  18. this.logger.warn("Failed to get the last used identifier: {}", ex.getMessage());
  19. }
  20. return crtMaxID;
  21. }

代码示例来源:origin: org.phenotips/patient-data-default-impl

  1. @Override
  2. protected long getLastUsedId()
  3. {
  4. long crtMaxID = 0;
  5. try {
  6. Query q =
  7. this.qm.createQuery(
  8. "select patient.identifier from Document doc, doc.object(PhenoTips.PatientClass) as patient"
  9. + " where patient.identifier is not null order by patient.identifier desc",
  10. Query.XWQL).setLimit(1);
  11. List<Long> crtMaxIDList = q.execute();
  12. if (!crtMaxIDList.isEmpty() && crtMaxIDList.get(0) != null) {
  13. crtMaxID = crtMaxIDList.get(0);
  14. }
  15. crtMaxID = Math.max(crtMaxID, 0);
  16. } catch (QueryException ex) {
  17. this.logger.warn("Failed to get the last used identifier: {}", ex.getMessage());
  18. }
  19. return crtMaxID;
  20. }
  21. }

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

  1. @Override
  2. protected long getLastUsedId()
  3. {
  4. long crtMaxID = 0;
  5. try {
  6. Query q =
  7. this.qm.createQuery(
  8. "select patient.identifier from Document doc, doc.object(PhenoTips.PatientClass) as patient"
  9. + " where patient.identifier is not null order by patient.identifier desc",
  10. Query.XWQL).setLimit(1);
  11. List<Long> crtMaxIDList = q.execute();
  12. if (!crtMaxIDList.isEmpty() && crtMaxIDList.get(0) != null) {
  13. crtMaxID = crtMaxIDList.get(0);
  14. }
  15. crtMaxID = Math.max(crtMaxID, 0);
  16. } catch (QueryException ex) {
  17. this.logger.warn("Failed to get the last used identifier: {}", ex.getMessage());
  18. }
  19. return crtMaxID;
  20. }
  21. }

代码示例来源:origin: org.phenotips/family-studies-api

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

代码示例来源:origin: org.phenotips/phenotips-entities-api

  1. protected long getLastUsedId()
  2. {
  3. long crtMaxID = 0;
  4. try {
  5. Query q =
  6. this.qm.createQuery(
  7. "select doc.name from Document doc, doc.object("
  8. + this.localSerializer.serialize(getEntityXClassReference())
  9. + ") as entity where doc.space = :space order by doc.name desc",
  10. Query.XWQL).bindValue("space", this.getDataSpace().getName()).setLimit(1);
  11. List<String> crtMaxIDList = q.execute();
  12. if (!crtMaxIDList.isEmpty() && crtMaxIDList.get(0) != null) {
  13. crtMaxID = Integer.parseInt(crtMaxIDList.get(0).replaceAll("\\D++", ""));
  14. }
  15. crtMaxID = Math.max(crtMaxID, 0);
  16. } catch (QueryException ex) {
  17. this.logger.warn("Failed to get the last used identifier: {}", ex.getMessage());
  18. }
  19. return crtMaxID;
  20. }

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

  1. protected long getLastUsedId()
  2. {
  3. long crtMaxID = 0;
  4. try {
  5. Query q =
  6. this.qm.createQuery(
  7. "select doc.name from Document doc, doc.object("
  8. + this.localSerializer.serialize(getEntityXClassReference())
  9. + ") as entity where doc.space = :space order by doc.name desc",
  10. Query.XWQL).bindValue("space", this.getDataSpace().getName()).setLimit(1);
  11. List<String> crtMaxIDList = q.execute();
  12. if (!crtMaxIDList.isEmpty() && crtMaxIDList.get(0) != null) {
  13. crtMaxID = Integer.parseInt(crtMaxIDList.get(0).replaceAll("\\D++", ""));
  14. }
  15. crtMaxID = Math.max(crtMaxID, 0);
  16. } catch (QueryException ex) {
  17. this.logger.warn("Failed to get the last used identifier: {}", ex.getMessage());
  18. }
  19. return crtMaxID;
  20. }

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

  1. private List<String> runQuery(String queryString, String formattedInput, int resultsLimit)
  2. {
  3. Query query = null;
  4. List<String> queryResults = null;
  5. try {
  6. query = this.qm.createQuery(queryString, Query.XWQL);
  7. if (resultsLimit > 0) {
  8. query.setLimit(resultsLimit);
  9. query.setOffset(0);
  10. }
  11. if (StringUtils.isNotBlank(formattedInput)) {
  12. query.bindValue(UsersAndGroups.INPUT_PARAMETER, formattedInput);
  13. }
  14. queryResults = query.execute();
  15. } catch (QueryException e) {
  16. this.logger.error("Error while performing query: [{}] ", queryString, e.getMessage());
  17. return Collections.emptyList();
  18. }
  19. return queryResults;
  20. }

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

  1. @Override
  2. public List<Event> getRecentPersonalMessages(DocumentReference author, int limit, int offset)
  3. {
  4. List<Event> result = new ArrayList<Event>();
  5. try {
  6. Query q = this.qm.createQuery(
  7. "where event.application = 'MessageStream' and event.type = 'personalMessage'"
  8. + " and event.user = :user order by event.date desc",
  9. Query.XWQL);
  10. q.bindValue("user", this.serializer.serialize(author));
  11. q.setLimit(limit > 0 ? limit : 30).setOffset(offset >= 0 ? offset : 0);
  12. result = this.stream.searchEvents(q);
  13. } catch (QueryException ex) {
  14. LOG.warn("Failed to search personal messages: {}", ex.getMessage());
  15. }
  16. return result;
  17. }

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

  1. @Override
  2. public List<Event> getRecentMessagesForGroup(DocumentReference group, int limit, int offset)
  3. {
  4. List<Event> result = new ArrayList<Event>();
  5. try {
  6. Query q = this.qm.createQuery(
  7. "where event.application = 'MessageStream' and event.type = 'groupMessage'"
  8. + " and event.stream = :group order by event.date desc",
  9. Query.XWQL);
  10. q.bindValue("group", this.serializer.serialize(group));
  11. q.setLimit(limit > 0 ? limit : 30).setOffset(offset >= 0 ? offset : 0);
  12. result = this.stream.searchEvents(q);
  13. } catch (QueryException ex) {
  14. LOG.warn("Failed to search group messages: {}", ex.getMessage());
  15. }
  16. return result;
  17. }

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

  1. queryResult =
  2. queryManager.createQuery(query, Query.XWQL).bindValue("space", spaceName).bindValue("name", pageName)
  3. .setLimit(number).bindValue("language", "").setOffset(start).execute();

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

  1. @Override
  2. public List<Event> getRecentDirectMessages(int limit, int offset)
  3. {
  4. List<Event> result = new ArrayList<Event>();
  5. try {
  6. Query q = this.qm.createQuery(
  7. "where event.application = 'MessageStream' and event.type = 'directMessage'"
  8. + " and event.stream = :targetUser order by event.date desc",
  9. Query.XWQL);
  10. q.bindValue("targetUser", this.serializer.serialize(this.bridge.getCurrentUserReference()));
  11. q.setLimit(limit > 0 ? limit : 30).setOffset(offset >= 0 ? offset : 0);
  12. result = this.stream.searchEvents(q);
  13. } catch (QueryException ex) {
  14. LOG.warn("Failed to search direct messages: {}", ex.getMessage());
  15. }
  16. return result;
  17. }

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

  1. List<String> childPageFullNames =
  2. queryManager.createQuery(queryString, Query.XWQL).bindValue("parent", doc.getFullName()).setOffset(start)
  3. .setLimit(number).execute();

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

  1. queryManager.getNamedQuery("getSpaces").setOffset(start).setLimit(number).execute();

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

  1. queryManager.createQuery(query, Query.XWQL).bindValue("className", className).setLimit(number)
  2. .setOffset(start).execute();

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

  1. query.setLimit(nb);

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

  1. query = queryManager.createQuery(select + whereClause + orderBy, Query.HQL).setLimit(LIMIT);
  2. countQuery = queryManager.createQuery(whereClause, Query.HQL).addFilter(countFilter);

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

  1. .setLimit(queryLimit)
  2. .bindValue("className", className)
  3. .setWiki(classReference.getWikiReference().getName())

相关文章