syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmarte...@apache.org
Subject syncope git commit: [SYNCOPE-829] provides next button to browse resource connector objects. Furthermore a safety check has been provided into the method to retrieve the list of connector objects: the maximum number of returned items is set to 1k. Before
Date Fri, 10 Jun 2016 14:52:27 GMT
Repository: syncope
Updated Branches:
  refs/heads/master cc33c8dea -> 2ff73daa0


[SYNCOPE-829] provides next button to browse resource connector objects. Furthermore a safety
check has been provided into the method to retrieve the list of connector objects: the maximum
number of returned items is set to 1k. Before to close the related issue I will wait to discuss
this last feature in order to collect feedbacks and evaluate the goodness of this implementation


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

Branch: refs/heads/master
Commit: 2ff73daa024ea1ccaf20c9c6717058d85659c43f
Parents: cc33c8d
Author: fmartelli <fabio.martelli@gmail.com>
Authored: Fri Jun 10 16:52:06 2016 +0200
Committer: fmartelli <fabio.martelli@gmail.com>
Committed: Fri Jun 10 16:52:06 2016 +0200

----------------------------------------------------------------------
 .../panels/ConnObjectDirectoryPanel.java        | 194 -------------------
 .../console/panels/ConnObjectListViewPanel.java | 145 ++++++++++++++
 .../client/console/panels/ConnObjects.java      |  14 +-
 .../client/console/panels/ListViewPanel.java    |  32 ++-
 .../client/console/rest/ResourceRestClient.java |  31 ++-
 .../console/wizards/any/Relationships.java      |   4 +-
 .../resources/ResourceProvisionPanel.java       |   3 +-
 .../console/panels/ConnObjectListViewPanel.html |  26 +++
 .../syncope/core/logic/ResourceLogic.java       |   9 +-
 9 files changed, 235 insertions(+), 223 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/2ff73daa/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectDirectoryPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectDirectoryPanel.java
