added session validation to rename, share/unshare, move

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@90086 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2014-01-14 13:41:03 +00:00
parent 62fc62aed3
commit 1d09622dd4
3 changed files with 56 additions and 10 deletions

View File

@ -130,6 +130,7 @@ import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExterna
import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExternalUrl;
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTImageDocument;
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTUrlDocument;
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
import com.extjs.gxt.ui.client.Registry;
@ -224,6 +225,13 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
public void onFailure(Throwable caught) {
if(caught instanceof SessionExpiredException){
GWT.log("Session expired");
eventBus.fireEvent(new SessionExpiredEvent());
return;
}
new MessageBoxAlert("Error", caught.getMessage(), null);
explorerPanel.getAsycTreePanel().removeAllAndRecoveryRoot();
}
@ -342,6 +350,13 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
public void onFailure(Throwable caught) {
if(caught instanceof SessionExpiredException){
GWT.log("Session expired");
eventBus.fireEvent(new SessionExpiredEvent());
return;
}
new MessageBoxAlert("Error", caught.getMessage(), null);
explorerPanel.unmask();
}
@ -564,6 +579,13 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
public void onFailure(Throwable caught) {
if(caught instanceof SessionExpiredException){
GWT.log("Session expired");
eventBus.fireEvent(new SessionExpiredEvent());
return;
}
new MessageBoxAlert("Error", caught.getMessage(), null);
}
@ -1088,7 +1110,15 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
public void onFailure(Throwable caught) {
explorerPanel.getAsycTreePanel().unmask();
if(caught instanceof SessionExpiredException){
GWT.log("Session expired");
eventBus.fireEvent(new SessionExpiredEvent());
return;
}
new MessageBoxAlert("Error", caught.getMessage(), null);
explorerPanel.getAsycTreePanel().removeAllAndRecoveryRoot();
@ -1313,6 +1343,13 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
public void onFailure(Throwable caught) {
if(caught instanceof SessionExpiredException){
GWT.log("Session expired");
eventBus.fireEvent(new SessionExpiredEvent());
return;
}
new MessageBoxAlert("Error", caught.getMessage()+"." , null);
System.out.println(caught.getMessage());
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(event.getTargetParentFileModel().getIdentifier(), false);

View File

@ -416,11 +416,8 @@ public class AsyncTreePanel extends LayoutContainer {
//REMOVE THIS COMMENT TODO
// eventBus.fireEvent(new MoveItemEvent(listFileModel.get(0), (FolderModel) destination));
eventBus.fireEvent(new MoveItemEvent(listFileModel.get(0), (FolderModel) destination));
System.out.println("Destination: " +destination.getName() + " id "+ destination.getIdentifier());
}
}
@ -459,12 +456,9 @@ public class AsyncTreePanel extends LayoutContainer {
if(destination != null){
System.out.println("Destination: " +destination.getName() + " id "+ destination.getIdentifier());
//REMOVE THIS COMMENT TODO
// eventBus.fireEvent(new MoveItemEvent(listFileModel.get(0), (FolderModel) destination));
eventBus.fireEvent(new MoveItemEvent(listFileModel.get(0), (FolderModel) destination));
}
}

View File

@ -425,6 +425,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
public Boolean moveItem(String itemId, String destinationId) throws Exception {
workspaceLogger.trace("moveItem itemId: "+itemId+" destination: "+destinationId);
if(isSessionExpired())
throw new SessionExpiredException();
try {
Workspace workspace = getWorkspace();
@ -654,6 +657,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override
public Boolean renameItem(String itemId, String newName, String previousName) throws Exception {
if(isSessionExpired())
throw new SessionExpiredException();
try {
if(itemId == null)
@ -1590,6 +1596,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override
public boolean copyItem(String itemId, String destinationFolderId) throws Exception {
if(isSessionExpired())
throw new SessionExpiredException();
try {
Workspace workspace = getWorkspace();
@ -1663,6 +1672,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override
public boolean shareFolder(FileModel folder, List<InfoContactModel> listContacts, boolean isNewFolder) throws Exception {
if(isSessionExpired())
throw new SessionExpiredException();
try {
Workspace workspace = getWorkspace();
@ -1828,6 +1840,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
boolean unShared = false;
if(isSessionExpired())
throw new SessionExpiredException();
workspaceLogger.trace("unSharedFolderByFolderSharedId "+ folderSharedId);
try {