the messages in exceptions event was updated

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@69471 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-02-20 13:51:36 +00:00
parent 8d51f05602
commit 878b111178
2 changed files with 52 additions and 19 deletions

View File

@ -183,7 +183,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR+" un share folder. "+ caught.getMessage() +". " +ConstantsExplorer.TRY_AGAIN, null); new MessageBoxAlert("Error", caught.getMessage(), null);
} }
@ -279,7 +279,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR+" creating shared folder. "+ caught.getMessage(), null); new MessageBoxAlert("Error", caught.getMessage(), null);
explorerPanel.unmask(); explorerPanel.unmask();
} }
@ -424,7 +424,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR +" copying item " + ConstantsExplorer.TRY_AGAIN, null); new MessageBoxAlert("Error", caught.getMessage(), null);
} }
@ -432,7 +432,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
public void onSuccess(Boolean result) { public void onSuccess(Boolean result) {
if(result) if(result)
eventBus.fireEvent(new RefreshFolderEvent(explorerPanel.getAsycTreePanel().getFileModelByIdentifier(pasteItemEvent.getFolderDestinationId()))); eventBus.fireEvent(new RefreshFolderEvent(explorerPanel.getAsycTreePanel().getFileModelByIdentifier(pasteItemEvent.getFolderDestinationId())));
// explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(pasteItemEvent.getFolderDestinationId());
} }
@ -873,7 +872,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
explorerPanel.getAsycTreePanel().unmask(); explorerPanel.getAsycTreePanel().unmask();
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR +" deleting item. "+caught.getMessage()+". Reload root", null); new MessageBoxAlert("Error", caught.getMessage()+". Reload root", null);
explorerPanel.getAsycTreePanel().removeAllAndRecoveryRoot(); explorerPanel.getAsycTreePanel().removeAllAndRecoveryRoot();
} }
@ -1020,7 +1019,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " moving item. "+caught.getMessage()+". Reload root" , null); new MessageBoxAlert("Error", caught.getMessage()+". Reload root" , null);
System.out.println(caught.getMessage()); System.out.println(caught.getMessage());
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(event.getTargetParentFileModel().getIdentifier()); explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(event.getTargetParentFileModel().getIdentifier());
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(event.getFileSourceModel().getParentFileModel().getIdentifier()); explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(event.getFileSourceModel().getParentFileModel().getIdentifier());

View File

