[SYNCOPE-1036] Removing WebSocketBehavior from eveywhere but Topology

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

Branch: refs/heads/2_0_X
Commit: 247868da3f1eff22d65689449096118cc31558e6
Parents: 6853975
Author: Francesco Chicchiriccò <[email protected]>
Authored: Fri Mar 3 14:00:26 2017 +0100
Committer: Francesco Chicchiriccò <[email protected]>
Committed: Fri Mar 3 14:00:26 2017 +0100

----------------------------------------------------------------------
 .../client/console/SyncopeConsoleSession.java   |  21 --
 .../approvals/ApprovalDirectoryPanel.java       |   1 +
 .../syncope/client/console/pages/BasePage.java  |  36 +---
 .../console/rest/NotificationRestClient.java    |   5 +
 .../client/console/rest/ReportRestClient.java   |   5 +
 .../client/console/rest/TaskRestClient.java     |   9 +-
 .../client/console/topology/Topology.java       |   2 +-
 .../client/console/widgets/ApprovalsWidget.java | 148 ++++---------
 .../client/console/widgets/JobWidget.java       | 214 +++++++------------
 .../console/widgets/ReconciliationWidget.java   | 187 +++++++---------
 .../client/console/widgets/JobWidget.html       |   3 +-
 .../console/widgets/ReconciliationWidget.html   |  19 +-
 12 files changed, 242 insertions(+), 408 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/247868da/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
index 7a023f8..a001839 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
@@ -28,8 +28,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
 import javax.ws.rs.core.EntityTag;
 import javax.ws.rs.core.MediaType;
 import org.apache.commons.collections4.CollectionUtils;
