[Task #12910] completed
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@179190 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
16bcb87124
commit
0feb1f5ead
|
@ -1,9 +1,11 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset
|
||||
component="org.gcube.portlets-user.workspace-portlet-tree.6-25-0"
|
||||
date="2019-02-04">
|
||||
date="${buildDate}">
|
||||
<Change>Updated to StorageHub [ticket: #13226]</Change>
|
||||
<Change>[Support #16430] fixed</Change>
|
||||
<Change>[Task #12910] Rename and delete operations on shared folder
|
||||
should be managed by dedicated message on WS-side</Change>
|
||||
</Changeset>
|
||||
<Changeset
|
||||
component="org.gcube.portlets-user.workspace-portlet-tree.6-24-1"
|
||||
|
|
|
@ -141,6 +141,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.SHUBOperationNotAllowedException;
|
||||
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
||||
import org.gcube.portlets.user.workspace.shared.UserBean;
|
||||
import org.gcube.portlets.user.workspace.shared.WorkspaceOperationResult;
|
||||
|
@ -212,7 +213,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
private WsThreddsWidget wsThreddsWidget = new WsThreddsWidget();
|
||||
private WsTaskExecutorWidget taskExecutor = new WsTaskExecutorWidget();
|
||||
|
||||
private int waitTiming = 3000;
|
||||
public static final int delayTime = 3000;
|
||||
|
||||
/**
|
||||
* Instantiates a new app controller explorer.
|
||||
|
@ -559,20 +560,20 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
GWT.log("Waiting " + waitTiming);
|
||||
GWT.log("Waiting " + delayTime);
|
||||
if (result) { // REFRESH PARENT
|
||||
// FOLDER
|
||||
Timer t = new Timer() {
|
||||
@Override
|
||||
public void run() {
|
||||
GWT.log("Runing refresh after wait: " + waitTiming);
|
||||
GWT.log("Runing refresh after wait: " + delayTime);
|
||||
eventBus.fireEvent(new RefreshFolderEvent(
|
||||
source.getParentFileModel(), true, true, false));
|
||||
explorerPanel.getAsycTreePanel().unmask();
|
||||
}
|
||||
};
|
||||
|
||||
t.schedule(waitTiming);
|
||||
t.schedule(delayTime);
|
||||
} else
|
||||
explorerPanel.getAsycTreePanel().unmask();
|
||||
}
|
||||
|
@ -820,7 +821,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
GWT.log("Runing refresh after wait: " + waitTiming); // TODO
|
||||
GWT.log("Runing refresh after wait: " + delayTime); // TODO
|
||||
FileModel parentToRefresh = null;
|
||||
|
||||
if (isNewFolder)
|
||||
|
@ -841,7 +842,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
}
|
||||
};
|
||||
|
||||
t.schedule(waitTiming);
|
||||
t.schedule(delayTime);
|
||||
|
||||
}
|
||||
explorerPanel.unmask();
|
||||
|
@ -1684,8 +1685,12 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
eventBus.fireEvent(new SessionExpiredEvent());
|
||||
return;
|
||||
}
|
||||
|
||||
new MessageBoxAlert("Error", caught.getMessage(), null);
|
||||
|
||||
if(caught instanceof SHUBOperationNotAllowedException) {
|
||||
MessageBox.info("Operation not allowed...", caught.getMessage(), null).show();
|
||||
}else {
|
||||
new MessageBoxAlert("Error", caught.getMessage(), null);
|
||||
}
|
||||
explorerPanel.getAsycTreePanel().removeAllAndRecoveryRoot();
|
||||
|
||||
}
|
||||
|
@ -1743,8 +1748,15 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
||||
explorerPanel.getAsycTreePanel().unmask();
|
||||
new MessageBoxAlert("Error", caught.getMessage(), null);
|
||||
|
||||
if(caught instanceof SHUBOperationNotAllowedException) {
|
||||
MessageBox.info("Operation not allowed...", caught.getMessage(), null).show();
|
||||
}else {
|
||||
new MessageBoxAlert("Error", caught.getMessage(), null);
|
||||
}
|
||||
|
||||
explorerPanel.getAsycTreePanel().removeAllAndRecoveryRoot();
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.extjs.gxt.ui.client.widget.VerticalPanel;
|
|||
import com.extjs.gxt.ui.client.widget.form.TextField;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
/**
|
||||
|
@ -260,8 +261,17 @@ public class DialogGetLink extends Dialog {
|
|||
txtCompleteURL.setValue(publicLink.getCompleteURL());
|
||||
txtShortURL.setValue(publicLink.getShortURL());
|
||||
selectTxt();
|
||||
AppControllerExplorer.getEventBus()
|
||||
|
||||
Timer t = new Timer() {
|
||||
@Override
|
||||
public void run() {
|
||||
GWT.log("Runing refresh after wait: " + AppControllerExplorer.delayTime);
|
||||
AppControllerExplorer.getEventBus()
|
||||
.fireEvent(new RefreshFolderEvent(item.getParentFileModel(), true, false, false));
|
||||
}
|
||||
};
|
||||
|
||||
t.schedule(AppControllerExplorer.delayTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -80,6 +80,7 @@ import org.gcube.portlets.user.workspace.server.util.resource.PropertySpecialFol
|
|||
import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter;
|
||||
import org.gcube.portlets.user.workspace.shared.GarbageItem;
|
||||
import org.gcube.portlets.user.workspace.shared.PublicLink;
|
||||
import org.gcube.portlets.user.workspace.shared.SHUBOperationNotAllowedException;
|
||||
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
||||
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
||||
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
||||
|
@ -2440,6 +2441,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
@Override
|
||||
public Boolean deleteItem(String itemId) throws Exception {
|
||||
|
||||
boolean sourceItemIsShared = false;
|
||||
try {
|
||||
|
||||
if (itemId == null)
|
||||
|
@ -2449,7 +2451,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
|
||||
org.gcube.common.storagehubwrapper.server.tohl.Workspace workspaceSH = getWorkspaceFromStorageHub();
|
||||
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem theItem = workspaceSH.getItem(itemId);
|
||||
boolean sourceItemIsShared = theItem.isShared();
|
||||
sourceItemIsShared = theItem.isShared();
|
||||
String itemName = theItem.getName();
|
||||
String sourceFolderSharedId = null;
|
||||
|
||||
|
@ -2482,9 +2484,15 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
workspaceLogger.error(error, e);
|
||||
throw new Exception(error);
|
||||
} catch (Exception e) {
|
||||
workspaceLogger.error("Remove item error.", e);
|
||||
String error = "Error on deleting. Either the item is shared, unshare it and try to delete again or you have not the permission to delete the item";
|
||||
throw new Exception(error);
|
||||
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.");
|
||||
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");
|
||||
throw new Exception(error.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3301,6 +3309,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
if (isSessionExpired())
|
||||
throw new SessionExpiredException();
|
||||
|
||||
boolean sourceItemIsShared = false;
|
||||
try {
|
||||
|
||||
if (itemId == null)
|
||||
|
@ -3311,11 +3320,16 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
org.gcube.common.storagehubwrapper.server.tohl.Workspace workspace = getWorkspaceFromStorageHub();
|
||||
workspaceLogger.debug("Renaming item with id: " + itemId + " from old name " + previousName
|
||||
+ ", to new name: " + newName);
|
||||
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wsItem = workspace.renameItem(itemId, newName);
|
||||
|
||||
//Needed to check if the item is shared
|
||||
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wsItem = workspace.getItem(itemId);
|
||||
sourceItemIsShared = wsItem.isShared();
|
||||
|
||||
wsItem = workspace.renameItem(itemId, newName);
|
||||
workspaceLogger.debug("Item renamed is: " + wsItem);
|
||||
|
||||
// SEND NOTIFY?
|
||||
if (wsItem.isShared()) {
|
||||
if (sourceItemIsShared) {
|
||||
|
||||
try {
|
||||
List<InfoContactModel> listSharedContact = new ArrayList<InfoContactModel>();
|
||||
|
@ -3379,9 +3393,16 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
workspaceLogger.error(error, e2);
|
||||
throw new Exception(error);
|
||||
} catch (Exception e) {
|
||||
String error = ConstantsExplorer.SERVER_ERROR + " renaming item. " + ConstantsExplorer.TRY_AGAIN;
|
||||
workspaceLogger.error(error, e);
|
||||
throw new Exception(error);
|
||||
workspaceLogger.error("Renaming 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.");
|
||||
throw new SHUBOperationNotAllowedException(error.toString());
|
||||
}else {
|
||||
error.append("Ops an error occurred renaming the item! Either you have not the permission to rename it or a server error occurred. Please, refresh and try again");
|
||||
throw new Exception(error.toString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package org.gcube.portlets.user.workspace.shared;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Class SHUBOperationNotAllowedException.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Apr 30, 2019
|
||||
*/
|
||||
public class SHUBOperationNotAllowedException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 378541477623075645L;
|
||||
|
||||
/**
|
||||
* Instantiates a new SHUB operation not allowed.
|
||||
*/
|
||||
public SHUBOperationNotAllowedException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new SHUB operation not allowed.
|
||||
*
|
||||
* @param arg0 the arg 0
|
||||
*/
|
||||
public SHUBOperationNotAllowedException(String arg0){
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue