Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Bug 1240854 - Group inventory pages (compatible, mixed, all) fail to …
Browse files Browse the repository at this point in the history
…display

PageList which contains in memory joined results *must* contain paging info
taken from one of original pagelists
  • Loading branch information
Libor Zoubek committed Jul 31, 2015
1 parent f372714 commit abfcbdb
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -1639,7 +1639,8 @@ public PageList<ResourceGroupComposite> findResourceGroupCompositesByCriteria(Su
permissionResults = queryRunner.execute();
}
// now "join" results together
PageList<ResourceGroupComposite> results = new PageList<ResourceGroupComposite>();
PageList<ResourceGroupComposite> results = new PageList<ResourceGroupComposite>(explicitResults.getTotalSize(),
explicitResults.getPageControl());
if (explicitResults.size() == implicitResults.size()
&& (permissionResults == null || permissionResults.size() == implicitResults.size())) {
// in case we selected same groups sets using all 2 (or 3) queries (99% of cases) just "join" them by index
Expand All @@ -1654,6 +1655,8 @@ public PageList<ResourceGroupComposite> findResourceGroupCompositesByCriteria(Su
// we did not get same results, this means some groups are being added/removed in the meantime
// we must join it using resourceGroup ID (this is a bit more expensive approach)
// map ResourceGroupID and [implicitComposite, explicitComposite, permComposite]

results.setTotalSize(Math.min(explicitResults.getTotalSize(), implicitResults.getTotalSize()));
Map<Integer,List<ResourceGroupComposite>> joinMap = new HashMap<Integer, List<ResourceGroupComposite>>();
for (ResourceGroupComposite c : implicitResults) {
if (!joinMap.containsKey(c.getResourceGroup().getId())) {
Expand Down

0 comments on commit abfcbdb

Please sign in to comment.