@@ -93,8 +91,6 @@ public class SyncopeConsoleSession extends 
AuthenticatedWebSession {
 
     private Roles roles;
 
-    private boolean checkReconciliationJob = false;
-
     public static SyncopeConsoleSession get() {
         return (SyncopeConsoleSession) Session.get();
     }
@@ -120,15 +116,6 @@ public class SyncopeConsoleSession extends 
AuthenticatedWebSession {
         executorService.execute(command);
     }
 
-    public ScheduledFuture<?> scheduleAtFixedRate(
-            final Runnable command,
-            final long initialDelay,
-            final long period,
-            final TimeUnit unit) {
-
-        return executorService.scheduleAtFixedRate(command, initialDelay, 
period, unit);
-    }
-
     @Override
     public void invalidate() {
         if (getJWT() != null) {
@@ -258,12 +245,4 @@ public class SyncopeConsoleSession extends 
AuthenticatedWebSession {
         return FastDateFormat.getDateTimeInstance(DateFormat.SHORT, 
DateFormat.SHORT, locale);
     }
 
-    public boolean isCheckReconciliationJob() {
-        return checkReconciliationJob;
-    }
-
-    public void setCheckReconciliationJob(final boolean 
checkReconciliationJob) {
-        this.checkReconciliationJob = checkReconciliationJob;
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/247868da/client/console/src/main/java/org/apache/syncope/client/console/approvals/ApprovalDirectoryPanel.java
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/approvals/ApprovalDirectoryPanel.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/approvals/ApprovalDirectoryPanel.java
index 61519ea..ffcb7ed 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/approvals/ApprovalDirectoryPanel.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/approvals/ApprovalDirectoryPanel.java
@@ -72,6 +72,7 @@ public class ApprovalDirectoryPanel
             @Override
             public void onClose(final AjaxRequestTarget target) {
                 updateResultTable(target);
+                ((BasePage) 
pageReference.getPage()).getApprovalsWidget().refreshLatestAlerts(target);
                 modal.show(false);
             }
         });

http://git-wip-us.apache.org/repos/asf/syncope/blob/247868da/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
index 787990c..7241f61 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
@@ -20,7 +20,6 @@ package org.apache.syncope.client.console.pages;
 
 import java.io.Serializable;
 import java.util.List;
-import java.util.concurrent.TimeUnit;
 import org.apache.syncope.client.console.BookmarkablePageLinkBuilder;
 import org.apache.syncope.client.console.SyncopeConsoleApplication;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
@@ -35,8 +34,6 @@ import org.apache.syncope.client.console.topology.Topology;
 import org.apache.syncope.client.console.wicket.markup.head.MetaHeaderItem;
 import 
org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
 import org.apache.syncope.client.console.widgets.ApprovalsWidget;
-import org.apache.syncope.client.console.widgets.JobWidget;
-import org.apache.syncope.client.console.widgets.ReconciliationWidget;
 import org.apache.syncope.common.lib.info.SystemInfo;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.wicket.AttributeModifier;
@@ -60,8 +57,6 @@ import 
org.apache.wicket.markup.html.link.BookmarkablePageLink;
 import org.apache.wicket.markup.html.link.Link;
 import org.apache.wicket.markup.html.list.ListItem;
 import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.protocol.ws.api.WebSocketBehavior;
-import org.apache.wicket.protocol.ws.api.message.ConnectedMessage;
 import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.request.resource.ContentDisposition;
@@ -80,6 +75,8 @@ public class BasePage extends WebPage implements 
IAjaxIndicatorAware {
 
     protected NotificationPanel notificationPanel;
 
+    protected ApprovalsWidget approvalsWidget;
+
     public BasePage() {
         this(null);
     }
@@ -87,28 +84,6 @@ public class BasePage extends WebPage implements 
IAjaxIndicatorAware {
     public BasePage(final PageParameters parameters) {
         super(parameters);
 
-        // Native WebSocket
-        add(new WebSocketBehavior() {
-
-            private static final long serialVersionUID = 3109256773218160485L;
-
-            @Override
-            protected void onConnect(final ConnectedMessage message) {
-                super.onConnect(message);
-
-                SyncopeConsoleSession.get().scheduleAtFixedRate(
-                        new ApprovalsWidget.ApprovalInfoUpdater(message), 0, 
30, TimeUnit.SECONDS);
-
-                if (BasePage.this instanceof Dashboard) {
-                    SyncopeConsoleSession.get().scheduleAtFixedRate(
-                            new JobWidget.JobInfoUpdater(message), 0, 10, 
TimeUnit.SECONDS);
-                    SyncopeConsoleSession.get().scheduleAtFixedRate(
-                            new 
ReconciliationWidget.ReconciliationJobInfoUpdater(message), 0, 10, 
TimeUnit.SECONDS);
-                }
-            }
-
-        });
-
         body = new WebMarkupContainer("body");
         Serializable leftMenuCollapse = 
SyncopeConsoleSession.get().getAttribute(SyncopeConsoleSession.MENU_COLLAPSE);
         if ((leftMenuCollapse instanceof Boolean) && ((Boolean) 
leftMenuCollapse)) {
@@ -123,7 +98,8 @@ public class BasePage extends WebPage implements 
IAjaxIndicatorAware {
         body.add(new Label("version", 
SyncopeConsoleApplication.get().getVersion()));
         body.add(new Label("username", 
SyncopeConsoleSession.get().getSelfTO().getUsername()));
 
-        body.add(new ApprovalsWidget("approvalsWidget", 
getPageReference()).setRenderBodyOnly(true));
+        approvalsWidget = new ApprovalsWidget("approvalsWidget", 
getPageReference());
+        body.add(approvalsWidget.setRenderBodyOnly(true));
 
         // right sidebar
         SystemInfo systemInfo = SyncopeConsoleSession.get().getSystemInfo();
@@ -403,6 +379,10 @@ public class BasePage extends WebPage implements 
IAjaxIndicatorAware {
         return notificationPanel;
     }
 
+    public ApprovalsWidget getApprovalsWidget() {
+        return approvalsWidget;
+    }
+
     /**
      * Set a WindowClosedCallback for a Modal instance.
      *

http://git-wip-us.apache.org/repos/asf/syncope/blob/247868da/client/console/src/main/java/org/apache/syncope/client/console/rest/NotificationRestClient.java
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/rest/NotificationRestClient.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/rest/NotificationRestClient.java
index 1509217..dfb8495 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/rest/NotificationRestClient.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/rest/NotificationRestClient.java
@@ -23,6 +23,7 @@ import java.util.List;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.to.JobTO;
 import org.apache.syncope.common.lib.to.MailTemplateTO;
 import org.apache.syncope.common.lib.to.NotificationTO;
 import org.apache.syncope.common.lib.types.MailTemplateFormat;
@@ -38,6 +39,10 @@ public class NotificationRestClient extends BaseRestClient
         return getService(NotificationService.class).list();
     }
 
+    public JobTO getJob() {
+        return getService(NotificationService.class).getJob();
+    }
+
     public NotificationTO read(final String key) {
         return getService(NotificationService.class).read(key);
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/247868da/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java
index c51df2c..38f86bc 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java
@@ -29,6 +29,7 @@ import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.BulkAction;
 import org.apache.syncope.common.lib.to.BulkActionResult;
 import org.apache.syncope.common.lib.to.ExecTO;
+import org.apache.syncope.common.lib.to.JobTO;
 import org.apache.syncope.common.lib.to.ReportTO;
 import org.apache.syncope.common.lib.to.ReportTemplateTO;
 import org.apache.syncope.common.lib.types.ReportExecExportFormat;
@@ -51,6 +52,10 @@ public class ReportRestClient extends BaseRestClient
         return getService(ReportService.class).list();
     }
 
+    public List<JobTO> listJobs() {
+        return getService(ReportService.class).listJobs();
+    }
+
     public void create(final ReportTO reportTO) {
         getService(ReportService.class).create(reportTO);
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/247868da/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
index cfc4b82..f1b6ca9 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
@@ -29,6 +29,7 @@ import org.apache.syncope.common.lib.to.PushTaskTO;
 import org.apache.syncope.common.lib.to.SchedTaskTO;
 import org.apache.syncope.common.lib.to.PullTaskTO;
 import org.apache.syncope.common.lib.to.ExecTO;
+import org.apache.syncope.common.lib.to.JobTO;
 import org.apache.syncope.common.lib.to.PagedResult;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.TaskType;
@@ -45,6 +46,10 @@ public class TaskRestClient extends BaseRestClient 
implements ExecutionRestClien
 
     private static final long serialVersionUID = 6284485820911028843L;
 
+    public List<JobTO> listJobs() {
+        return getService(TaskService.class).listJobs();
+    }
+
     public int count(final TaskType kind) {
         return getService(TaskService.class).list(
                 new 
TaskQuery.Builder(kind).page(1).size(1).build()).getTotalCount();
@@ -53,13 +58,13 @@ public class TaskRestClient extends BaseRestClient 
implements ExecutionRestClien
     public int count(final String resource, final TaskType kind) {
         return getService(TaskService.class).list(
                 new TaskQuery.Builder(kind).resource(resource).page(1).size(1).
-                build()).getTotalCount();
+                        build()).getTotalCount();
     }
 
     public int count(final AnyTypeKind anyTypeKind, final String entityKey, 
final TaskType kind) {
         return getService(TaskService.class).list(
                 new 
TaskQuery.Builder(kind).anyTypeKind(anyTypeKind).entityKey(entityKey).page(1).size(1).
-                build()).getTotalCount();
+                        build()).getTotalCount();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/247868da/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
index a3b7e30..b70214b 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
@@ -465,7 +465,7 @@ public class Topology extends BasePage {
 
         jsPlace.add(new AbstractAjaxTimerBehavior(Duration.seconds(2)) {
 
-            private static final long serialVersionUID = 1L;
+            private static final long serialVersionUID = -4426283634345968585L;
 
             @Override
             protected void onTimer(final AjaxRequestTarget target) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/247868da/client/console/src/main/java/org/apache/syncope/client/console/widgets/ApprovalsWidget.java
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/widgets/ApprovalsWidget.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/widgets/ApprovalsWidget.java
index ae2c5e4..ef147f3 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/widgets/ApprovalsWidget.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/widgets/ApprovalsWidget.java
@@ -19,6 +19,7 @@
 package org.apache.syncope.client.console.widgets;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
@@ -26,16 +27,14 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.console.BookmarkablePageLinkBuilder;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.pages.Approvals;
+import org.apache.syncope.client.console.rest.UserWorkflowRestClient;
+import 
org.apache.syncope.client.console.wicket.ajax.IndicatorAjaxTimerBehavior;
 import org.apache.syncope.common.lib.to.WorkflowFormTO;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
-import org.apache.syncope.common.rest.api.service.UserWorkflowService;
-import org.apache.wicket.Application;
 import org.apache.wicket.PageReference;
-import org.apache.wicket.ThreadContext;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
 import 
org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
-import org.apache.wicket.event.IEvent;
 import org.apache.wicket.markup.ComponentTag;
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.WebPage;
@@ -46,58 +45,69 @@ import org.apache.wicket.markup.html.panel.Panel;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.ResourceModel;
 import org.apache.wicket.model.util.ListModel;
-import org.apache.wicket.protocol.ws.WebSocketSettings;
-import org.apache.wicket.protocol.ws.api.WebSocketPushBroadcaster;
-import org.apache.wicket.protocol.ws.api.event.WebSocketPushPayload;
-import org.apache.wicket.protocol.ws.api.message.ConnectedMessage;
-import org.apache.wicket.protocol.ws.api.message.IWebSocketPushMessage;
-import org.apache.wicket.protocol.ws.api.registry.IKey;
+import org.apache.wicket.util.time.Duration;
 
 public class ApprovalsWidget extends AlertWidget<WorkflowFormTO> {
 
     private static final long serialVersionUID = 7667120094526529934L;
 
+    private final UserWorkflowRestClient restClient = new 
UserWorkflowRestClient();
+
+    private final List<WorkflowFormTO> lastApprovals = new ArrayList<>();
+
     public ApprovalsWidget(final String id, final PageReference pageRef) {
         super(id);
         setOutputMarkupId(true);
-    }
 
-    @Override
-    public void onEvent(final IEvent<?> event) {
-        if (event.getPayload() instanceof WebSocketPushPayload) {
-            WebSocketPushPayload wsEvent = (WebSocketPushPayload) 
event.getPayload();
-            if (wsEvent.getMessage() instanceof ApprovalsWidgetMessage) {
-                List<WorkflowFormTO> updatedApprovals = 
((ApprovalsWidgetMessage) wsEvent.getMessage()).
-                        getUpdatedApprovals();
-                if (!latestAlerts.getObject().equals(updatedApprovals)) {
-                    latestAlerts.getObject().clear();
-                    latestAlerts.getObject().addAll(updatedApprovals);
-
-                    ApprovalsWidget.this.linkAlertsNumber.
-                            
setDefaultModelObject(ApprovalsWidget.this.latestAlerts.getObject().size());
-                    
wsEvent.getHandler().add(ApprovalsWidget.this.linkAlertsNumber);
-
-                    ApprovalsWidget.this.headerAlertsNumber.
-                            
setDefaultModelObject(ApprovalsWidget.this.latestAlerts.getObject().size());
-                    
wsEvent.getHandler().add(ApprovalsWidget.this.headerAlertsNumber);
-
-                    ApprovalsWidget.this.latestFive.removeAll();
-                    
wsEvent.getHandler().add(ApprovalsWidget.this.latestAlertsList);
+        latestAlertsList.add(new 
IndicatorAjaxTimerBehavior(Duration.seconds(30)) {
+
+            private static final long serialVersionUID = 7298597675929755960L;
+
+            @Override
+            protected void onTimer(final AjaxRequestTarget target) {
+                if (!latestAlerts.getObject().equals(lastApprovals)) {
+                    refreshLatestAlerts(target);
                 }
             }
-        }
+        });
+    }
+
+    public final void refreshLatestAlerts(final AjaxRequestTarget target) {
+        latestAlerts.getObject().clear();
+        latestAlerts.getObject().addAll(lastApprovals);
+
+        
linkAlertsNumber.setDefaultModelObject(latestAlerts.getObject().size());
+        target.add(linkAlertsNumber);
+
+        
headerAlertsNumber.setDefaultModelObject(latestAlerts.getObject().size());
+        target.add(headerAlertsNumber);
+
+        latestFive.removeAll();
+        target.add(latestAlertsList);
+
+        lastApprovals.clear();
+        lastApprovals.addAll(latestAlerts.getObject());
     }
 
     @Override
     protected IModel<List<WorkflowFormTO>> getLatestAlerts() {
-
         return new ListModel<WorkflowFormTO>() {
 
             private static final long serialVersionUID = -2583290457773357445L;
 
             @Override
             public List<WorkflowFormTO> getObject() {
-                return ApprovalInfoUpdater.getLatestAlerts();
+                List<WorkflowFormTO> updatedApprovals;
+                if 
(SyncopeConsoleSession.get().owns(StandardEntitlement.WORKFLOW_FORM_LIST)
+                        && 
SyncopeConsoleSession.get().owns(StandardEntitlement.WORKFLOW_FORM_READ)) {
+
+                    updatedApprovals = restClient.getForms();
+                    Collections.sort(updatedApprovals, new 
WorkflowFormComparator());
+                } else {
+                    updatedApprovals = Collections.<WorkflowFormTO>emptyList();
+                }
+
+                return updatedApprovals;
             }
         };
     }
@@ -109,7 +119,7 @@ public class ApprovalsWidget extends 
AlertWidget<WorkflowFormTO> {
 
     @Override
     protected AbstractLink getEventsLink(final String linkid) {
-        BookmarkablePageLink<Object> approvals = 
BookmarkablePageLinkBuilder.build(linkid, Approvals.class);
+        BookmarkablePageLink<Approvals> approvals = 
BookmarkablePageLinkBuilder.build(linkid, Approvals.class);
         MetaDataRoleAuthorizationStrategy.authorize(approvals, WebPage.ENABLE, 
StandardEntitlement.WORKFLOW_FORM_LIST);
         return approvals;
     }
@@ -166,74 +176,8 @@ public class ApprovalsWidget extends 
AlertWidget<WorkflowFormTO> {
 
     }
 
-    public static final class ApprovalInfoUpdater implements Runnable {
-
-        private final Application application;
-
-        private final SyncopeConsoleSession session;
-
-        private final IKey key;
-
-        public ApprovalInfoUpdater(final ConnectedMessage message) {
-            this.application = message.getApplication();
-            this.session = SyncopeConsoleSession.get();
-            this.key = message.getKey();
-        }
-
-        @Override
-        public void run() {
-            try {
-                ThreadContext.setApplication(application);
-                ThreadContext.setSession(session);
-
-                List<WorkflowFormTO> updatedApprovals = getLatestAlerts();
-
-                WebSocketSettings settings = 
WebSocketSettings.Holder.get(application);
-                WebSocketPushBroadcaster broadcaster = new 
WebSocketPushBroadcaster(settings.getConnectionRegistry());
-                broadcaster.broadcast(
-                        new ConnectedMessage(application, session.getId(), 
key),
-                        new ApprovalsWidgetMessage(updatedApprovals));
-            } catch (Throwable t) {
-                LOG.error("Unexpected error while checking for updated 
approval info", t);
-            } finally {
-                ThreadContext.detach();
-            }
-        }
-
-        protected static List<WorkflowFormTO> getLatestAlerts() {
-            final List<WorkflowFormTO> updatedApprovals;
-            if 
(SyncopeConsoleSession.get().owns(StandardEntitlement.WORKFLOW_FORM_LIST)
-                    && 
SyncopeConsoleSession.get().owns(StandardEntitlement.WORKFLOW_FORM_READ)) {
-                updatedApprovals = 
SyncopeConsoleSession.get().getService(UserWorkflowService.class).getForms();
-            } else {
-                updatedApprovals = Collections.<WorkflowFormTO>emptyList();
-            }
-            Collections.sort(updatedApprovals, new WorkflowFormComparator());
-            return updatedApprovals;
-        }
-    }
-
-    private static class ApprovalsWidgetMessage implements 
IWebSocketPushMessage, Serializable {
-
-        private static final long serialVersionUID = -824793424112532838L;
-
-        private final List<WorkflowFormTO> updatedApprovals;
-
-        ApprovalsWidgetMessage(final List<WorkflowFormTO> updatedApprovals) {
-            this.updatedApprovals = updatedApprovals;
-        }
-
-        public List<WorkflowFormTO> getUpdatedApprovals() {
-            return updatedApprovals;
-        }
-
-    }
-
     private static class WorkflowFormComparator implements 
Comparator<WorkflowFormTO>, Serializable {
 
-        /**
-         *
-         */
         private static final long serialVersionUID = 4650217602780789075L;
 
         @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/247868da/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
index dcd1b2b..1129ea6 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
@@ -33,6 +33,10 @@ import 
org.apache.syncope.client.console.commons.SortableDataProviderComparator;
 import org.apache.syncope.client.console.panels.DirectoryPanel;
 import org.apache.syncope.client.console.panels.ExecMessageModal;
 import org.apache.syncope.client.console.rest.BaseRestClient;
+import org.apache.syncope.client.console.rest.NotificationRestClient;
+import org.apache.syncope.client.console.rest.ReportRestClient;
+import org.apache.syncope.client.console.rest.TaskRestClient;
+import 
org.apache.syncope.client.console.wicket.ajax.IndicatorAjaxTimerBehavior;
 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.BooleanPropertyColumn;
 import 
org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.DatePropertyColumn;
@@ -44,12 +48,7 @@ import org.apache.syncope.common.lib.to.ExecTO;
 import org.apache.syncope.common.lib.to.JobTO;
 import org.apache.syncope.common.lib.to.ReportTO;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
-import org.apache.syncope.common.rest.api.service.NotificationService;
-import org.apache.syncope.common.rest.api.service.ReportService;
-import org.apache.syncope.common.rest.api.service.TaskService;
-import org.apache.wicket.Application;
 import org.apache.wicket.PageReference;
-import org.apache.wicket.ThreadContext;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import 
org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
 import org.apache.wicket.event.IEvent;
@@ -61,6 +60,7 @@ import 
org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
 import 
org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
 import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
 import org.apache.wicket.extensions.markup.html.tabs.ITab;
+import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.markup.html.panel.Panel;
 import org.apache.wicket.markup.repeater.Item;
@@ -69,26 +69,17 @@ import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.Model;
 import org.apache.wicket.model.ResourceModel;
 import org.apache.wicket.model.StringResourceModel;
-import org.apache.wicket.protocol.ws.WebSocketSettings;
-import org.apache.wicket.protocol.ws.api.WebSocketPushBroadcaster;
-import org.apache.wicket.protocol.ws.api.event.WebSocketPushPayload;
-import org.apache.wicket.protocol.ws.api.message.ConnectedMessage;
-import org.apache.wicket.protocol.ws.api.message.IWebSocketPushMessage;
-import org.apache.wicket.protocol.ws.api.registry.IKey;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.wicket.util.time.Duration;
 
 public class JobWidget extends BaseWidget {
 
     private static final long serialVersionUID = 7667120094526529934L;
 
-    private static final Logger LOG = LoggerFactory.getLogger(JobWidget.class);
-
     private static final int ROWS = 5;
 
     private final BaseModal<Serializable> modal = new 
BaseModal<Serializable>("modal") {
 
-        private static final long serialVersionUID = 1L;
+        private static final long serialVersionUID = 389935548143327858L;
 
         @Override
         protected void onConfigure() {
@@ -99,7 +90,7 @@ public class JobWidget extends BaseWidget {
 
     private final BaseModal<Serializable> detailModal = new 
BaseModal<Serializable>("detailModal") {
 
-        private static final long serialVersionUID = 1L;
+        private static final long serialVersionUID = 389935548143327858L;
 
         @Override
         protected void onConfigure() {
@@ -110,7 +101,7 @@ public class JobWidget extends BaseWidget {
 
     private final BaseModal<ReportTO> reportModal = new 
BaseModal<ReportTO>("reportModal") {
 
-        private static final long serialVersionUID = 1L;
+        private static final long serialVersionUID = 389935548143327858L;
 
         @Override
         protected void onConfigure() {
@@ -119,37 +110,13 @@ public class JobWidget extends BaseWidget {
         }
     };
 
-    private static List<JobTO> getAvailable(final SyncopeConsoleSession 
session) {
-        List<JobTO> available = new ArrayList<>();
+    private final NotificationRestClient notificationRestClient = new 
NotificationRestClient();
 
-        if (session.owns(StandardEntitlement.NOTIFICATION_LIST)) {
-            JobTO notificationJob = 
session.getService(NotificationService.class).getJob();
-            if (notificationJob != null) {
-                available.add(notificationJob);
-            }
-        }
-        if (session.owns(StandardEntitlement.TASK_LIST)) {
-            available.addAll(session.getService(TaskService.class).listJobs());
-        }
-        if (session.owns(StandardEntitlement.REPORT_LIST)) {
-            
available.addAll(session.getService(ReportService.class).listJobs());
-        }
+    private final TaskRestClient taskRestClient = new TaskRestClient();
 
-        return available;
-    }
-
-    private static List<ExecTO> getRecent(final SyncopeConsoleSession session) 
{
-        List<ExecTO> recent = new ArrayList<>();
-
-        if (session.owns(StandardEntitlement.TASK_LIST)) {
-            
recent.addAll(session.getService(ReportService.class).listRecentExecutions(10));
-        }
-        if (session.owns(StandardEntitlement.REPORT_LIST)) {
-            
recent.addAll(session.getService(TaskService.class).listRecentExecutions(10));
-        }
+    private final ReportRestClient reportRestClient = new ReportRestClient();
 
-        return recent;
-    }
+    private final WebMarkupContainer container;
 
     private final List<JobTO> available;
 
@@ -176,7 +143,7 @@ public class JobWidget extends BaseWidget {
         add(detailModal);
         detailModal.setWindowClosedCallback(new 
ModalWindow.WindowClosedCallback() {
 
-            private static final long serialVersionUID = 1L;
+            private static final long serialVersionUID = 8804221891699487139L;
 
             @Override
             public void onClose(final AjaxRequestTarget target) {
@@ -187,7 +154,7 @@ public class JobWidget extends BaseWidget {
         add(reportModal);
         reportModal.setWindowClosedCallback(new 
ModalWindow.WindowClosedCallback() {
 
-            private static final long serialVersionUID = 1L;
+            private static final long serialVersionUID = 8804221891699487139L;
 
             @Override
             public void onClose(final AjaxRequestTarget target) {
@@ -197,10 +164,72 @@ public class JobWidget extends BaseWidget {
 
         reportModal.size(Modal.Size.Large);
 
-        available = getAvailable(SyncopeConsoleSession.get());
-        recent = getRecent(SyncopeConsoleSession.get());
+        available = getUpdatedAvailable();
+        recent = getUpdatedRecent();
+
+        container = new WebMarkupContainer("jobContainer");
+        container.add(new IndicatorAjaxTimerBehavior(Duration.seconds(10)) {
+
+            private static final long serialVersionUID = 7298597675929755960L;
+
+            @Override
+            protected void onTimer(final AjaxRequestTarget target) {
+                List<JobTO> updatedAvailable = getUpdatedAvailable();
+                if (!updatedAvailable.equals(available)) {
+                    available.clear();
+                    available.addAll(updatedAvailable);
+                    if (availableJobsPanel != null) {
+                        availableJobsPanel.modelChanged();
+                        target.add(availableJobsPanel);
+                    }
+                }
+
+                List<ExecTO> updatedRecent = getUpdatedRecent();
+                if (!updatedRecent.equals(recent)) {
+                    recent.clear();
+                    recent.addAll(updatedRecent);
+                    if (recentExecPanel != null) {
+                        recentExecPanel.modelChanged();
+                        target.add(recentExecPanel);
+                    }
+                }
+            }
+        });
+        add(container);
+
+        container.add(new AjaxBootstrapTabbedPanel<>("tabbedPanel", 
buildTabList(pageRef)));
+    }
+
+    private List<JobTO> getUpdatedAvailable() {
+        List<JobTO> updatedAvailable = new ArrayList<>();
+
+        if 
(SyncopeConsoleSession.get().owns(StandardEntitlement.NOTIFICATION_LIST)) {
+            JobTO notificationJob = notificationRestClient.getJob();
+            if (notificationJob != null) {
+                updatedAvailable.add(notificationJob);
+            }
+        }
+        if (SyncopeConsoleSession.get().owns(StandardEntitlement.TASK_LIST)) {
+            updatedAvailable.addAll(taskRestClient.listJobs());
+        }
+        if (SyncopeConsoleSession.get().owns(StandardEntitlement.REPORT_LIST)) 
{
+            updatedAvailable.addAll(reportRestClient.listJobs());
+        }
+
+        return updatedAvailable;
+    }
+
+    private List<ExecTO> getUpdatedRecent() {
+        List<ExecTO> updatedRecent = new ArrayList<>();
+
+        if (SyncopeConsoleSession.get().owns(StandardEntitlement.TASK_LIST)) {
+            updatedRecent.addAll(taskRestClient.listRecentExecutions(10));
+        }
+        if (SyncopeConsoleSession.get().owns(StandardEntitlement.REPORT_LIST)) 
{
+            updatedRecent.addAll(reportRestClient.listRecentExecutions(10));
+        }
 
-        add(new AjaxBootstrapTabbedPanel<>("tabbedPanel", 
buildTabList(pageRef)));
+        return updatedRecent;
     }
 
     private List<ITab> buildTabList(final PageReference pageRef) {
@@ -235,32 +264,9 @@ public class JobWidget extends BaseWidget {
 
     @Override
     public void onEvent(final IEvent<?> event) {
-        if (event.getPayload() instanceof WebSocketPushPayload) {
-            WebSocketPushPayload wsEvent = (WebSocketPushPayload) 
event.getPayload();
-            if (wsEvent.getMessage() instanceof JobWidgetMessage) {
-                List<JobTO> updatedAvailable = ((JobWidgetMessage) 
wsEvent.getMessage()).getUpdatedAvailable();
-                if (!updatedAvailable.equals(available)) {
-                    available.clear();
-                    available.addAll(updatedAvailable);
-                    if (availableJobsPanel != null) {
-                        availableJobsPanel.modelChanged();
-                        wsEvent.getHandler().add(availableJobsPanel);
-                    }
-                }
-
-                List<ExecTO> updatedRecent = ((JobWidgetMessage) 
wsEvent.getMessage()).getUpdatedRecent();
-                if (!updatedRecent.equals(recent)) {
-                    recent.clear();
-                    recent.addAll(updatedRecent);
-                    if (recentExecPanel != null) {
-                        recentExecPanel.modelChanged();
-                        wsEvent.getHandler().add(recentExecPanel);
-                    }
-                }
-            }
-        } else if (event.getPayload() instanceof 
JobActionPanel.JobActionPayload) {
+        if (event.getPayload() instanceof JobActionPanel.JobActionPayload) {
             available.clear();
-            available.addAll(getAvailable(SyncopeConsoleSession.get()));
+            available.addAll(getUpdatedAvailable());
             availableJobsPanel.modelChanged();
             
JobActionPanel.JobActionPayload.class.cast(event.getPayload()).getTarget().add(availableJobsPanel);
         }
@@ -497,60 +503,4 @@ public class JobWidget extends BaseWidget {
             return new CompoundPropertyModel<>(object);
         }
     }
-
-    public static final class JobInfoUpdater implements Runnable {
-
-        private final Application application;
-
-        private final SyncopeConsoleSession session;
-
-        private final IKey key;
-
-        public JobInfoUpdater(final ConnectedMessage message) {
-            this.application = message.getApplication();
-            this.session = SyncopeConsoleSession.get();
-            this.key = message.getKey();
-        }
-
-        @Override
-        public void run() {
-            try {
-                ThreadContext.setApplication(application);
-                ThreadContext.setSession(session);
-
-                WebSocketSettings webSocketSettings = 
WebSocketSettings.Holder.get(application);
-                WebSocketPushBroadcaster broadcaster = new 
WebSocketPushBroadcaster(webSocketSettings.
-                        getConnectionRegistry());
-                broadcaster.broadcast(
-                        new ConnectedMessage(application, session.getId(), 
key),
-                        new JobWidgetMessage(getAvailable(session), 
getRecent(session)));
-            } catch (Throwable t) {
-                LOG.error("Unexpected error while checking for updated Job 
info", t);
-            } finally {
-                ThreadContext.detach();
-            }
-        }
-    }
-
-    private static class JobWidgetMessage implements IWebSocketPushMessage, 
Serializable {
-
-        private static final long serialVersionUID = -824793424112532838L;
-
-        private final List<JobTO> updatedAvailable;
-
-        private final List<ExecTO> updatedRecent;
-
-        JobWidgetMessage(final List<JobTO> updatedAvailable, final 
List<ExecTO> updatedRecent) {
-            this.updatedAvailable = updatedAvailable;
-            this.updatedRecent = updatedRecent;
-        }
-
-        public List<JobTO> getUpdatedAvailable() {
-            return updatedAvailable;
-        }
-
-        public List<ExecTO> getUpdatedRecent() {
-            return updatedRecent;
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/247868da/client/console/src/main/java/org/apache/syncope/client/console/widgets/ReconciliationWidget.java
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/widgets/ReconciliationWidget.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/widgets/ReconciliationWidget.java
index 27ec099..ab7dc32 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/widgets/ReconciliationWidget.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/widgets/ReconciliationWidget.java
@@ -21,7 +21,6 @@ package org.apache.syncope.client.console.widgets;
 import 
de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -45,6 +44,7 @@ import org.apache.syncope.client.console.pages.BasePage;
 import org.apache.syncope.client.console.panels.DirectoryPanel;
 import org.apache.syncope.client.console.rest.BaseRestClient;
 import org.apache.syncope.client.console.rest.ReportRestClient;
+import 
org.apache.syncope.client.console.wicket.ajax.IndicatorAjaxTimerBehavior;
 import 
org.apache.syncope.client.console.wicket.ajax.markup.html.IndicatorAjaxLink;
 import 
org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
 import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
@@ -62,15 +62,11 @@ import org.apache.syncope.common.lib.to.ReportTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.ReportExecExportFormat;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
-import org.apache.syncope.common.rest.api.service.ReportService;
-import org.apache.wicket.Application;
 import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.Component;
 import org.apache.wicket.PageReference;
-import org.apache.wicket.ThreadContext;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import 
org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
-import org.apache.wicket.event.IEvent;
 import 
org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
 import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder;
 import 
org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
@@ -86,12 +82,7 @@ import org.apache.wicket.model.CompoundPropertyModel;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.Model;
 import org.apache.wicket.model.ResourceModel;
-import org.apache.wicket.protocol.ws.WebSocketSettings;
-import org.apache.wicket.protocol.ws.api.WebSocketPushBroadcaster;
-import org.apache.wicket.protocol.ws.api.event.WebSocketPushPayload;
-import org.apache.wicket.protocol.ws.api.message.ConnectedMessage;
-import org.apache.wicket.protocol.ws.api.message.IWebSocketPushMessage;
-import org.apache.wicket.protocol.ws.api.registry.IKey;
+import org.apache.wicket.util.time.Duration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -111,18 +102,58 @@ public class ReconciliationWidget extends BaseWidget {
 
     private final ReportRestClient restClient = new ReportRestClient();
 
+    private final WebMarkupContainer container;
+
     private final WebMarkupContainer overlay;
 
+    private boolean checkReconciliationJob = false;
+
     public ReconciliationWidget(final String id, final PageReference pageRef) {
         super(id);
         this.pageRef = pageRef;
         setOutputMarkupId(true);
         add(detailsModal);
 
+        container = new WebMarkupContainer("reconciliationContainer");
+        container.add(new IndicatorAjaxTimerBehavior(Duration.seconds(10)) {
+
+            private static final long serialVersionUID = 7298597675929755960L;
+
+            @Override
+            protected void onTimer(final AjaxRequestTarget target) {
+                if (isCheckReconciliationJob()) {
+                    try {
+                        JobTO reportJobTO = 
IterableUtils.find(restClient.listJobs(), new Predicate<JobTO>() {
+
+                            @Override
+                            public boolean evaluate(final JobTO jobTO) {
+                                return SyncopeConsoleApplication.get().
+                                        
getReconciliationReportKey().equals(jobTO.getRefKey());
+                            }
+                        });
+                        if (reportJobTO != null && !reportJobTO.isRunning()) {
+                            LOG.debug("Report {} is not running",
+                                    
SyncopeConsoleApplication.get().getReconciliationReportKey());
+
+                            overlay.setVisible(false);
+
+                            container.addOrReplace(buildExecFragment());
+
+                            target.add(ReconciliationWidget.this);
+                            setCheckReconciliationJob(false);
+                        }
+                    } catch (Throwable t) {
+                        LOG.error("Unexpected error while checking for updated 
reconciliation job info", t);
+                    }
+                }
+            }
+        });
+        add(container);
+
         overlay = new WebMarkupContainer("overlay");
         overlay.setOutputMarkupPlaceholderTag(true);
         overlay.setVisible(false);
-        add(overlay);
+        container.add(overlay);
 
         this.reconciliationReportKey = 
SyncopeConsoleApplication.get().getReconciliationReportKey();
 
@@ -140,7 +171,7 @@ public class ReconciliationWidget extends BaseWidget {
                 ? new Fragment("reportResult", "noExecFragment", this)
                 : buildExecFragment();
         reportResult.setOutputMarkupId(true);
-        add(reportResult);
+        container.add(reportResult);
 
         IndicatorAjaxLink<Void> refresh = new 
IndicatorAjaxLink<Void>("refresh") {
 
@@ -154,7 +185,7 @@ public class ReconciliationWidget extends BaseWidget {
                     overlay.setVisible(true);
                     target.add(ReconciliationWidget.this);
 
-                    
SyncopeConsoleSession.get().setCheckReconciliationJob(true);
+                    setCheckReconciliationJob(true);
 
                     
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                 } catch (Exception e) {
@@ -165,7 +196,15 @@ public class ReconciliationWidget extends BaseWidget {
             }
         };
         MetaDataRoleAuthorizationStrategy.authorize(refresh, Component.RENDER, 
StandardEntitlement.REPORT_EXECUTE);
-        add(refresh);
+        container.add(refresh);
+    }
+
+    private boolean isCheckReconciliationJob() {
+        return checkReconciliationJob;
+    }
+
+    private void setCheckReconciliationJob(final boolean 
checkReconciliationJob) {
+        this.checkReconciliationJob = checkReconciliationJob;
     }
 
     private Fragment buildExecFragment() {
@@ -285,24 +324,7 @@ public class ReconciliationWidget extends BaseWidget {
         return Pair.of(beans, report == null ? new ReconciliationReport(new 
Date()) : report);
     }
 
-    @Override
-    public void onEvent(final IEvent<?> event) {
-        if (event.getPayload() instanceof WebSocketPushPayload) {
-            WebSocketPushPayload wsEvent = (WebSocketPushPayload) 
event.getPayload();
-            if (wsEvent.getMessage() instanceof 
ReconciliationJobNotRunningMessage) {
-                overlay.setVisible(false);
-
-                addOrReplace(buildExecFragment());
-
-                wsEvent.getHandler().add(ReconciliationWidget.this);
-
-                SyncopeConsoleSession.get().setCheckReconciliationJob(false);
-            }
-        }
-    }
-
-    private class AnysReconciliationPanel extends DirectoryPanel<
-        Any, Any, AnysReconciliationProvider, BaseRestClient> {
+    private class AnysReconciliationPanel extends DirectoryPanel<Any, Any, 
AnysReconciliationProvider, BaseRestClient> {
 
         private static final long serialVersionUID = -8214546246301342868L;
 
@@ -408,29 +430,29 @@ public class ReconciliationWidget extends BaseWidget {
                         }, new ArrayList<Misaligned>());
                         Component content = missing == null
                                 ? misaligned == null || misaligned.isEmpty()
-                                        ? new Label(componentId, 
StringUtils.EMPTY)
-                                        : 
ActionLinksPanel.<Any>builder().add(new ActionLink<Any>() {
-
-                                            private static final long 
serialVersionUID = -3722207913631435501L;
-
-                                            @Override
-                                            public void onClick(final 
AjaxRequestTarget target, final Any ignore) {
-                                                modal.header(Model.of(
-                                                        
rowModel.getObject().getType()
-                                                        + " " + 
rowModel.getObject().getKey()
-                                                        + " " + 
rowModel.getObject().getName()));
-                                                modal.setContent(new 
ReconciliationDetailsModalPanel(
-                                                        modal,
-                                                        resource,
-                                                        misaligned,
-                                                        
ReconciliationWidget.this.pageRef));
-                                                modal.show(true);
-                                                target.add(modal);
-                                            }
-                                        }, ActionLink.ActionType.VIEW).
+                                ? new Label(componentId, StringUtils.EMPTY)
+                                : ActionLinksPanel.<Any>builder().add(new 
ActionLink<Any>() {
+
+                                    private static final long serialVersionUID 
= -3722207913631435501L;
+
+                                    @Override
+                                    public void onClick(final 
AjaxRequestTarget target, final Any ignore) {
+                                        modal.header(Model.of(
+                                                rowModel.getObject().getType()
+                                                + " " + 
rowModel.getObject().getKey()
+                                                + " " + 
rowModel.getObject().getName()));
+                                        modal.setContent(new 
ReconciliationDetailsModalPanel(
+                                                modal,
+                                                resource,
+                                                misaligned,
+                                                
ReconciliationWidget.this.pageRef));
+                                        modal.show(true);
+                                        target.add(modal);
+                                    }
+                                }, ActionLink.ActionType.VIEW).
                                         build(componentId)
                                 : ActionLinksPanel.<Any>builder().add(null, 
ActionLink.ActionType.NOT_FOND).
-                                build(componentId);
+                                        build(componentId);
                         cellItem.add(content);
                         cellItem.add(new AttributeModifier("class", 
"text-center"));
                     }
@@ -472,61 +494,4 @@ public class ReconciliationWidget extends BaseWidget {
             return new CompoundPropertyModel<>(object);
         }
     }
-
-    public static final class ReconciliationJobInfoUpdater implements Runnable 
{
-
-        private final String applicationName;
-
-        private final SyncopeConsoleSession session;
-
-        private final IKey key;
-
-        public ReconciliationJobInfoUpdater(final ConnectedMessage message) {
-            this.applicationName = message.getApplication().getName();
-            this.session = SyncopeConsoleSession.get();
-            this.key = message.getKey();
-        }
-
-        @Override
-        public void run() {
-            if (session.isCheckReconciliationJob()) {
-                try {
-                    final Application application = 
Application.get(applicationName);
-                    ThreadContext.setApplication(application);
-                    ThreadContext.setSession(session);
-
-                    JobTO reportJobTO = 
IterableUtils.find(session.getService(ReportService.class).listJobs(),
-                            new Predicate<JobTO>() {
-
-                        @Override
-                        public boolean evaluate(final JobTO jobTO) {
-                            return 
SyncopeConsoleApplication.class.cast(application).
-                                    
getReconciliationReportKey().equals(jobTO.getRefKey());
-                        }
-                    });
-                    if (reportJobTO != null && !reportJobTO.isRunning()) {
-                        LOG.debug("Report {} is not running",
-                                
SyncopeConsoleApplication.class.cast(application).getReconciliationReportKey());
-
-                        WebSocketSettings webSocketSettings = 
WebSocketSettings.Holder.get(application);
-                        WebSocketPushBroadcaster broadcaster = new 
WebSocketPushBroadcaster(webSocketSettings.
-                                getConnectionRegistry());
-                        broadcaster.broadcast(
-                                new ConnectedMessage(application, 
session.getId(), key),
-                                new ReconciliationJobNotRunningMessage());
-                    }
-                } catch (Throwable t) {
-                    LOG.error("Unexpected error while checking for updated 
reconciliation job info", t);
-                } finally {
-                    ThreadContext.detach();
-                }
-            }
-        }
-    }
-
-    private static class ReconciliationJobNotRunningMessage implements 
IWebSocketPushMessage, Serializable {
-
-        private static final long serialVersionUID = -824793424112532838L;
-
-    }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/247868da/client/console/src/main/resources/org/apache/syncope/client/console/widgets/JobWidget.html
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/resources/org/apache/syncope/client/console/widgets/JobWidget.html
 
b/client/console/src/main/resources/org/apache/syncope/client/console/widgets/JobWidget.html
index a062133..3b359b6 100644
--- 
a/client/console/src/main/resources/org/apache/syncope/client/console/widgets/JobWidget.html
+++ 
b/client/console/src/main/resources/org/apache/syncope/client/console/widgets/JobWidget.html
@@ -18,7 +18,7 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml"; 
xmlns:wicket="http://wicket.apache.org";>
   <wicket:panel>
-    <div class="box box-default box-solid">
+    <div class="box box-default box-solid" wicket:id="jobContainer">
       <div class="box-header with-border">
         <h3 class="box-title"><wicket:message key="jobs"/></h3>
         <div class="box-tools pull-right">
@@ -29,6 +29,7 @@ under the License.
         <div class="box-body" wicket:id="tabbedPanel"/>
       </div>
     </div>
+
     <div wicket:id="modal"/>
     <div wicket:id="detailModal"/>
     <div wicket:id="reportModal"/>

http://git-wip-us.apache.org/repos/asf/syncope/blob/247868da/client/console/src/main/resources/org/apache/syncope/client/console/widgets/ReconciliationWidget.html
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/resources/org/apache/syncope/client/console/widgets/ReconciliationWidget.html
 
b/client/console/src/main/resources/org/apache/syncope/client/console/widgets/ReconciliationWidget.html
index 30a980a..3171285 100644
--- 
a/client/console/src/main/resources/org/apache/syncope/client/console/widgets/ReconciliationWidget.html
+++ 
b/client/console/src/main/resources/org/apache/syncope/client/console/widgets/ReconciliationWidget.html
@@ -18,7 +18,7 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml"; 
xmlns:wicket="http://wicket.apache.org";>
   <wicket:panel>
-    <div class="box box-default box-solid">
+    <div class="box box-default box-solid" wicket:id="reconciliationContainer">
       <div class="box-header with-border">
         <h3 class="box-title"><wicket:message key="reconciliationStatus"/></h3>
         <div class="box-tools pull-right">
@@ -35,21 +35,20 @@ under the License.
       </div>
       <div class="box-body">
         <div wicket:id="reportResult"/>
-
-        <wicket:fragment wicket:id="noExecFragment">
-          <wicket:message key="nothingToShow"/>
-        </wicket:fragment>
-
-        <wicket:fragment wicket:id="execFragment">
-          <div wicket:id="execResult"/>
-        </wicket:fragment>
-
       </div>
       <div wicket:id="overlay" class="overlay">
         <i class="fa fa-refresh fa-spin"></i>
       </div>
     </div>
 
+    <wicket:fragment wicket:id="noExecFragment">
+      <wicket:message key="nothingToShow"/>
+    </wicket:fragment>
+
+    <wicket:fragment wicket:id="execFragment">
+      <div wicket:id="execResult"/>
+    </wicket:fragment>
+
     <div wicket:id="detailsModal"/>
   </wicket:panel>
 </html>

Reply via email to