deleted file mode 100644
index 99dde2e..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectDirectoryPanel.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.console.panels;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import org.apache.syncope.client.console.commons.ConnIdSpecialAttributeName;
-import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.commons.DirectoryDataProvider;
-import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
-import org.apache.syncope.client.console.panels.ConnObjectDirectoryPanel.ConnObjectDataProvider;
-import org.apache.syncope.client.console.rest.ResourceRestClient;
-import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.ActionColumn;
-import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.AttrColumn;
-import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
-import org.apache.syncope.common.lib.to.ConnObjectTO;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.lib.types.StandardEntitlement;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
-import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.ResourceModel;
-
-public abstract class ConnObjectDirectoryPanel
-        extends DirectoryPanel<ConnObjectTO, ConnObjectTO, ConnObjectDataProvider, ResourceRestClient>
-        implements ModalPanel {
-
-    private static final long serialVersionUID = 4986172040062752781L;
-
-    private final String resource;
-
-    private final String anyType;
-
-    protected final BaseModal<?> baseModal;
-
-    private final MultilevelPanel multiLevelPanelRef;
-
-    protected ConnObjectDirectoryPanel(
-            final BaseModal<?> baseModal,
-            final MultilevelPanel multiLevelPanelRef,
-            final String resource,
-            final String anyType,
-            final PageReference pageRef) {
-
-        super(MultilevelPanel.FIRST_LEVEL_ID, pageRef, false);
-        this.resource = resource;
-        this.anyType = anyType;
-        this.baseModal = baseModal;
-        this.multiLevelPanelRef = multiLevelPanelRef;
-        restClient = new ResourceRestClient();
-        setShowResultPage(false);
-        disableCheckBoxes();
-        initResultTable();
-    }
-
-    @Override
-    protected void resultTableCustomChanges(final AjaxDataTablePanel.Builder<ConnObjectTO,
String> resultTableBuilder) {
-        resultTableBuilder.setMultiLevelPanel(baseModal, multiLevelPanelRef);
-    }
-
-    @Override
-    protected ConnObjectDataProvider dataProvider() {
-        return new ConnObjectDataProvider(rows);
-    }
-
-    @Override
-    protected String paginatorRowsKey() {
-        return Constants.PREF_CONNOBJECTS_PAGINATOR_ROWS;
-    }
-
-    @Override
-    protected Collection<ActionLink.ActionType> getBulkActions() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    protected List<IColumn<ConnObjectTO, String>> getColumns() {
-        final List<IColumn<ConnObjectTO, String>> columns = new ArrayList<>();
-
-        columns.add(new AttrColumn<>(ConnIdSpecialAttributeName.UID, SchemaType.PLAIN));
-        columns.add(new AttrColumn<>(ConnIdSpecialAttributeName.NAME, SchemaType.PLAIN));
-        columns.add(new AttrColumn<>(ConnIdSpecialAttributeName.ENABLE, SchemaType.PLAIN));
-
-        columns.add(new ActionColumn<ConnObjectTO, String>(new ResourceModel("actions"))
{
-
-            private static final long serialVersionUID = 906457126287899096L;
-
-            @Override
-            public ActionLinksPanel<ConnObjectTO> getActions(
-                    final String componentId, final IModel<ConnObjectTO> model) {
-
-                final ConnObjectTO connObjectTO = model.getObject();
-
-                final ActionLinksPanel<ConnObjectTO> panel = ActionLinksPanel.<ConnObjectTO>builder().
-                        add(new ActionLink<ConnObjectTO>() {
-
-                            private static final long serialVersionUID = -3722207913631435501L;
-
-                            @Override
-                            public void onClick(final AjaxRequestTarget target, final ConnObjectTO
ignore) {
-                                viewConnObject(connObjectTO, target);
-                            }
-                        }, ActionLink.ActionType.VIEW, StandardEntitlement.RESOURCE_GET_CONNOBJECT).
-                        build(componentId);
-
-                return panel;
-            }
-
-            @Override
-            public ActionLinksPanel<ConnObjectTO> getHeader(final String componentId)
{
-                final ActionLinksPanel.Builder<ConnObjectTO> panel = ActionLinksPanel.builder();
-
-                return panel.add(new ActionLink<ConnObjectTO>() {
-
-                    private static final long serialVersionUID = 7511002881490248598L;
-
-                    @Override
-                    public void onClick(final AjaxRequestTarget target, final ConnObjectTO
ignore) {
-                        if (target != null) {
-                            target.add(container);
-                        }
-                    }
-                }, ActionLink.ActionType.RELOAD, StandardEntitlement.RESOURCE_LIST_CONNOBJECT).build(componentId);
-            }
-        });
-
-        return columns;
-    }
-
-    protected abstract void viewConnObject(ConnObjectTO connObjectTO, AjaxRequestTarget target);
-
-    protected class ConnObjectDataProvider extends DirectoryDataProvider<ConnObjectTO>
{
-
-        private static final long serialVersionUID = -20112718133295756L;
-
-        private final SortableDataProviderComparator<ConnObjectTO> comparator;
-
-        private final List<ConnObjectTO> connObjectTOs;
-
-        public ConnObjectDataProvider(final int paginatorRows) {
-            super(paginatorRows);
-
-            setSort("lastChangeDate", SortOrder.DESCENDING);
-            comparator = new SortableDataProviderComparator<>(this);
-            connObjectTOs = restClient.listConnObjects(resource, anyType, getSort());
-        }
-
-        public SortableDataProviderComparator<ConnObjectTO> getComparator() {
-            return comparator;
-        }
-
-        @Override
-        public IModel<ConnObjectTO> model(final ConnObjectTO object) {
-            return new CompoundPropertyModel<>(object);
-        }
-
-        @Override
-        public long size() {
-            return connObjectTOs.size();
-        }
-
-        @Override
-        public Iterator<? extends ConnObjectTO> iterator(final long first, final long
count) {
-            List<ConnObjectTO> sublist = connObjectTOs.subList((int) first, (int) (first
+ count));
-
-            Collections.sort(sublist, getComparator());
-            return sublist.iterator();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2ff73daa/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.java
new file mode 100644
index 0000000..53e2c69
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.panels;
+
+import java.io.Serializable;
+import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.IterableUtils;
+import org.apache.commons.collections4.Predicate;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.syncope.client.console.commons.ConnIdSpecialAttributeName;
+import org.apache.syncope.client.console.panels.ListViewPanel.ListViewReload;
+import org.apache.syncope.client.console.rest.ResourceRestClient;
+import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.CollectionPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.ConnObjectTO;
+import org.apache.syncope.common.lib.types.StandardEntitlement;
+import org.apache.wicket.Component;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.panel.Panel;
+
+public abstract class ConnObjectListViewPanel extends Panel {
+
+    private static final long serialVersionUID = 4986172040062752781L;
+
+    private static final int SIZE = 10;
+
+    private String nextPageCookie = null;
+
+    protected ConnObjectListViewPanel(
+            final String id,
+            final String resource,
+            final String anyType,
+            final PageReference pageRef) {
+
+        super(id);
+
+        final List<ConnObjectTO> listOfItems = reloadItems(resource, anyType, null);
+
+        final ListViewPanel.Builder<ConnObjectTO> builder = new ListViewPanel.Builder<ConnObjectTO>(
+                ConnObjectTO.class, pageRef) {
+
+            private static final long serialVersionUID = -8251750413385566738L;
+
+            @Override
+            protected Component getValueComponent(final String key, final ConnObjectTO bean)
{
+                final AttrTO attrTO = IterableUtils.find(bean.getPlainAttrs(), new Predicate<AttrTO>()
{
+
+                    @Override
+                    public boolean evaluate(final AttrTO object) {
+                        return object.getSchema().equals(key);
+                    }
+                });
+
+                return attrTO == null || CollectionUtils.isEmpty(attrTO.getValues())
+                        ? new Label("field", StringUtils.EMPTY)
+                        : new CollectionPanel("field", attrTO.getValues());
+            }
+
+        };
+
+        builder.setReuseItem(false);
+        builder.addAction(new ActionLink<ConnObjectTO>() {
+
+            private static final long serialVersionUID = 7511002881490248598L;
+
+            @Override
+            public void onClick(final AjaxRequestTarget target, final ConnObjectTO modelObject)
{
+                viewConnObject(modelObject, target);
+            }
+        }, ActionLink.ActionType.VIEW, StandardEntitlement.RESOURCE_GET_CONNOBJECT).
+                setItems(listOfItems).
+                includes(
+                        ConnIdSpecialAttributeName.UID,
+                        ConnIdSpecialAttributeName.NAME,
+                        ConnIdSpecialAttributeName.ENABLE).
+                withChecks(ListViewPanel.CheckAvailability.NONE).
+                setReuseItem(false);
+
+        add(builder.build("objs"));
+
+        final WebMarkupContainer arrows = new WebMarkupContainer("arrows");
+        add(arrows.setOutputMarkupId(true));
+
+        arrows.add(new AjaxLink<Serializable>("next") {
+
+            private static final long serialVersionUID = -7978723352517770644L;
+
+            @Override
+            public void onClick(final AjaxRequestTarget target) {
+                final List<ConnObjectTO> listOfItems = reloadItems(resource, anyType,
nextPageCookie);
+                target.add(arrows);
+                send(ConnObjectListViewPanel.this, Broadcast.DEPTH,
+                        new ListViewReload<ConnObjectTO>(listOfItems, target));
+            }
+
+            @Override
+            public boolean isVisible() {
+                return nextPageCookie != null;
+            }
+        });
+    }
+
+    protected abstract void viewConnObject(ConnObjectTO connObjectTO, AjaxRequestTarget target);
+
+    private List<ConnObjectTO> reloadItems(
+            final String resource,
+            final String anyType,
+            final String cookie) {
+
+        final Pair<String, List<ConnObjectTO>> items = new ResourceRestClient().listConnObjects(
+                resource,
+                anyType,
+                SIZE,
+                cookie,
+                new SortParam<String>(ConnIdSpecialAttributeName.UID, true));
+
+        nextPageCookie = items.getLeft();
+        return items.getRight();
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2ff73daa/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
index 5d08ebe..cd29d21 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
@@ -50,8 +50,8 @@ public class ConnObjects extends Panel implements ModalPanel {
 
         super(BaseModal.CONTENT_ID);
 
-        List<String> availableAnyTypes =
-                CollectionUtils.collect(new ResourceRestClient().read(resource).getProvisions(),
+        List<String> availableAnyTypes = CollectionUtils.
+                collect(new ResourceRestClient().read(resource).getProvisions(),
                         new Transformer<ProvisionTO, String>() {
 
                     @Override
@@ -104,10 +104,14 @@ public class ConnObjects extends Panel implements ModalPanel {
         });
     }
 
-    private class NextableConnObjectDirectoryPanel extends ConnObjectDirectoryPanel {
+    private class NextableConnObjectDirectoryPanel extends ConnObjectListViewPanel {
 
         private static final long serialVersionUID = 956427874406567048L;
 
+        private final BaseModal<?> baseModal;
+
+        private final PageReference pageRef;
+
         NextableConnObjectDirectoryPanel(
                 final BaseModal<?> baseModal,
                 final MultilevelPanel multiLevelPanelRef,
@@ -115,7 +119,9 @@ public class ConnObjects extends Panel implements ModalPanel {
                 final String anyType,
                 final PageReference pageRef) {
 
-            super(baseModal, multiLevelPanelRef, resource, anyType, pageRef);
+            super(MultilevelPanel.FIRST_LEVEL_ID, resource, anyType, pageRef);
+            this.baseModal = baseModal;
+            this.pageRef = pageRef;
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/2ff73daa/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java
index e5fa626..ca63496 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java
@@ -29,6 +29,7 @@ import java.util.List;
 import org.apache.commons.collections4.IteratorUtils;
 import org.apache.commons.collections4.Predicate;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormChoiceComponentUpdatingBehavior;
 import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
 import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
 import org.apache.syncope.client.console.wizards.AjaxWizard;
@@ -36,7 +37,6 @@ import org.apache.syncope.client.console.wizards.WizardMgtPanel;
 import org.apache.wicket.Component;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior;
 import org.apache.wicket.core.util.lang.PropertyResolver;
 import org.apache.wicket.event.IEvent;
 import org.apache.wicket.markup.html.basic.Label;
@@ -110,7 +110,7 @@ public abstract class ListViewPanel<T extends Serializable> extends
WizardMgtPan
 
         final CheckGroup<T> checkGroup = new CheckGroup<>("group", model);
         checkGroup.setOutputMarkupId(true);
-        checkGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
+        checkGroup.add(new IndicatorAjaxFormChoiceComponentUpdatingBehavior() {
 
             private static final long serialVersionUID = -151291731388673682L;
 
@@ -391,8 +391,17 @@ public abstract class ListViewPanel<T extends Serializable> extends
WizardMgtPan
 
             target.add(ListViewPanel.this);
             super.onEvent(event);
-        } else if (event.getPayload() instanceof ListViewReload) {
-            ((ListViewReload) event.getPayload()).getTarget().add(ListViewPanel.this);
+        } else if (event.getPayload() instanceof ListViewPanel.ListViewReload) {
+            final ListViewPanel.ListViewReload<?> payload = (ListViewPanel.ListViewReload<?>)
event.getPayload();
+            if (payload.getItems() != null) {
+                ListViewPanel.this.listOfItems.clear();
+                try {
+                    ListViewPanel.this.listOfItems.addAll((List<T>) payload.getItems());
+                } catch (RuntimeException re) {
+                    LOG.warn("Error reloading items", re);
+                }
+            }
+            payload.getTarget().add(ListViewPanel.this);
         } else {
             super.onEvent(event);
         }
@@ -400,17 +409,30 @@ public abstract class ListViewPanel<T extends Serializable> extends
WizardMgtPan
 
     protected abstract T getActualItem(final T item, final List<T> list);
 
-    public static class ListViewReload {
+    public static class ListViewReload<T extends Serializable> implements Serializable
{
+
+        private static final long serialVersionUID = 1509151005816590312L;
 
         private final AjaxRequestTarget target;
 
+        private final List<T> items;
+
         public ListViewReload(final AjaxRequestTarget target) {
             this.target = target;
+            this.items = null;
+        }
+
+        public ListViewReload(final List<T> items, final AjaxRequestTarget target)
{
+            this.target = target;
+            this.items = items;
         }
 
         public AjaxRequestTarget getTarget() {
             return target;
         }
 
+        public List<T> getItems() {
+            return items;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/2ff73daa/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
index f8ed1b3..b6b8db2 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
@@ -61,34 +61,31 @@ public class ResourceRestClient extends BaseRestClient {
         return getService(ResourceService.class).readConnObject(resource, anyTypeKey, anyKey);
     }
 
-    public List<ConnObjectTO> listConnObjects(
+    public Pair<String, List<ConnObjectTO>> listConnObjects(
             final String resource,
             final String anyTypeKey,
+            final int size,
+            final String pagedResultCookie,
             final SortParam<String> sort) {
 
-        ConnObjectTOListQuery.Builder builder = new ConnObjectTOListQuery.Builder().size(100).orderBy(toOrderBy(sort));
+        ConnObjectTOListQuery.Builder builder = new ConnObjectTOListQuery.Builder().
+                pagedResultsCookie(pagedResultCookie).
+                size(size).
+                orderBy(toOrderBy(sort));
+
+        final List<ConnObjectTO> result = new ArrayList<>();
+        String nextPageResultCookie = null;
 
-        List<ConnObjectTO> result = new ArrayList<>();
         PagedConnObjectTOResult list;
         try {
-            do {
-                list = getService(ResourceService.class).listConnObjects(resource, anyTypeKey,
builder.build());
-                result.addAll(list.getResult());
-
-                // TMP - see SYNCOPE-829
-                if (result.size() >= 100) {
-                    break;
-                }
-
-                if (list.getPagedResultsCookie() != null) {
-                    builder.pagedResultsCookie(list.getPagedResultsCookie());
-                }
-            } while (list.getPagedResultsCookie() != null);
+            list = getService(ResourceService.class).listConnObjects(resource, anyTypeKey,
builder.build());
+            result.addAll(list.getResult());
+            nextPageResultCookie = list.getPagedResultsCookie();
         } catch (Exception e) {
             LOG.error("While listing objects on {} for any type {}", resource, anyTypeKey,
e);
         }
 
-        return result;
+        return Pair.of(nextPageResultCookie, result);
     }
 
     public ResourceTO read(final String name) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/2ff73daa/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Relationships.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Relationships.java
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Relationships.java
index d3699f3..c57557b 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Relationships.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Relationships.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.client.console.wizards.any;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -134,7 +135,8 @@ public class Relationships extends WizardStep {
                                             public void onClick(
                                                     final AjaxRequestTarget target, final
RelationshipTO modelObject) {
                                                 removeRelationships(relationships, modelObject);
-                                                send(Relationships.this, Broadcast.DEPTH,
new ListViewReload(target));
+                                                send(Relationships.this, Broadcast.DEPTH,

+                                                        new ListViewReload<Serializable>(target));
                                             }
                                         }, ActionType.DELETE, AnyEntitlement.UPDATE.getFor(anyTO.getType())).
                                         build(panelId);

http://git-wip-us.apache.org/repos/asf/syncope/blob/2ff73daa/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
index 4ad8fb8..22e5e58 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
@@ -31,6 +31,7 @@ import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.panels.AbstractModalPanel;
 import org.apache.syncope.client.console.panels.ListViewPanel;
+import org.apache.syncope.client.console.panels.ListViewPanel.ListViewReload;
 import org.apache.syncope.client.console.rest.ResourceRestClient;
 import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
 import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
@@ -167,7 +168,7 @@ public class ResourceProvisionPanel extends AbstractModalPanel<Serializable>
{
                     @Override
                     public void onClick(final AjaxRequestTarget target, final ProvisionTO
provisionTO) {
                         resourceTO.getProvisions().remove(provisionTO);
-                        send(ResourceProvisionPanel.this, Broadcast.DEPTH, new ListViewPanel.ListViewReload(target));
+                        send(ResourceProvisionPanel.this, Broadcast.DEPTH, new ListViewReload<Serializable>(target));
                     }
                 }, ActionLink.ActionType.DELETE, StandardEntitlement.RESOURCE_DELETE);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/2ff73daa/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.html
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.html
new file mode 100644
index 0000000..d700143
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.html
@@ -0,0 +1,26 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+  <wicket:panel>
+    <span wicket:id="objs"/>
+    <div wicket:id="arrows">
+      <a haref="#" class="btn btn-primary btn-circle btn-lg pull-right" wicket:id="next"><i
class="fa fa-chevron-right"></i></a>
+    </div>
+  </wicket:panel>
+</html>

http://git-wip-us.apache.org/repos/asf/syncope/blob/2ff73daa/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
index e95e0b9..34d9544 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java
@@ -77,6 +77,8 @@ import org.springframework.transaction.annotation.Transactional;
 @Component
 public class ResourceLogic extends AbstractTransactionalLogic<ResourceTO> {
 
+    private static final transient int MAX_CONNOBJ_SEARCH_SIZE = 1000;
+
     @Autowired
     private ExternalResourceDAO resourceDAO;
 
@@ -334,8 +336,11 @@ public class ResourceLogic extends AbstractTransactionalLogic<ResourceTO>
{
 
         final SearchResult[] searchResult = new SearchResult[1];
         final List<ConnObjectTO> connObjects = new ArrayList<>();
+
         connector.search(init.getRight().getObjectClass(), null, new SearchResultsHandler()
{
 
+            private int count = 0;
+
             @Override
             public void handleResult(final SearchResult result) {
                 searchResult[0] = result;
@@ -344,7 +349,9 @@ public class ResourceLogic extends AbstractTransactionalLogic<ResourceTO>
{
             @Override
             public boolean handle(final ConnectorObject connectorObject) {
                 connObjects.add(connObjectUtils.getConnObjectTO(connectorObject));
-                return true;
+                // provide safety approach in case of pagination not supported or not required
(SYNCOPE-829 reworking)
+                count++;
+                return count < MAX_CONNOBJ_SEARCH_SIZE;
             }
         }, size, pagedResultsCookie, orderBy, mapItems);
 


Mime
View raw message