This is an automated email from the ASF dual-hosted git repository.

skylark17 pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/2_1_X by this push:
     new c2c7852  [SYNCOPE-957] Added missing sections for reconciliation 
process
c2c7852 is described below

commit c2c7852edc2427e6e3b25c72ac94dc050fe0700b
Author: skylark17 <matteo.alessandr...@tirasa.net>
AuthorDate: Tue Dec 10 14:58:32 2019 +0100

    [SYNCOPE-957] Added missing sections for reconciliation process
---
 .../console/panels/LinkedAccountModalPanel.java    | 179 +++++++++++++++------
 .../panels/LinkedAccountsStatusModalPanel.java     |  40 +++++
 .../client/console/panels/UserDirectoryPanel.java  |  21 ++-
 .../console/status/AnyStatusDirectoryPanel.java    |  29 ++++
 .../client/console/status/ReconTaskPanel.java      |   4 +-
 .../wizards/any/LinkedAccountDetailsPanel.java     |  27 ++--
 .../wizards/any/LinkedAccountWizardBuilder.java    |  19 +--
 .../console/panels/LinkedAccountModalPanel.html    |   4 +-
 ...el.html => LinkedAccountsStatusModalPanel.html} |   5 +-
 .../syncope/core/logic/ReconciliationLogic.java    |   2 +-
 10 files changed, 242 insertions(+), 88 deletions(-)

diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/panels/LinkedAccountModalPanel.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/panels/LinkedAccountModalPanel.java
index be0a70c..da7569d 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/panels/LinkedAccountModalPanel.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/panels/LinkedAccountModalPanel.java
@@ -20,7 +20,6 @@ package org.apache.syncope.client.console.panels;
 
 import static org.apache.syncope.client.console.panels.AbstractModalPanel.LOG;
 
-import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -30,6 +29,8 @@ import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.pages.BasePage;
 import org.apache.syncope.client.console.rest.AnyTypeRestClient;
 import org.apache.syncope.client.console.rest.UserRestClient;
+import org.apache.syncope.client.console.status.ReconStatusPanel;
+import org.apache.syncope.client.console.status.ReconTaskPanel;
 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.ActionLinksTogglePanel;
@@ -40,6 +41,8 @@ import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.patch.LinkedAccountPatch;
 import org.apache.syncope.common.lib.patch.UserPatch;
 import org.apache.syncope.common.lib.to.LinkedAccountTO;
+import org.apache.syncope.common.lib.to.PullTaskTO;
+import org.apache.syncope.common.lib.to.PushTaskTO;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.PatchOperation;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
@@ -47,10 +50,12 @@ 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.markup.html.panel.Panel;
+import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.Model;
 import org.apache.wicket.model.StringResourceModel;
 
-public class LinkedAccountModalPanel extends AbstractModalPanel<Serializable> {
+public class LinkedAccountModalPanel extends Panel implements ModalPanel {
 
     private static final long serialVersionUID = -4603032036433309900L;
 
@@ -60,27 +65,29 @@ public class LinkedAccountModalPanel extends 
AbstractModalPanel<Serializable> {
 
     private final AjaxLink<LinkedAccountTO> addAjaxLink;
 
-    protected ActionLinksTogglePanel<LinkedAccountTO> actionTogglePanel;
+    private ActionLinksTogglePanel<LinkedAccountTO> actionTogglePanel;
 
     private UserRestClient userRestClient = new UserRestClient();
 
     private final List<LinkedAccountTO> linkedAccountTOs;
 
     public LinkedAccountModalPanel(
-            final BaseModal<Serializable> modal,
-            final UserTO userTO,
-            final PageReference pageRef) {
+            final BaseModal<?> baseModal,
+            final IModel<UserTO> model,
+            final PageReference pageRef,
+            final boolean recounciliationOnly) {
 
-        super(modal, pageRef);
+        super(BaseModal.getContentId(), model);
 
-        UserTO readUserTO = userRestClient.read(userTO.getKey());
+        final MultilevelPanel mlp = new MultilevelPanel("mlpContainer");
+        mlp.setOutputMarkupId(true);
 
         setOutputMarkupId(true);
 
         actionTogglePanel = new ActionLinksTogglePanel<>("toggle", pageRef);
         add(actionTogglePanel);
 
-        wizard = new LinkedAccountWizardBuilder(readUserTO.getKey(), pageRef);
+        wizard = new LinkedAccountWizardBuilder(model, pageRef);
 
         final ListViewPanel.Builder<LinkedAccountTO> builder = new 
ListViewPanel.Builder<LinkedAccountTO>(
                 LinkedAccountTO.class, pageRef) {
@@ -117,9 +124,8 @@ public class LinkedAccountModalPanel extends 
AbstractModalPanel<Serializable> {
                 checkAddButton();
 
                 linkedAccountTOs.clear();
-                
linkedAccountTOs.addAll(userRestClient.read(userTO.getKey()).getLinkedAccounts());
+                linkedAccountTOs.addAll(model.getObject().getLinkedAccounts());
                 sortLinkedAccounts();
-
                 ListViewPanel.class.cast(list).refreshList(linkedAccountTOs);
 
                 // change modal footer visibility
@@ -132,7 +138,7 @@ public class LinkedAccountModalPanel extends 
AbstractModalPanel<Serializable> {
             }
         };
 
-        linkedAccountTOs = new ArrayList<>(readUserTO.getLinkedAccounts());
+        linkedAccountTOs = new 
ArrayList<>(model.getObject().getLinkedAccounts());
         sortLinkedAccounts();
 
         builder.setItems(linkedAccountTOs);
@@ -146,57 +152,131 @@ public class LinkedAccountModalPanel extends 
AbstractModalPanel<Serializable> {
 
             @Override
             public void onClick(final AjaxRequestTarget target, final 
LinkedAccountTO linkedAccountTO) {
-                try {
-                    send(LinkedAccountModalPanel.this, Broadcast.DEPTH,
-                            new 
AjaxWizard.NewItemActionEvent<>(linkedAccountTO, 1, target).setResourceModel(
-                                    new 
StringResourceModel("inner.edit.linkedAccount",
-                                            LinkedAccountModalPanel.this,
-                                            Model.of(linkedAccountTO))));
-                } catch (SyncopeClientException e) {
-                    LOG.error("While contacting linked account", e);
-                    SyncopeConsoleSession.get().error(
-                            StringUtils.isBlank(e.getMessage()) ? 
e.getClass().getName() : e.getMessage());
-                    ((BasePage) 
pageRef.getPage()).getNotificationPanel().refresh(target);
+                mlp.next(linkedAccountTO.getResource(),
+                        new ReconStatusPanel(
+                                linkedAccountTO.getResource(),
+                                model.getObject().getType(),
+                                model.getObject().getKey()),
+                        target);
+                target.add(mlp);
+
+                ((BasePage) 
pageRef.getPage()).getNotificationPanel().refresh(target);
+                send(LinkedAccountModalPanel.this, Broadcast.BREADTH,
+                        new 
ActionLinksTogglePanel.ActionLinkToggleCloseEventPayload(target));
+            }
+        }, ActionLink.ActionType.VIEW, StandardEntitlement.USER_READ);
+
+        if (!recounciliationOnly) {
+            builder.addAction(new ActionLink<LinkedAccountTO>() {
+
+                private static final long serialVersionUID = 
2555747430358755813L;
+
+                @Override
+                public void onClick(final AjaxRequestTarget target, final 
LinkedAccountTO linkedAccountTO) {
+                    try {
+                        send(LinkedAccountModalPanel.this, Broadcast.DEPTH,
+                                new 
AjaxWizard.NewItemActionEvent<>(linkedAccountTO, 1, target).
+                                        setResourceModel(new 
StringResourceModel("inner.edit.linkedAccount",
+                                                LinkedAccountModalPanel.this,
+                                                Model.of(linkedAccountTO))));
+
+                    } catch (SyncopeClientException e) {
+                        LOG.error("While contacting linked account", e);
+                        SyncopeConsoleSession.get().error(
+                                StringUtils.isBlank(e.getMessage()) ? 
e.getClass().getName() : e.getMessage());
+                        ((BasePage) 
pageRef.getPage()).getNotificationPanel().refresh(target);
+                    }
+
+                    send(LinkedAccountModalPanel.this, Broadcast.BREADTH,
+                            new 
ActionLinksTogglePanel.ActionLinkToggleCloseEventPayload(target));
                 }
+            }, ActionLink.ActionType.EDIT, StandardEntitlement.USER_READ);
+        }
+
+        builder.addAction(new ActionLink<LinkedAccountTO>() {
 
+            private static final long serialVersionUID = 2555747430358755813L;
+
+            @Override
+            public void onClick(final AjaxRequestTarget target, final 
LinkedAccountTO linkedAccountTO) {
+                mlp.next("PUSH " + linkedAccountTO.getResource(),
+                        new ReconTaskPanel(
+                                linkedAccountTO.getResource(),
+                                new PushTaskTO(),
+                                model.getObject().getType(),
+                                null,
+                                linkedAccountTO.getConnObjectKeyValue(),
+                                true,
+                                mlp,
+                                pageRef),
+                        target);
+                target.add(mlp);
+
+                ((BasePage) 
pageRef.getPage()).getNotificationPanel().refresh(target);
                 send(LinkedAccountModalPanel.this, Broadcast.BREADTH,
                         new 
ActionLinksTogglePanel.ActionLinkToggleCloseEventPayload(target));
             }
-        }, ActionLink.ActionType.EDIT, StandardEntitlement.USER_READ).
+        }, ActionLink.ActionType.RECONCILIATION_PUSH, 
StandardEntitlement.USER_READ).
                 addAction(new ActionLink<LinkedAccountTO>() {
 
                     private static final long serialVersionUID = 
2555747430358755813L;
 
                     @Override
                     public void onClick(final AjaxRequestTarget target, final 
LinkedAccountTO linkedAccountTO) {
-                        try {
-                            LinkedAccountPatch linkedAccountPatch =
-                                    new LinkedAccountPatch.Builder().
-                                            operation(PatchOperation.DELETE).
-                                            
linkedAccountTO(linkedAccountTO).build();
-                            
linkedAccountPatch.setLinkedAccountTO(linkedAccountTO);
-                            UserPatch patch = new UserPatch();
-                            patch.setKey(readUserTO.getKey());
-                            patch.getLinkedAccounts().add(linkedAccountPatch);
-                            
userRestClient.update(userRestClient.read(userTO.getKey()).getETagValue(), 
patch);
-                            linkedAccountTOs.remove(linkedAccountTO);
-
-                            
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
-                        } catch (Exception e) {
-                            LOG.error("While removing linked account {}", 
linkedAccountTO.getKey(), e);
-                            
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
-                                    ? e.getClass().getName() : e.getMessage());
-                        }
-
-                        checkAddButton();
+                        mlp.next("PULL " + linkedAccountTO.getResource(),
+                                new ReconTaskPanel(
+                                        linkedAccountTO.getResource(),
+                                        new PullTaskTO(),
+                                        model.getObject().getType(),
+                                        null,
+                                        
linkedAccountTO.getConnObjectKeyValue(),
+                                        true,
+                                        mlp,
+                                        pageRef),
+                                target);
+                        target.add(mlp);
+
                         ((BasePage) 
pageRef.getPage()).getNotificationPanel().refresh(target);
-                        send(LinkedAccountModalPanel.this, Broadcast.DEPTH, 
new ListViewPanel.ListViewReload<>(target));
+                        send(LinkedAccountModalPanel.this, Broadcast.BREADTH,
+                                new 
ActionLinksTogglePanel.ActionLinkToggleCloseEventPayload(target));
+                    }
+                }, ActionLink.ActionType.RECONCILIATION_PULL, 
StandardEntitlement.USER_READ);
+
+        if (!recounciliationOnly) {
+            builder.addAction(new ActionLink<LinkedAccountTO>() {
+
+                private static final long serialVersionUID = 
2555747430358755813L;
+
+                @Override
+                public void onClick(final AjaxRequestTarget target, final 
LinkedAccountTO linkedAccountTO) {
+                    try {
+                        LinkedAccountPatch linkedAccountPatch = new 
LinkedAccountPatch.Builder().
+                                operation(PatchOperation.DELETE).
+                                linkedAccountTO(linkedAccountTO).build();
+                        linkedAccountPatch.setLinkedAccountTO(linkedAccountTO);
+                        UserPatch patch = new UserPatch();
+                        patch.setKey(model.getObject().getKey());
+                        patch.getLinkedAccounts().add(linkedAccountPatch);
+                        
model.setObject(userRestClient.update(model.getObject().getETagValue(), 
patch).getEntity());
+                        linkedAccountTOs.remove(linkedAccountTO);
+
+                        
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
+                    } catch (Exception e) {
+                        LOG.error("While removing linked account {}", 
linkedAccountTO.getKey(), e);
+                        
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
+                                ? e.getClass().getName() : e.getMessage());
                     }
-                }, ActionLink.ActionType.DELETE, 
StandardEntitlement.USER_UPDATE, true);
+
+                    checkAddButton();
+                    ((BasePage) 
pageRef.getPage()).getNotificationPanel().refresh(target);
+                    send(LinkedAccountModalPanel.this, Broadcast.DEPTH, new 
ListViewPanel.ListViewReload<>(target));
+                }
+            }, ActionLink.ActionType.DELETE, StandardEntitlement.USER_UPDATE, 
true);
+        }
 
         builder.addNewItemPanelBuilder(wizard);
 
-        list = builder.build("linkedAccountsList");
+        list = builder.build(MultilevelPanel.FIRST_LEVEL_ID);
         list.setOutputMarkupId(true);
         
list.setReadOnly(!SyncopeConsoleSession.get().owns(StandardEntitlement.USER_UPDATE));
 
@@ -215,8 +295,9 @@ public class LinkedAccountModalPanel extends 
AbstractModalPanel<Serializable> {
                                 LinkedAccountModalPanel.this)));
             }
         };
-        list.addOrReplaceInnerObject(addAjaxLink);
-        add(list);
+        
list.addOrReplaceInnerObject(addAjaxLink.setEnabled(!recounciliationOnly).setVisible(!recounciliationOnly));
+
+        add(mlp.setFirstLevel(list));
     }
 
     private void sortLinkedAccounts() {
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/panels/LinkedAccountsStatusModalPanel.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/panels/LinkedAccountsStatusModalPanel.java
new file mode 100644
index 0000000..0a88afb
--- /dev/null
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/panels/LinkedAccountsStatusModalPanel.java
@@ -0,0 +1,40 @@
+/*
+ * 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 
org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.model.IModel;
+
+public class LinkedAccountsStatusModalPanel extends 
MultilevelPanel.SecondLevel {
+
+    private static final long serialVersionUID = 8804361394735366181L;
+
+    public LinkedAccountsStatusModalPanel(
+            final BaseModal<?> baseModal,
+            final IModel<UserTO> model,
+            final PageReference pageRef) {
+
+        super(MultilevelPanel.SECOND_LEVEL_ID);
+
+        add(new LinkedAccountModalPanel(baseModal, model, pageRef, 
true).setOutputMarkupId(true));
+    }
+
+}
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java
index d36afbd..eb42741 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java
@@ -69,7 +69,6 @@ public class UserDirectoryPanel extends 
AnyDirectoryPanel<UserTO, UserRestClient
         @Override
         protected void onConfigure() {
             super.onConfigure();
-            setFooterVisible(false);
         }
 
     };
@@ -92,6 +91,17 @@ public class UserDirectoryPanel extends 
AnyDirectoryPanel<UserTO, UserRestClient
             }
         });
 
+        wizardWrapperModal.setWindowClosedCallback(new 
ModalWindow.WindowClosedCallback() {
+
+            private static final long serialVersionUID = -6109847349558471532L;
+
+            @Override
+            public void onClose(final AjaxRequestTarget target) {
+                updateResultTable(target);
+                modal.show(false);
+            }
+        });
+
         wizardWrapperModal.size(Modal.Size.Large);
         addOuterObject(wizardWrapperModal);
     }
@@ -154,7 +164,7 @@ public class UserDirectoryPanel extends 
AnyDirectoryPanel<UserTO, UserRestClient
             public void onClick(final AjaxRequestTarget target, final UserTO 
ignore) {
                 send(UserDirectoryPanel.this, Broadcast.EXACT,
                         new AjaxWizard.EditItemActionEvent<>(
-                                new UserWrapper(new 
UserRestClient().read(model.getObject().getKey())),
+                                new 
UserWrapper(UserRestClient.class.cast(restClient).read(model.getObject().getKey())),
                                 target));
             }
         }, ActionType.EDIT,
@@ -285,6 +295,7 @@ public class UserDirectoryPanel extends 
AnyDirectoryPanel<UserTO, UserRestClient
 
                 @Override
                 public void onClick(final AjaxRequestTarget target, final 
UserTO ignore) {
+                    
model.setObject(UserRestClient.class.cast(restClient).read(model.getObject().getKey()));
                     IModel<AnyWrapper<UserTO>> formModel = new 
CompoundPropertyModel<>(
                             new AnyWrapper<>(model.getObject()));
                     altDefaultModal.setFormModel(formModel);
@@ -340,13 +351,15 @@ public class UserDirectoryPanel extends 
AnyDirectoryPanel<UserTO, UserRestClient
 
                 @Override
                 public void onClick(final AjaxRequestTarget target, final 
UserTO ignore) {
+                    
model.setObject(UserRestClient.class.cast(restClient).read(model.getObject().getKey()));
                     target.add(wizardWrapperModal.setContent(
-                            new LinkedAccountModalPanel(wizardWrapperModal, 
model.getObject(), pageRef)));
+                            new LinkedAccountModalPanel(wizardWrapperModal, 
model, pageRef, false)));
                     wizardWrapperModal.header(new 
ResourceModel("linkedAccounts.title"));
                     wizardWrapperModal.show(true);
                 }
             }, ActionType.MANAGE_ACCOUNTS,
-                    String.format("%s,%s", StandardEntitlement.USER_READ, 
StandardEntitlement.USER_UPDATE));
+                    String.format("%s,%s,%s", StandardEntitlement.USER_READ, 
StandardEntitlement.USER_UPDATE,
+                            StandardEntitlement.RESOURCE_GET_CONNOBJECT));
         }
 
         panel.add(new ActionLink<UserTO>() {
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/status/AnyStatusDirectoryPanel.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/status/AnyStatusDirectoryPanel.java
index 81438b4..5f80e19 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/status/AnyStatusDirectoryPanel.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/status/AnyStatusDirectoryPanel.java
@@ -33,6 +33,7 @@ import 
org.apache.syncope.client.console.commons.status.StatusBean;
 import org.apache.syncope.client.console.commons.status.StatusUtils;
 import org.apache.syncope.client.console.panels.DirectoryPanel;
 import org.apache.syncope.client.console.panels.AjaxDataTablePanel;
+import org.apache.syncope.client.console.panels.LinkedAccountsStatusModalPanel;
 import org.apache.syncope.client.console.panels.ModalPanel;
 import org.apache.syncope.client.console.panels.MultilevelPanel;
 import org.apache.syncope.client.console.rest.AbstractAnyRestClient;
@@ -63,6 +64,7 @@ import org.apache.wicket.markup.ComponentTag;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.repeater.Item;
 import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
 import org.apache.wicket.model.StringResourceModel;
 
 public class AnyStatusDirectoryPanel
@@ -244,6 +246,33 @@ public class AnyStatusDirectoryPanel
             }, ActionLink.ActionType.RECONCILIATION_PULL, 
StandardEntitlement.TASK_EXECUTE);
         }
 
+        if (anyTO instanceof UserTO && 
!UserTO.class.cast(anyTO).getLinkedAccounts().isEmpty()) {
+            UserTO userTO = UserTO.class.cast(anyTO);
+
+            if (!userTO.getLinkedAccounts().isEmpty()
+                    && 
userTO.getLinkedAccounts().stream().anyMatch(linkedAccountTO -> {
+                        return 
linkedAccountTO.getResource().equals(model.getObject().getResource());
+                    })) {
+
+                panel.add(new ActionLink<StatusBean>() {
+
+                    private static final long serialVersionUID = 
5168094747477174155L;
+
+                    @Override
+                    public void onClick(final AjaxRequestTarget target, final 
StatusBean bean) {
+                        multiLevelPanelRef.next("ACCOUNTS",
+                                new LinkedAccountsStatusModalPanel(
+                                        baseModal, 
Model.of(UserTO.class.cast(anyTO)), pageRef),
+                                target);
+                        target.add(multiLevelPanelRef);
+                        
AnyStatusDirectoryPanel.this.getTogglePanel().close(target);
+                    }
+                }, ActionLink.ActionType.MANAGE_ACCOUNTS,
+                        String.format("%s,%s,%s", 
StandardEntitlement.USER_READ, StandardEntitlement.USER_UPDATE,
+                                StandardEntitlement.RESOURCE_GET_CONNOBJECT));
+            }
+        }
+
         return panel;
     }
 
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/status/ReconTaskPanel.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/status/ReconTaskPanel.java
index 0e4e4f3..2ea7620 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/status/ReconTaskPanel.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/status/ReconTaskPanel.java
@@ -194,7 +194,9 @@ public class ReconTaskPanel extends 
MultilevelPanel.SecondLevel {
                 } catch (Exception e) {
                     LOG.error("While attempting reconciliation on {}", 
reconQuery, form.getModelObject(), e);
                     SyncopeConsoleSession.get().error(resource + ": "
-                            + (StringUtils.isBlank(e.getMessage()) ? 
e.getClass().getName() : e.getMessage()));
+                            + (StringUtils.isBlank(e.getMessage())
+                            ? e.getClass().getName()
+                            : 
StringUtils.abbreviate(StringUtils.normalizeSpace(e.getMessage()), 280)));
                 }
                 multiLevelPanelRef.prev(target);
                 ((BasePage) 
pageRef.getPage()).getNotificationPanel().refresh(target);
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountDetailsPanel.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountDetailsPanel.java
index ca8be3e..6970c5e 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountDetailsPanel.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountDetailsPanel.java
@@ -18,11 +18,9 @@
  */
 package org.apache.syncope.client.console.wizards.any;
 
-import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.Pair;
@@ -60,7 +58,7 @@ public class LinkedAccountDetailsPanel extends WizardStep {
 
     private final ResourceRestClient resourceRestClient = new 
ResourceRestClient();
 
-    private ArrayList<String> connObjectKeyFieldValues;
+    private List<String> connObjectKeyFieldValues;
 
     public LinkedAccountDetailsPanel(final LinkedAccountTO linkedAccountTO) {
         super();
@@ -157,11 +155,10 @@ public class LinkedAccountDetailsPanel extends WizardStep 
{
             final String resource,
             final String searchTerm) {
 
-        Set<String> choices = new HashSet<>();
-        String resourceRemoteKey = ConnIdSpecialName.NAME;
+        AtomicReference<String> resourceRemoteKey = new 
AtomicReference<>(ConnIdSpecialName.NAME);
         try {
-            resourceRemoteKey = 
resourceRestClient.read(resource).getProvision(AnyTypeKind.USER.name()).get().
-                    getMapping().getConnObjectKeyItem().getExtAttrName();
+            
resourceRemoteKey.set(resourceRestClient.read(resource).getProvision(AnyTypeKind.USER.name()).get().
+                    getMapping().getConnObjectKeyItem().getExtAttrName());
         } catch (Exception ex) {
             LOG.error("While reading mapping for resource {}", resource, ex);
         }
@@ -169,20 +166,16 @@ public class LinkedAccountDetailsPanel extends WizardStep 
{
         ConnObjectTOQuery.Builder builder = new 
ConnObjectTOQuery.Builder().size(SEARCH_SIZE);
         if (StringUtils.isNotBlank(searchTerm)) {
             
builder.fiql(SyncopeClient.getConnObjectTOFiqlSearchConditionBuilder().
-                    is(resourceRemoteKey).equalTo(searchTerm + 
"*").query()).build();
+                    is(resourceRemoteKey.get()).equalTo(searchTerm + 
"*").query()).build();
         }
         Pair<String, List<ConnObjectTO>> items = 
resourceRestClient.searchConnObjects(resource,
                 AnyTypeKind.USER.name(),
                 builder,
-                new SortParam<>(resourceRemoteKey, true));
+                new SortParam<>(resourceRemoteKey.get(), true));
 
-        choices.addAll(items.getRight().stream().map(item -> {
-            return 
item.getAttr(ConnIdSpecialName.UID).get().getValues().get(0);
-        }).collect(Collectors.toSet()));
-
-        connObjectKeyFieldValues = new ArrayList<>(choices);
-        Collections.sort(connObjectKeyFieldValues);
+        connObjectKeyFieldValues = items.getRight().stream().
+                map(item -> 
item.getAttr(resourceRemoteKey.get()).get().getValues().get(0)).
+                collect(Collectors.toList());
         ajaxTextFieldPanel.setChoices(connObjectKeyFieldValues);
     }
-
 }
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountWizardBuilder.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountWizardBuilder.java
index 065aa3e..0b8bea4 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountWizardBuilder.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountWizardBuilder.java
@@ -34,6 +34,7 @@ import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.extensions.wizard.WizardModel;
+import org.apache.wicket.model.IModel;
 
 /**
  * Accounts wizard builder.
@@ -44,19 +45,15 @@ public class LinkedAccountWizardBuilder extends 
AjaxWizardBuilder<LinkedAccountT
 
     private final UserRestClient userRestClient = new UserRestClient();
 
-    private UserTO userTO;
+    private final IModel<UserTO> model;
 
-    private final String userKey;
-
-    public LinkedAccountWizardBuilder(final String userKey, final 
PageReference pageRef) {
+    public LinkedAccountWizardBuilder(final IModel<UserTO> model, final 
PageReference pageRef) {
         super(new LinkedAccountTO(), pageRef);
-        this.userKey = userKey;
-        this.userTO = userRestClient.read(userKey);
+        this.model = model;
     }
 
     @Override
     public AjaxWizard<LinkedAccountTO> build(final String id, final 
AjaxWizard.Mode mode) {
-        this.userTO = userRestClient.read(userKey);
         return super.build(id, mode);
     }
 
@@ -64,7 +61,7 @@ public class LinkedAccountWizardBuilder extends 
AjaxWizardBuilder<LinkedAccountT
     protected WizardModel buildModelSteps(final LinkedAccountTO modelObject, 
final WizardModel wizardModel) {
         wizardModel.add(new LinkedAccountDetailsPanel(modelObject));
         wizardModel.add(new LinkedAccountCredentialsPanel(modelObject));
-        wizardModel.add(new LinkedAccountPlainAttrsPanel(new 
EntityWrapper<>(modelObject), userTO));
+        wizardModel.add(new LinkedAccountPlainAttrsPanel(new 
EntityWrapper<>(modelObject), model.getObject()));
         wizardModel.add(new LinkedAccountPrivilegesPanel(modelObject));
         return wizardModel;
     }
@@ -76,9 +73,9 @@ public class LinkedAccountWizardBuilder extends 
AjaxWizardBuilder<LinkedAccountT
         LinkedAccountPatch linkedAccountPatch = new 
LinkedAccountPatch.Builder().linkedAccountTO(modelObject).build();
         linkedAccountPatch.setLinkedAccountTO(modelObject);
         UserPatch patch = new UserPatch();
-        patch.setKey(userTO.getKey());
+        patch.setKey(model.getObject().getKey());
         patch.getLinkedAccounts().add(linkedAccountPatch);
-        userRestClient.update(userTO.getETagValue(), patch);
+        
model.setObject(userRestClient.update(model.getObject().getETagValue(), 
patch).getEntity());
 
         return modelObject;
     }
@@ -96,7 +93,7 @@ public class LinkedAccountWizardBuilder extends 
AjaxWizardBuilder<LinkedAccountT
         LinkedAccountTO linkedAccountTO = 
LinkedAccountTO.class.cast(afterObject);
         return new CreateEvent(
                 linkedAccountTO.getConnObjectKeyValue(),
-                userTO,
+                model.getObject(),
                 target);
     }
 
diff --git 
a/client/console/src/main/resources/org/apache/syncope/client/console/panels/LinkedAccountModalPanel.html
 
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/LinkedAccountModalPanel.html
index dd5288c..aadf84f 100644
--- 
a/client/console/src/main/resources/org/apache/syncope/client/console/panels/LinkedAccountModalPanel.html
+++ 
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/LinkedAccountModalPanel.html
@@ -18,7 +18,7 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml"; 
xmlns:wicket="http://wicket.apache.org";>
   <wicket:panel>
-    <span wicket:id="linkedAccountsList">[linkedAccountsList]</span>
-    <div wicket:id="toggle"/>
+    <span wicket:id="toggle"/>
+    <span wicket:id="mlpContainer">[MlpContainer]</span>
   </wicket:panel>
 </html>
\ No newline at end of file
diff --git 
a/client/console/src/main/resources/org/apache/syncope/client/console/panels/LinkedAccountModalPanel.html
 
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/LinkedAccountsStatusModalPanel.html
similarity index 89%
copy from 
client/console/src/main/resources/org/apache/syncope/client/console/panels/LinkedAccountModalPanel.html
copy to 
client/console/src/main/resources/org/apache/syncope/client/console/panels/LinkedAccountsStatusModalPanel.html
index dd5288c..f6f3a66 100644
--- 
a/client/console/src/main/resources/org/apache/syncope/client/console/panels/LinkedAccountModalPanel.html
+++ 
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/LinkedAccountsStatusModalPanel.html
@@ -18,7 +18,6 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml"; 
xmlns:wicket="http://wicket.apache.org";>
   <wicket:panel>
-    <span wicket:id="linkedAccountsList">[linkedAccountsList]</span>
-    <div wicket:id="toggle"/>
+    <div wicket:id="content"></div>
   </wicket:panel>
-</html>
\ No newline at end of file
+</html>
diff --git 
a/core/logic/src/main/java/org/apache/syncope/core/logic/ReconciliationLogic.java
 
b/core/logic/src/main/java/org/apache/syncope/core/logic/ReconciliationLogic.java
index e8bbfcd..ebe7f35 100644
--- 
a/core/logic/src/main/java/org/apache/syncope/core/logic/ReconciliationLogic.java
+++ 
b/core/logic/src/main/java/org/apache/syncope/core/logic/ReconciliationLogic.java
@@ -266,7 +266,7 @@ public class ReconciliationLogic extends 
AbstractTransactionalLogic<EntityTO> {
                                         match.getLinkedAccount(),
                                         pushTask);
                                 if (result.getStatus() == 
ProvisioningReport.Status.FAILURE) {
-                                    
sce.getElements().add(results.get(0).getMessage());
+                                    sce.getElements().add(result.getMessage());
                                 } else {
                                     results.add(result);
                                 }

Reply via email to