enhancements on trash
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@95584 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d6e721ea4e
commit
beeb3186fb
|
@ -1944,7 +1944,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
|
|
||||||
}else if(event instanceof TrashEvent){
|
}else if(event instanceof TrashEvent){
|
||||||
TrashEvent trashEvent = (TrashEvent) event;
|
TrashEvent trashEvent = (TrashEvent) event;
|
||||||
sub.trashEvent(trashEvent.getTrashOperation(), trashEvent.getTargetFileModel());
|
sub.trashEvent(trashEvent.getTrashOperation(), trashEvent.getTargetFileModels());
|
||||||
|
|
||||||
}else if(event instanceof UpdatedVREPermissionEvent){
|
}else if(event instanceof UpdatedVREPermissionEvent){
|
||||||
UpdatedVREPermissionEvent vreEvent = (UpdatedVREPermissionEvent) event;
|
UpdatedVREPermissionEvent vreEvent = (UpdatedVREPermissionEvent) event;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.portlets.user.workspace.client.event;
|
package org.gcube.portlets.user.workspace.client.event;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspace.client.interfaces.EventsTypeEnum;
|
import org.gcube.portlets.user.workspace.client.interfaces.EventsTypeEnum;
|
||||||
import org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface;
|
import org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface;
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||||
|
@ -17,12 +19,12 @@ public class TrashEvent extends GwtEvent<TrashEventHandler> implements GuiEventI
|
||||||
|
|
||||||
public static Type<TrashEventHandler> TYPE = new Type<TrashEventHandler>();
|
public static Type<TrashEventHandler> TYPE = new Type<TrashEventHandler>();
|
||||||
|
|
||||||
private FileModel targetFileModel;
|
private List<FileModel> targetFileModels;
|
||||||
private WorkspaceTrashOperation trashOperation;
|
private WorkspaceTrashOperation trashOperation;
|
||||||
|
|
||||||
public TrashEvent(WorkspaceTrashOperation trashOperation, FileModel target) {
|
public TrashEvent(WorkspaceTrashOperation trashOperation, List<FileModel> targets) {
|
||||||
this.trashOperation = trashOperation;
|
this.trashOperation = trashOperation;
|
||||||
this.setTargetFileModel(target);
|
this.setTargetFileModels(targets);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,23 +37,6 @@ public class TrashEvent extends GwtEvent<TrashEventHandler> implements GuiEventI
|
||||||
handler.onTrashEvent(this);
|
handler.onTrashEvent(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the targetFileModel
|
|
||||||
*/
|
|
||||||
public FileModel getTargetFileModel() {
|
|
||||||
return targetFileModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param targetFileModel the targetFileModel to set
|
|
||||||
*/
|
|
||||||
public void setTargetFileModel(FileModel targetFileModel) {
|
|
||||||
this.targetFileModel = targetFileModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WorkspaceTrashOperation getTrashOperation() {
|
|
||||||
return trashOperation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface#getKey()
|
* @see org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface#getKey()
|
||||||
|
@ -65,5 +50,17 @@ public class TrashEvent extends GwtEvent<TrashEventHandler> implements GuiEventI
|
||||||
this.trashOperation = trashOperation;
|
this.trashOperation = trashOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<FileModel> getTargetFileModels() {
|
||||||
|
return targetFileModels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTargetFileModels(List<FileModel> targetFileModels) {
|
||||||
|
this.targetFileModels = targetFileModels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorkspaceTrashOperation getTrashOperation() {
|
||||||
|
return trashOperation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public interface SubscriberInterface {
|
||||||
* @param trashOperation
|
* @param trashOperation
|
||||||
* @param targetFileModel
|
* @param targetFileModel
|
||||||
*/
|
*/
|
||||||
void trashEvent(WorkspaceTrashOperation trashOperation, FileModel targetFileModel);
|
void trashEvent(WorkspaceTrashOperation trashOperation, List<FileModel> targetFileModels);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param vreFolderId
|
* @param vreFolderId
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.gcube.portlets.user.workspace.client.model.SubTree;
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
||||||
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
||||||
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
||||||
|
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
||||||
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
||||||
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
|
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
|
||||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
||||||
|
@ -248,7 +249,7 @@ public interface GWTWorkspaceService extends RemoteService{
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
TrashContent executeOperationOnTrash(List<String> listTrashItemIds,
|
TrashOperationContent executeOperationOnTrash(List<String> listTrashItemIds,
|
||||||
WorkspaceTrashOperation operation) throws Exception;
|
WorkspaceTrashOperation operation) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import org.gcube.portlets.user.workspace.client.model.SmartFolderModel;
|
||||||
import org.gcube.portlets.user.workspace.client.model.SubTree;
|
import org.gcube.portlets.user.workspace.client.model.SubTree;
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
||||||
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
||||||
|
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
||||||
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
||||||
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
|
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
|
||||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
||||||
|
@ -201,6 +202,6 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
|
|
||||||
void executeOperationOnTrash(List<String> listTrashItemIds,
|
void executeOperationOnTrash(List<String> listTrashItemIds,
|
||||||
WorkspaceTrashOperation operation,
|
WorkspaceTrashOperation operation,
|
||||||
AsyncCallback<TrashContent> callback);
|
AsyncCallback<TrashOperationContent> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2932,11 +2932,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TrashContent executeOperationOnTrash(List<String> listTrashItemIds, WorkspaceTrashOperation operation) throws Exception{
|
public TrashOperationContent executeOperationOnTrash(List<String> listTrashItemIds, WorkspaceTrashOperation operation) throws Exception{
|
||||||
|
|
||||||
workspaceLogger.info("Get TrashContent, operation: "+operation);
|
workspaceLogger.info("Get TrashContent, operation: "+operation);
|
||||||
|
|
||||||
|
@ -2944,14 +2942,13 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
throw new Exception("List of Trash item ids is null or empty");
|
throw new Exception("List of Trash item ids is null or empty");
|
||||||
|
|
||||||
Workspace workspace;
|
Workspace workspace;
|
||||||
List<String> listErrors = null;
|
List<FileTrashedModel> listContentError = new ArrayList<FileTrashedModel>();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
workspace = getWorkspace();
|
workspace = getWorkspace();
|
||||||
WorkspaceTrashFolder trash = workspace.getTrash();
|
WorkspaceTrashFolder trash = workspace.getTrash();
|
||||||
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
||||||
TrashOperationContent result = new TrashOperationContent();
|
TrashOperationContent result = new TrashOperationContent();
|
||||||
List<FileTrashedModel> listContentError = new ArrayList<FileTrashedModel>();
|
|
||||||
|
|
||||||
List<String> listUpdatedTrashIds = new ArrayList<String>();
|
List<String> listUpdatedTrashIds = new ArrayList<String>();
|
||||||
|
|
||||||
|
@ -3014,10 +3011,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
// trash = workspace.getTrash();
|
// trash = workspace.getTrash();
|
||||||
// result.setTrashContent(builder.buildGXTListTrashContent(trash));
|
// result.setTrashContent(builder.buildGXTListTrashContent(trash));
|
||||||
|
|
||||||
if(listErrors.size()>0){
|
if(!listContentError.isEmpty()){
|
||||||
for (String trashedItemId : listErrors) {
|
|
||||||
listContentError.add(builder.buildGXTTrashModelItemById(trashedItemId, trash));
|
|
||||||
}
|
|
||||||
result.setListErrors(listContentError);
|
result.setListErrors(listContentError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue