}
@VisibleForTesting
- Collection<IssueDto> selectByIds(Collection<Long> ids) {
+ List<IssueDto> selectByIds(Collection<Long> ids) {
SqlSession session = mybatis.openSession();
try {
return selectByIds(ids, session);
}
}
- public Collection<IssueDto> selectByIds(Collection<Long> ids, SqlSession session) {
+ public List<IssueDto> selectByIds(Collection<Long> ids, SqlSession session) {
if (ids.isEmpty()) {
return Collections.emptyList();
}
<include refid="selectQueryConditions"/>
</select>
- <select id="selectIssueAndProjectIds" parameterType="map" resultType="Issue">
+ <select id="selectIssueAndProjectIds" parameterType="map" resultType="Issue" fetchSize="500">
select i.id, i.project_id as projectId
<include refid="sortColumn"/>
<include refid="selectQueryConditions"/>
public static final int DEFAULT_PAGE_INDEX = 1;
public static final int DEFAULT_PAGE_SIZE = 100;
- public static final int MAX_RESULTS = 5000;
+ public static final int MAX_RESULTS = 10000;
public static final int MAX_PAGE_SIZE = 500;
public static final int MAX_ISSUE_KEYS = 500;
List<IssueDto> authorizedIssues = issueDao.selectIssueAndProjectIds(query, rootProjectIds, sqlSession);
// 3. Sort all authorized issues
- Collection<IssueDto> authorizedSortedIssues = new IssuesFinderSort(authorizedIssues, query).sort();
+ List<IssueDto> authorizedSortedIssues = sort(authorizedIssues, query, authorizedIssues.size());
// 4. Apply pagination
Paging paging = Paging.create(query.pageSize(), query.pageIndex(), authorizedSortedIssues.size());
Set<Long> pagedIssueIds = pagedIssueIds(authorizedSortedIssues, paging);
// 5. Load issues and their related data (rules, components, projects, comments, action plans, ...) and sort then again
- Collection<IssueDto> pagedIssues = issueDao.selectByIds(pagedIssueIds, sqlSession);
- Collection<IssueDto> pagedSortedIssues = new IssuesFinderSort(pagedIssues, query).sort();
+ List<IssueDto> pagedIssues = issueDao.selectByIds(pagedIssueIds, sqlSession);
+ List<IssueDto> pagedSortedIssues = sort(pagedIssues, query, authorizedIssues.size());
Map<String, DefaultIssue> issuesByKey = newHashMap();
List<Issue> issues = newArrayList();
}
}
+ private List<IssueDto> sort(List<IssueDto> issues, IssueQuery query, int allIssuesSize){
+ if (allIssuesSize < query.maxResults()) {
+ return new IssuesFinderSort(issues, query).sort();
+ }
+ return issues;
+ }
+
private Set<Long> pagedIssueIds(Collection<IssueDto> issues, Paging paging) {
Set<Long> issueIds = Sets.newLinkedHashSet();
int index = 0;
class IssuesFinderSort {
- private Collection<IssueDto> issues;
+ private List<IssueDto> issues;
private IssueQuery query;
- public IssuesFinderSort(Collection<IssueDto> issues, IssueQuery query) {
+ public IssuesFinderSort(List<IssueDto> issues, IssueQuery query) {
this.issues = issues;
this.query = query;
}
- public Collection<IssueDto> sort() {
+ public List<IssueDto> sort() {
if (query.sort() != null) {
IssueProcessor issueProcessor;
switch (query.sort()) {
def column_html(filter, column_label, column_tooltip, sort)
filter_sort = filter.criteria[:sort]
filter_asc = filter.criteria[:asc] == 'true' ? true : false
- if !filter.issues_result.maxResultsReached()
+ html = h(column_label)
+ unless filter.issues_result.maxResultsReached()
html = link_to_function(h(column_label), "refreshList('#{escape_javascript sort}',#{!filter_asc}, #{filter.criteria[:page]||1})", :title => h(column_tooltip))
if sort == filter_sort
html << (filter_asc ? image_tag("asc12.png") : image_tag("desc12.png"))
end
- else
- html = h(column_label)
end
html
end