syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [1/4] syncope git commit: [SYNCOPE-1282] Fixing size calculation in for PLAIN schemas (excluding conf)
Date Thu, 15 Mar 2018 14:07:08 GMT
Repository: syncope
Updated Branches:
  refs/heads/2_0_X cfd03fc4a -> b67641176
  refs/heads/master 425f9b9ed -> 8032c6e04


[SYNCOPE-1282] Fixing size calculation in for PLAIN schemas (excluding conf)


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/d52636ba
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/d52636ba
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/d52636ba

Branch: refs/heads/master
Commit: d52636ba8e64426a32e23a88d2072c29e4ec1307
Parents: 425f9b9
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Thu Mar 15 15:01:11 2018 +0100
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Thu Mar 15 15:01:11 2018 +0100

----------------------------------------------------------------------
 .../client/console/panels/SchemaTypePanel.java  | 30 +++++++++-----------
 1 file changed, 14 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/d52636ba/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
index 079086d..6e8ec76 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
@@ -251,32 +251,30 @@ public class SchemaTypePanel extends TypesDirectoryPanel<SchemaTO,
SchemaProvide
             comparator = new SortableDataProviderComparator<>(this);
         }
 
-        @Override
-        public Iterator<SchemaTO> iterator(final long first, final long count) {
+        private List<SchemaTO> getSchemas() {
             List<SchemaTO> schemas = restClient.getSchemas(this.schemaType, keyword);
-            Collections.sort(schemas, comparator);
 
             if (SchemaType.PLAIN == this.schemaType) {
-                final List<String> configurations = confRestClient.list().stream().
+                List<String> configurations = confRestClient.list().stream().
                         map(AttrTO::getSchema).collect(Collectors.toList());
 
-                final List<SchemaTO> res = schemas.stream().
-                        filter(item -> !configurations.contains(item.getKey())).
-                        collect(Collectors.toList());
-                return res.subList((int) first, (int) first + (int) count).iterator();
-            } else {
-                return schemas.subList((int) first, (int) first + (int) count).iterator();
+                schemas.removeIf(schema -> configurations.contains(schema.getKey()));
             }
+
+            return schemas;
+        }
+
+        @Override
+        public Iterator<SchemaTO> iterator(final long first, final long count) {
+            List<SchemaTO> schemas = getSchemas();
+            Collections.sort(schemas, comparator);
+
+            return schemas.subList((int) first, (int) first + (int) count).iterator();
         }
 
         @Override
         public long size() {
-            int size = restClient.getSchemas(this.schemaType, keyword).size();
-            return size > confRestClient.list().size()
-                    ? (SchemaType.PLAIN == this.schemaType
-                            ? size - confRestClient.list().size()
-                            : size)
-                    : size;
+            return getSchemas().size();
         }
 
         @Override


Mime
View raw message