From 8faccb6e463cba1aab8df823a440ffc93a043388 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 30 Sep 2014 12:42:10 +0000 Subject: [PATCH] Fixed Final and Lock error git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-share-widget@100291 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../user/td/sharewidget/client/TRShare.java | 41 ++++++++++++------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/sharewidget/client/TRShare.java b/src/main/java/org/gcube/portlets/user/td/sharewidget/client/TRShare.java index 0375a1f..0c59b1c 100644 --- a/src/main/java/org/gcube/portlets/user/td/sharewidget/client/TRShare.java +++ b/src/main/java/org/gcube/portlets/user/td/sharewidget/client/TRShare.java @@ -4,12 +4,15 @@ import java.util.ArrayList; import java.util.List; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts; import org.gcube.portlets.user.td.gwtservice.shared.share.ShareInfo; import org.gcube.portlets.user.td.sharewidget.client.util.InfoMessageBox; import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.widgets.workspacesharingwidget.client.WorkspaceSmartSharingController; import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.SmartShare; @@ -52,11 +55,15 @@ public class TRShare { new AsyncCallback() { public void onFailure(Throwable caught) { - Log.debug("ShareInfo Error: " - + caught.getLocalizedMessage()); - alert("Error retrienving share info", - "Error retrieving share info"); - + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.debug("ShareInfo Error: " + + caught.getLocalizedMessage()); + alert("Error retrienving share info", + "Error retrieving share info"); + } } public void onSuccess(ShareInfo result) { @@ -83,7 +90,7 @@ public class TRShare { } WorkspaceSmartSharingController controller = new WorkspaceSmartSharingController( - file, listAlreadySharedContact,false,true); + file, listAlreadySharedContact, false, true); final SmartShare sharingWindow = controller.getSharingDialog(); @@ -120,25 +127,29 @@ public class TRShare { new AsyncCallback() { public void onFailure(Throwable caught) { - Log.debug("Share Error: " - + caught.getLocalizedMessage()); - alert("Error sharing tabular resource", - "Error sharing tabular resource: "+caught.getLocalizedMessage()); - + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.debug("Share Error: " + + caught.getLocalizedMessage()); + alert("Error sharing tabular resource", + "Error sharing tabular resource: " + + caught.getLocalizedMessage()); + } } public void onSuccess(Void result) { Log.debug("Tabular Resource Shared: " + shareInfo.getTabResource().getTrId() .toString()); - info("Shared", - "Tabular Resource is shared"); - + info("Shared", "Tabular Resource is shared"); + ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED; ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent( ChangeTableRequestType.SHARE, trId, why); eventBus.fireEvent(changeTableRequestEvent); - + } });