@ -17,8 +17,11 @@ import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItem;
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItemType; import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItemType;
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceSharedFolder; import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceSharedFolder;
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceSmartFolder; import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceSmartFolder;
import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.InsufficientPrivilegesException;
import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.ItemAlreadyExistException;
import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.ItemNotFoundException; import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.ItemNotFoundException;
import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException; import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
import org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WrongDestinationException;
import org.gcube.portlets.user.homelibrary.home.workspace.folder.FolderBulkCreator; import org.gcube.portlets.user.homelibrary.home.workspace.folder.FolderBulkCreator;
import org.gcube.portlets.user.homelibrary.home.workspace.folder.FolderItemType; import org.gcube.portlets.user.homelibrary.home.workspace.folder.FolderItemType;
import org.gcube.portlets.user.homelibrary.home.workspace.folder.items.ExternalUrl; import org.gcube.portlets.user.homelibrary.home.workspace.folder.items.ExternalUrl;
@ -26,6 +29,7 @@ import org.gcube.portlets.user.homelibrary.home.workspace.folder.items.ts.TimeSe
import org.gcube.portlets.user.homelibrary.home.workspace.search.SearchItem; import org.gcube.portlets.user.homelibrary.home.workspace.search.SearchItem;
import org.gcube.portlets.user.homelibrary.home.workspace.sharing.WorkspaceMessage; import org.gcube.portlets.user.homelibrary.home.workspace.sharing.WorkspaceMessage;
import org.gcube.portlets.user.opengcubeapplication.ApplicationReaderFromGenericResource; import org.gcube.portlets.user.opengcubeapplication.ApplicationReaderFromGenericResource;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.interfaces.GXTCategoryItemInterface; import org.gcube.portlets.user.workspace.client.interfaces.GXTCategoryItemInterface;
import org.gcube.portlets.user.workspace.client.model.BulkCreatorModel; import org.gcube.portlets.user.workspace.client.model.BulkCreatorModel;
import org.gcube.portlets.user.workspace.client.model.FileDetailsModel; import org.gcube.portlets.user.workspace.client.model.FileDetailsModel;
@ -282,11 +286,15 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
workspace.moveItem(itemId, destinationId); workspace.moveItem(itemId, destinationId);
return Boolean.TRUE; return Boolean.TRUE;
}catch (InsufficientPrivilegesException e) {
workspaceLogger.error("Error in server Item move", e);
String error = "An error occurred on moving item. "+e.getMessage();
throw new Exception(error);
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in server Item move", e); workspaceLogger.error("Error in server Item move", e);
// workspaceLogger.trace("Error in server Item move " + e); String error = ConstantsExplorer.SERVER_ERROR + " moving item. "+e.getMessage();
//GWT can't serialize all exceptions throw new Exception(error);
throw new Exception(e.getMessage());
} }
} }
@ -303,11 +311,15 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
workspace.removeItem(itemId); workspace.removeItem(itemId);
return Boolean.TRUE; return Boolean.TRUE;
} catch (InsufficientPrivilegesException e) {
workspaceLogger.error("Error in server Item remove", e);
String error = "An error occurred on deleting item. "+e.getMessage();
throw new Exception(error);
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in server Item remove", e); workspaceLogger.error("Error in server Item remove", e);
// workspaceLogger.trace("Error in server Item remove " + e); String error = ConstantsExplorer.SERVER_ERROR +" deleting item. "+e.getMessage();
//GWT can't serialize all exceptions throw new Exception(error);
throw new Exception(e.getMessage());
} }
} }
@ -329,8 +341,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in server Item rename", e); workspaceLogger.error("Error in server Item rename", e);
// workspaceLogger.trace("Error in server Item rename " + e);
//GWT can't serialize all exceptions
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
} }
@ -1265,12 +1275,14 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
return true; return true;
return false; return false;
}catch (InsufficientPrivilegesException e) {
String error = "An error occurred on copying item " +e.getMessage() + ". "+ConstantsExplorer.TRY_AGAIN;
throw new Exception(error);
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in server copyItem by id", e); workspaceLogger.error("Error in server copyItem by id", e);
// workspaceLogger.trace("Error in server copyItem by id " + e); String error = ConstantsExplorer.SERVER_ERROR +" copying item " + ConstantsExplorer.TRY_AGAIN;
throw new Exception(error);
throw new Exception(e.getMessage());
} }
} }
@ -1363,10 +1375,26 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
return created; return created;
} catch (InsufficientPrivilegesException e) {
workspaceLogger.error("Error in shareFolder ", e);
String error = "An error occurred on creating shared folder. "+ e.getMessage();
throw new Exception(error);
} catch (ItemAlreadyExistException e) {
workspaceLogger.error("Error in shareFolder ", e);
String error = "An error occurred on creating shared folder. "+ e.getMessage();
throw new Exception(error);
} catch (WrongDestinationException e) {
workspaceLogger.error("Error in shareFolder ", e);
String error = "An error occurred on creating shared folder. "+ e.getMessage();
throw new Exception(error);
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in shareFolder ", e); workspaceLogger.error("Error in shareFolder ", e);
e.printStackTrace(); e.printStackTrace();
throw new Exception(e.getMessage()); String error = ConstantsExplorer.SERVER_ERROR+" creating shared folder. "+ e.getMessage();
throw new Exception(error);
} }
} }
@ -1442,10 +1470,16 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
else else
workspaceLogger.trace("the item with id: "+folderSharedId+ "is not "+WorkspaceItemType.SHARED_FOLDER); workspaceLogger.trace("the item with id: "+folderSharedId+ "is not "+WorkspaceItemType.SHARED_FOLDER);
} catch (InsufficientPrivilegesException e) {
workspaceLogger.error("Error in unSharedFolderByFolderSharedId ", e);
String error = "An error occerred on unsharing folder. "+ e.getMessage();
throw new Exception(error);
} catch (Exception e) { } catch (Exception e) {
workspaceLogger.error("Error in unSharedFolderByFolderSharedId ", e); workspaceLogger.error("Error in unSharedFolderByFolderSharedId ", e);
String error = ConstantsExplorer.SERVER_ERROR+" un share folder. "+ e.getMessage() +". " +ConstantsExplorer.TRY_AGAIN;
e.printStackTrace(); e.printStackTrace();
throw new Exception(e.getMessage()); throw new Exception(error);
} }
return unShared; return unShared;