net.java.ao.Query.limit()方法的使用及代码示例

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

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

Query.limit介绍

暂无

代码示例

代码示例来源:origin: com.marvelution.jira.plugins/jira-jenkins-plugin

@Override
  public List<IssueMapping> doInTransaction() {
    return Arrays.asList(ao.find(IssueMapping.class, query.limit(maxResults)));
  }
});

代码示例来源:origin: com.marvelution.jira.plugins/jira-jenkins-plugin

@Override
  public Set<BuildMapping> doInTransaction() {
    return newHashSet(ao.find(BuildMapping.class, query.limit(maxResults)));
  }
}), buildMappingToBuildFunction));

代码示例来源:origin: com.marvelution.bamboo.plugins/bamboo-sonar-tasks

@Override
  public SonarServer doInTransaction() {
    try {
      return objects.find(SonarServer.class, Query.select().where("NAME = ?", name).limit(1))[0];
    } catch (IndexOutOfBoundsException e) {
      return null;
    }
  }
});

代码示例来源:origin: com.atlassian.plugin.automation/automation-module

@Override
public void truncateLog()
{
  // Get date one year ago
  Date oneYearAgo = DateUtils.addYears(new Date(), -1);
  int deletedEntries = 0;
  log.debug("Deleting admin audit log entries older than {}", oneYearAgo);
  AdminAuditMessageEntity[] auditMessageEntities;
  do
  {
    // deleting log entries in chunks prevents possible OOM exception in case the log entries contains a huge amount of data
    // like in https://bitbucket.org/atlassianlabs/automation/issue/23/oom-due-to-verbose-error-logging-to-the
    auditMessageEntities = ao.find(AdminAuditMessageEntity.class, Query.select().where("DATE < ?", oneYearAgo).limit(MAX_RESULTS));
    for (AdminAuditMessageEntity oldEntity : auditMessageEntities)
    {
      ao.delete(oldEntity);
      deletedEntries++;
    }
    log.debug("Deleted {} audit log entries", auditMessageEntities.length);
  } while (auditMessageEntities.length == MAX_RESULTS);
  log.debug("Deleted audit log entries {}", deletedEntries);
}

代码示例来源:origin: com.atlassian.plugin.automation/automation-module

@Override
  public void truncateLog()
  {
    // Get date one week ago
    Date oneWeekAgo = DateUtils.addWeeks(new Date(), -1);
    int deletedEntries = 0;
    log.debug("Deleting audit log entries older than: " + oneWeekAgo);

    AuditMessageEntity[] auditMessageEntities;
    do
    {
      // deleting log entries in chunks prevents possible OOM exception in case the log entries contains a huge amount of data
      // like in https://bitbucket.org/atlassianlabs/automation/issue/23/oom-due-to-verbose-error-logging-to-the
      auditMessageEntities = ao.find(AuditMessageEntity.class, Query.select().where("DATE < ?", oneWeekAgo).limit(MAX_RESULTS));
      for (AuditMessageEntity oldEntity : auditMessageEntities)
      {
        ao.delete(oldEntity.getActionMessages());
        ao.delete(oldEntity);
        deletedEntries++;
      }
      log.debug(String.format("Deleted %d audit log entries", auditMessageEntities.length));
    } while (auditMessageEntities.length == MAX_RESULTS);

    log.debug("Deleted audit log entries: " + deletedEntries);
  }
}

代码示例来源:origin: com.atlassian.webhooks/atlassian-webhooks-plugin

query.limit(search.getLimit());
query.offset(search.getOffset());
query.distinct();

代码示例来源:origin: com.atlassian.plugin.automation/automation-module

ao.stream(AdminAuditMessageEntity.class, Query.select("ID, DATE, ACTOR, RULE_ID, MESSAGE").offset(startAt).limit(resultsLimit).order("DATE DESC"), new EntityStreamCallback<AdminAuditMessageEntity, Integer>()

代码示例来源:origin: com.atlassian.plugin.automation/automation-module

List<AuditMessage> messages = Lists.newArrayList();
for (AuditMessageEntity msgEntity : ao.find(AuditMessageEntity.class, Query.select().offset(startAt).limit(resultsLimit).order("DATE DESC")))

相关文章