Feature #17091: Reconsider error message when deleting a shared folder
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@181180 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7c9db3a9b0
commit
b8754eba24
|
@ -5,6 +5,9 @@
|
|||
<Change>[Task #17135] Workspace: assign the file extension during the
|
||||
download
|
||||
</Change>
|
||||
<Change>[Feature #17091] Reconsider error message when deleting a
|
||||
shared folder
|
||||
</Change>
|
||||
</Changeset>
|
||||
<Changeset
|
||||
component="org.gcube.portlets-user.workspace-portlet-tree.6-25-1"
|
||||
|
|
|
@ -2330,7 +2330,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
@Override
|
||||
public Boolean deleteItem(String itemId) throws Exception {
|
||||
|
||||
boolean sourceItemIsShared = false;
|
||||
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem theItem = null;
|
||||
try {
|
||||
|
||||
if (itemId == null)
|
||||
|
@ -2339,12 +2339,11 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
checkItemLocked(itemId);
|
||||
|
||||
org.gcube.common.storagehubwrapper.server.tohl.Workspace workspaceSH = getWorkspaceFromStorageHub();
|
||||
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem theItem = workspaceSH.getItem(itemId);
|
||||
sourceItemIsShared = theItem.isShared();
|
||||
theItem = workspaceSH.getItem(itemId);
|
||||
String itemName = theItem.getName();
|
||||
String sourceFolderSharedId = null;
|
||||
|
||||
if (sourceItemIsShared) {
|
||||
if (theItem.isShared()) {
|
||||
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem rootSharedFolder = workspaceSH
|
||||
.getRootSharedFolder(itemId);
|
||||
sourceFolderSharedId = rootSharedFolder.getId();
|
||||
|
@ -2355,7 +2354,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
workspaceSH.deleteItem(itemId);
|
||||
|
||||
if (sourceFolderSharedId != null)
|
||||
NotificationsUtil.checkSendNotifyRemoveItemToShare(this.getThreadLocalRequest(), sourceItemIsShared,
|
||||
NotificationsUtil.checkSendNotifyRemoveItemToShare(this.getThreadLocalRequest(), theItem.isShared(),
|
||||
itemName, itemId, sourceFolderSharedId);
|
||||
|
||||
return Boolean.TRUE;
|
||||
|
@ -2381,8 +2380,12 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
} catch (Exception e) {
|
||||
workspaceLogger.error("Remoing item error:", e);
|
||||
StringBuilder error = new StringBuilder();
|
||||
if(sourceItemIsShared) {
|
||||
error.append("Ops! This operation is not allowed, we're working hard to make this possible soon.");
|
||||
if(theItem!=null && theItem.isShared()) {
|
||||
if(theItem.isFolder()) {
|
||||
error.append("Deleting shared folders is not supported. Please unshare it if you are willing to no longer share its content to your coworkers.");
|
||||
}else {
|
||||
error.append("Ops! This operation is not allowed, we're working hard to make this possible soon.");
|
||||
}
|
||||
throw new SHUBOperationNotAllowedException(error.toString());
|
||||
}else {
|
||||
error.append("Ops an error occurred deleting the item! Either you have not the permission to delete it or a server error occurred. Please, refresh and try again");
|
||||
|
|
Loading…
Reference in New Issue