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

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

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

@Override
public Query setLimit(int limit)
{
  this.query.setLimit(limit);
  return this;
}

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

@Override
public Query setLimit(int limit)
{
  return getWrappedQuery().setLimit(limit);
}

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

private long getLastUsedId() throws QueryException
{
  this.logger.debug("getLastUsedId()");
  long crtMaxID = 0;
  Query q = this.qm.createQuery("select family.identifier "
    + "from     Document doc, "
    + "         doc.object(PhenoTips.FamilyClass) as family "
    + "where    family.identifier is not null "
    + "order by family.identifier desc", Query.XWQL).setLimit(1);
  List<Long> crtMaxIDList = q.execute();
  if (crtMaxIDList.size() > 0 && crtMaxIDList.get(0) != null) {
    crtMaxID = crtMaxIDList.get(0);
  }
  crtMaxID = Math.max(crtMaxID, 0);
  return crtMaxID;
}

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

@Override
protected long getLastUsedId()
{
  this.logger.debug("getLastUsedId()");
  long crtMaxID = 0;
  try {
    Query q = this.qm.createQuery("select family.identifier "
      + "from     Document doc, "
      + "         doc.object(PhenoTips.FamilyClass) as family "
      + "where    family.identifier is not null "
      + "order by family.identifier desc", Query.XWQL).setLimit(1);
    List<Long> crtMaxIDList = q.execute();
    if (crtMaxIDList.size() > 0 && crtMaxIDList.get(0) != null) {
      crtMaxID = crtMaxIDList.get(0);
    }
    crtMaxID = Math.max(crtMaxID, 0);
  } catch (QueryException ex) {
    this.logger.warn("Failed to get the last used identifier: {}", ex.getMessage());
  }
  return crtMaxID;
}

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

@Override
  protected long getLastUsedId()
  {
    long crtMaxID = 0;
    try {
      Query q =
        this.qm.createQuery(
          "select patient.identifier from Document doc, doc.object(PhenoTips.PatientClass) as patient"
            + " where patient.identifier is not null order by patient.identifier desc",
          Query.XWQL).setLimit(1);
      List<Long> crtMaxIDList = q.execute();
      if (!crtMaxIDList.isEmpty() && crtMaxIDList.get(0) != null) {
        crtMaxID = crtMaxIDList.get(0);
      }
      crtMaxID = Math.max(crtMaxID, 0);
    } catch (QueryException ex) {
      this.logger.warn("Failed to get the last used identifier: {}", ex.getMessage());
    }
    return crtMaxID;
  }
}

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

@Override
  protected long getLastUsedId()
  {
    long crtMaxID = 0;
    try {
      Query q =
        this.qm.createQuery(
          "select patient.identifier from Document doc, doc.object(PhenoTips.PatientClass) as patient"
            + " where patient.identifier is not null order by patient.identifier desc",
          Query.XWQL).setLimit(1);
      List<Long> crtMaxIDList = q.execute();
      if (!crtMaxIDList.isEmpty() && crtMaxIDList.get(0) != null) {
        crtMaxID = crtMaxIDList.get(0);
      }
      crtMaxID = Math.max(crtMaxID, 0);
    } catch (QueryException ex) {
      this.logger.warn("Failed to get the last used identifier: {}", ex.getMessage());
    }
    return crtMaxID;
  }
}

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

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

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

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

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

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

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

private List<String> runQuery(String queryString, String formattedInput, int resultsLimit)
{
  Query query = null;
  List<String> queryResults = null;
  try {
    query = this.qm.createQuery(queryString, Query.XWQL);
    if (resultsLimit > 0) {
      query.setLimit(resultsLimit);
      query.setOffset(0);
    }
    if (StringUtils.isNotBlank(formattedInput)) {
      query.bindValue(UsersAndGroups.INPUT_PARAMETER, formattedInput);
    }
    queryResults = query.execute();
  } catch (QueryException e) {
    this.logger.error("Error while performing query: [{}] ", queryString, e.getMessage());
    return Collections.emptyList();
  }
  return queryResults;
}

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

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

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

@Override
public List<Event> getRecentMessagesForGroup(DocumentReference group, int limit, int offset)
{
  List<Event> result = new ArrayList<Event>();
  try {
    Query q = this.qm.createQuery(
      "where event.application = 'MessageStream' and event.type = 'groupMessage'"
        + " and event.stream = :group order by event.date desc",
      Query.XWQL);
    q.bindValue("group", this.serializer.serialize(group));
    q.setLimit(limit > 0 ? limit : 30).setOffset(offset >= 0 ? offset : 0);
    result = this.stream.searchEvents(q);
  } catch (QueryException ex) {
    LOG.warn("Failed to search group messages: {}", ex.getMessage());
  }
  return result;
}

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

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

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

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

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

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

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

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

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

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

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

query.setLimit(nb);

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

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

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

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

相关文章