From 52e7257a41ef79f84691a7b7d8461d7ed83d84a6 Mon Sep 17 00:00:00 2001
From: pkupczyk <pkupczyk>
Date: Mon, 24 Aug 2015 14:50:36 +0000
Subject: [PATCH] SSDM-2294 : V3 AS API - paging and sorting of search results
 - fix a bug in paging when it invoked for a Collection that wasn't a List or
 Set

SVN: 34513
---
 .../shared/api/v3/dto/fetchoptions/sort/SortAndPage.java      | 4 ++--
 .../shared/api/v3/dto/fetchoptions/sort/view/ListView.java    | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPage.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPage.java
index 87801758c9a..7c7003b2588 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPage.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPage.java
@@ -109,13 +109,13 @@ public class SortAndPage
 
             if (objects instanceof List)
             {
-                paged = new ListView((List) objects, fo.getFrom(), fo.getCount());
+                paged = new ListView(objects, fo.getFrom(), fo.getCount());
             } else if (objects instanceof Set)
             {
                 paged = new SetView(objects, fo.getFrom(), fo.getCount());
             } else if (objects instanceof Collection)
             {
-                paged = new ListView((List) objects, fo.getFrom(), fo.getCount());
+                paged = new ListView(objects, fo.getFrom(), fo.getCount());
             } else
             {
                 throw new IllegalArgumentException("Unsupported collection: " + objects.getClass());
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/view/ListView.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/view/ListView.java
index be5aa5ed33d..cd0cd9ce8b6 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/view/ListView.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/view/ListView.java
@@ -30,10 +30,9 @@ public class ListView<T> extends AbstractCollectionView<T> implements List<T>
 
     private static final long serialVersionUID = 1L;
 
-    public ListView(List<T> originalList, Integer from, Integer count)
+    public ListView(Collection<T> originalList, Integer from, Integer count)
     {
         super(originalList, from, count);
-
     }
 
     @Override
-- 
GitLab