enhancements on trash

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@91785 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2014-02-17 14:56:42 +00:00
parent a85459501a
commit 0b8826ae99
10 changed files with 603 additions and 42 deletions

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.workspace.client.event;
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.model.FileModel;
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
import com.google.gwt.event.shared.GwtEvent;
@ -16,12 +17,10 @@ public class TrashEvent extends GwtEvent<TrashEventHandler> implements GuiEventI
public static Type<TrashEventHandler> TYPE = new Type<TrashEventHandler>();
public static enum TRASHOPERATION {SHOW, MOVETO, RESTOREFROM}
private FileModel targetFileModel;
private TRASHOPERATION trashOperation;
private WorkspaceTrashOperation trashOperation;
public TrashEvent(TRASHOPERATION trashOperation, FileModel target) {
public TrashEvent(WorkspaceTrashOperation trashOperation, FileModel target) {
this.trashOperation = trashOperation;
this.setTargetFileModel(target);
}
@ -50,14 +49,10 @@ public class TrashEvent extends GwtEvent<TrashEventHandler> implements GuiEventI
this.targetFileModel = targetFileModel;
}
public TRASHOPERATION getTrashOperation() {
public WorkspaceTrashOperation getTrashOperation() {
return trashOperation;
}
public void setSetTrashOperation(TRASHOPERATION setTrashOperation) {
this.trashOperation = setTrashOperation;
}
/* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface#getKey()
*/
@ -65,6 +60,10 @@ public class TrashEvent extends GwtEvent<TrashEventHandler> implements GuiEventI
public EventsTypeEnum getKey() {
return EventsTypeEnum.TRASH_EVENT;
}
public void setTrashOperation(WorkspaceTrashOperation trashOperation) {
this.trashOperation = trashOperation;
}
}

View File

@ -5,9 +5,9 @@ import java.util.HashMap;
import java.util.List;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.ViewSwitchType;
import org.gcube.portlets.user.workspace.client.event.TrashEvent.TRASHOPERATION;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.model.FolderModel;
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
/**
@ -51,10 +51,11 @@ public interface SubscriberInterface {
*
*/
void copyEventIsCompleted();
/**
* @param trashOperation
* @param targetFileModel
*/
void trashEvent(TRASHOPERATION trashOperation, FileModel targetFileModel);
void trashEvent(WorkspaceTrashOperation trashOperation, FileModel targetFileModel);
}

View File

@ -0,0 +1,173 @@
package org.gcube.portlets.user.workspace.client.model;
import java.util.Date;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class FileTrashedModel extends FileGridModel {
/**
*
*/
private static final long serialVersionUID = 2186023125020221821L;
private String orginalPath;
private Date deleteDate;
private InfoContactModel deleteUser;
public FileTrashedModel() {
}
/**
*
* @param identifier
* @param name
* @param path
* @param creationDate
* @param parent
* @param size
* @param isDirectory
* @param isShared
*/
public FileTrashedModel(String identifier, String name, String path, Date creationDate, FileModel parent, long size, boolean isDirectory, boolean isShared) {
super(identifier, name, path, creationDate, parent, size, isDirectory, isShared);
}
/**
* @param orginalPath
* @param deleteDate
* @param deleteUser
*/
public FileTrashedModel(String orginalPath, Date deleteDate,
InfoContactModel deleteUser) {
super();
this.orginalPath = orginalPath;
this.deleteDate = deleteDate;
this.deleteUser = deleteUser;
}
/**
*
* @param identifier
* @param name
* @param creationDate
* @param parent
* @param size
* @param isDirectory
* @param isShared
*/
public FileTrashedModel(String identifier, String name, Date creationDate, FileModel parent, long size, boolean isDirectory, boolean isShared) {
super(identifier, name, creationDate, parent, size, isDirectory, isShared);
}
public String getOrginalPath() {
return orginalPath;
}
public Date getDeleteDate() {
return deleteDate;
}
public InfoContactModel getDeleteUser() {
return deleteUser;
}
public void setOrginalPath(String orginalPath) {
this.orginalPath = orginalPath;
}
public void setDeleteDate(Date deleteDate) {
this.deleteDate = deleteDate;
}
public void setDeleteUser(InfoContactModel deleteUser) {
this.deleteUser = deleteUser;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("FileTrashedModel [orginalPath=");
builder.append(orginalPath);
builder.append(", deleteDate=");
builder.append(deleteDate);
builder.append(", deleteUser=");
builder.append(deleteUser);
builder.append(", getSize()=");
builder.append(getSize());
builder.append(", getLastModification()=");
builder.append(getLastModification());
builder.append(", getDescription()=");
builder.append(getDescription());
builder.append(", isShareable()=");
builder.append(isShareable());
builder.append(", isMarkAsRead()=");
builder.append(isMarkAsRead());
builder.append(", getOwner()=");
builder.append(getOwner());
builder.append(", getOwnerFullName()=");
builder.append(getOwnerFullName());
builder.append(", getListUserSharing()=");
builder.append(getListUserSharing());
builder.append(", isShared()=");
builder.append(isShared());
builder.append(", isRoot()=");
builder.append(isRoot());
builder.append(", getIcon()=");
builder.append(getIcon());
builder.append(", getAbstractPrototypeIcon()=");
builder.append(getAbstractPrototypeIcon());
builder.append(", getStatus()=");
builder.append(getStatus());
builder.append(", getIdentifier()=");
builder.append(getIdentifier());
builder.append(", getShortcutCategory()=");
builder.append(getShortcutCategory());
builder.append(", getName()=");
builder.append(getName());
builder.append(", getParentFileModel()=");
builder.append(getParentFileModel());
builder.append(", isDirectory()=");
builder.append(isDirectory());
builder.append(", getType()=");
builder.append(getType());
builder.append(", getGXTFolderItemType()=");
builder.append(getGXTFolderItemType());
builder.append(", isVreFolder()=");
builder.append(isVreFolder());
builder.append(", toString()=");
builder.append(super.toString());
builder.append(", getProperties()=");
builder.append(getProperties());
builder.append(", getPropertyNames()=");
builder.append(getPropertyNames());
builder.append(", isAllowNestedValues()=");
builder.append(isAllowNestedValues());
builder.append(", getClass()=");
builder.append(getClass());
builder.append(", hashCode()=");
builder.append(hashCode());
builder.append("]");
return builder.toString();
}
}

View File

@ -11,8 +11,9 @@ public class FolderGridModel extends FileGridModel {
/**
*
*/
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 8274585443980764897L;
protected FolderGridModel() {
}

View File

@ -8,6 +8,7 @@ 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.FileGridModel;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.model.FileTrashedModel;
import org.gcube.portlets.user.workspace.client.model.FolderModel;
import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
import org.gcube.portlets.user.workspace.client.model.MessageModel;
@ -203,4 +204,17 @@ public interface GWTWorkspaceService extends RemoteService{
void setACLForVRE(String folderId, String aclType) throws Exception;
/**
* @param folderId
* @return
* @throws Exception
*/
List<WorkspaceACL> getACLForFolderId(String folderId) throws Exception;
/**
* @return
* @throws Exception
*/
List<FileTrashedModel> getTrashContent() throws Exception;
}

View File

@ -8,6 +8,7 @@ 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.FileGridModel;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.model.FileTrashedModel;
import org.gcube.portlets.user.workspace.client.model.FolderModel;
import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
import org.gcube.portlets.user.workspace.client.model.MessageModel;
@ -182,4 +183,9 @@ public interface GWTWorkspaceServiceAsync {
void setACLForVRE(String folderId, String aclType,
AsyncCallback<Void> callback);
void getACLForFolderId(String folderId,
AsyncCallback<List<WorkspaceACL>> callback);
void getTrashContent(AsyncCallback<List<FileTrashedModel>> callback);
}

View File

@ -21,6 +21,7 @@ import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
import org.gcube.common.homelibrary.home.workspace.WorkspaceSmartFolder;
import org.gcube.common.homelibrary.home.workspace.accessmanager.ACLType;
import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntry;
import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryAdd;
import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryCreate;
@ -55,12 +56,16 @@ import org.gcube.common.homelibrary.home.workspace.folder.items.ts.TimeSeriesInf
import org.gcube.common.homelibrary.home.workspace.search.SearchFolderItem;
import org.gcube.common.homelibrary.home.workspace.search.SearchItem;
import org.gcube.common.homelibrary.home.workspace.sharing.WorkspaceMessage;
import org.gcube.common.homelibrary.home.workspace.trash.WorkspaceTrashFolder;
import org.gcube.common.homelibrary.home.workspace.trash.WorkspaceTrashItem;
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.GXTFolderItemTypeEnum;
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.FileGridModel;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.model.FileTrashedModel;
import org.gcube.portlets.user.workspace.client.model.FolderGridModel;
import org.gcube.portlets.user.workspace.client.model.FolderModel;
import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
@ -91,6 +96,8 @@ import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTP
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTUrlDocument;
import org.gcube.portlets.user.workspace.server.util.UserUtil;
import org.gcube.portlets.user.workspace.server.util.WsUtil;
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
import org.gcube.portlets.user.workspace.shared.WorkspaceACL.USER_TYPE;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
import org.gcube.vomanagement.usermanagement.model.UserModel;
@ -2085,4 +2092,122 @@ public class GWTWorkspaceBuilder {
public void setUserLogged(InfoContactModel infoContactModel) {
this.userLogged = infoContactModel;
}
public List<WorkspaceACL> getWorkspaceACLFromACLs(List<ACLType> types) throws Exception{
List<WorkspaceACL> acls = new ArrayList<WorkspaceACL>();
for (ACLType acl : types) {
switch (acl) {
case ADMINISTRATOR:
acls.add(new WorkspaceACL(acl.toString(), acl.toString(), false, USER_TYPE.ADMINISTRATOR, ""));
break;
case READ_ONLY:
acls.add(new WorkspaceACL(acl.toString(), "Read Only", false, USER_TYPE.OTHER, "Users can read any file but cannot update/delete"));
break;
case WRITE_OWNER:
acls.add(new WorkspaceACL(acl.toString(), "Write Own", true, USER_TYPE.OTHER, "Users can update/delete only their files"));
break;
case WRITE_ALL:
acls.add(new WorkspaceACL(acl.toString(), "Write Any", false, USER_TYPE.OTHER,"Any user can update/delete any file"));
break;
default:
acls.add(new WorkspaceACL(acl.toString(), acl.toString(), false, USER_TYPE.OTHER, ""));
break;
}
}
if(acls.size()==0)
throw new Exception("No ACLs rules found!");
return acls;
}
public List<FileTrashedModel> buildGXTListTrashContent(WorkspaceTrashFolder trash) throws Exception
{
List<FileTrashedModel> listFileModel = new ArrayList<FileTrashedModel>();
try {
for (WorkspaceTrashItem trashedItem : trash.listTrashItems())
listFileModel.add(buildGXTTrashModelItem(trashedItem));
} catch (Exception e) {
logger.error("Error in server buildGXTListTrashContent", e);
String error = ConstantsExplorer.SERVER_ERROR +" get Trash content. "+e.getMessage();
throw new Exception(error);
}
return listFileModel;
}
public FileTrashedModel buildGXTTrashModelItem(WorkspaceTrashItem trashedItem) throws InternalErrorException{
FileTrashedModel fileTrashModel = null;
switch (trashedItem.getType()) {
case TRASH_ITEM:
//TODO SETTING IS FOLDER
// fileGridModel = new FileGridModel(item.getId(), item.getName(), toDate(item.getCreationTime()), parentFileModel, folderItem.getLength(), false, false);
fileTrashModel = new FileTrashedModel(trashedItem.getId(), trashedItem.getName(), toDate(trashedItem.getLastModificationTime()), null, trashedItem.getLength(), false, trashedItem.isShared());
fileTrashModel.setOrginalPath(trashedItem.getOriginalPath());
fileTrashModel.setDeleteDate(fileTrashModel.getDeleteDate());
InfoContactModel deleteUser = buildGxtInfoContactFromPortalLogin(trashedItem.getDeleteUser());
fileTrashModel.setDeleteUser(deleteUser);
FolderItem folderItem = (FolderItem) trashedItem;
fileTrashModel = (FileTrashedModel) setFolderItemType(fileTrashModel, folderItem);
break;
default:
logger.error("gxt conversion return null for trash item "+trashedItem.getName());
break;
}
return fileTrashModel;
}
public FileTrashedModel buildGXTTrashModelItemById(String itemId, WorkspaceTrashFolder trash) throws InternalErrorException{
// FileTrashedModel fileTrashModel = null;
//
// WorkspaceTrashItem trashedItem = trash.findItem(itemId);
//
// switch (trashedItem.getType()) {
//
// case TRASH_ITEM:
//
// //TODO SETTING IS FOLDER
// // fileGridModel = new FileGridModel(item.getId(), item.getName(), toDate(item.getCreationTime()), parentFileModel, folderItem.getLength(), false, false);
// fileTrashModel = new FileTrashedModel(trashedItem.getId(), trashedItem.getName(), toDate(trashedItem.getLastModificationTime()), null, trashedItem.getLength(), false, trashedItem.isShared());
// fileTrashModel.setOrginalPath(trashedItem.getOriginalPath());
// fileTrashModel.setDeleteDate(fileTrashModel.getDeleteDate());
// InfoContactModel deleteUser = buildGxtInfoContactFromPortalLogin(trashedItem.getDeleteUser());
// fileTrashModel.setDeleteUser(deleteUser);
// FolderItem folderItem = (FolderItem) trashedItem;
// fileTrashModel = (FileTrashedModel) setFolderItemType(fileTrashModel, folderItem);
// break;
//
//
// default:
// logger.error("gxt conversion return null for trash item "+trashedItem.getName());
// break;
//
// }
//
// return fileTrashModel;
return null;
}
}

View File

@ -1,6 +1,7 @@
package org.gcube.portlets.user.workspace.server;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
@ -32,6 +33,7 @@ import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalUrl;
import org.gcube.common.homelibrary.home.workspace.folder.items.ts.TimeSeries;
import org.gcube.common.homelibrary.home.workspace.search.SearchItem;
import org.gcube.common.homelibrary.home.workspace.sharing.WorkspaceMessage;
import org.gcube.common.homelibrary.home.workspace.trash.WorkspaceTrashFolder;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.interfaces.GXTCategoryItemInterface;
@ -39,6 +41,7 @@ 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.FileGridModel;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.model.FileTrashedModel;
import org.gcube.portlets.user.workspace.client.model.FolderModel;
import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
import org.gcube.portlets.user.workspace.client.model.MessageModel;
@ -57,8 +60,9 @@ import org.gcube.portlets.user.workspace.server.util.UserUtil;
import org.gcube.portlets.user.workspace.server.util.WsUtil;
import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter;
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
import org.gcube.portlets.user.workspace.shared.TrashOperationResult;
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
import org.gcube.portlets.user.workspace.shared.WorkspaceACL.USER_TYPE;
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
import org.gcube.portlets.user.workspaceapplicationhandler.ApplicationReaderFromGenericResource;
@ -2512,35 +2516,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override
public List<WorkspaceACL> getACLs() throws Exception{
try {
List<WorkspaceACL> acls = new ArrayList<WorkspaceACL>();
for (ACLType acl : ACLType.values()) {
switch (acl) {
case ADMINISTRATOR:
acls.add(new WorkspaceACL(acl.toString(), acl.toString(), false, USER_TYPE.ADMINISTRATOR, ""));
break;
case READ_ONLY:
acls.add(new WorkspaceACL(acl.toString(), "Read Only", false, USER_TYPE.OTHER, "Users can read any file but cannot update/delete"));
break;
case WRITE_OWNER:
acls.add(new WorkspaceACL(acl.toString(), "Write Own", true, USER_TYPE.OTHER, "Users can update/delete only their files"));
break;
case WRITE_ALL:
acls.add(new WorkspaceACL(acl.toString(), "Write Any", false, USER_TYPE.OTHER,"Any user can update/delete any file"));
break;
default:
acls.add(new WorkspaceACL(acl.toString(), acl.toString(), false, USER_TYPE.OTHER, ""));
break;
}
}
if(acls.size()==0)
throw new Exception("No ACLs rules found!");
return acls;
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
return builder.getWorkspaceACLFromACLs(Arrays.asList(ACLType.values()));
} catch (Exception e) {
workspaceLogger.error("Error in server get ACLs", e);
String error = ConstantsExplorer.SERVER_ERROR +" get ACL rules. "+e.getMessage();
@ -2590,4 +2568,133 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
throw new Exception(error);
}
}
/**
*
* @return
* @throws Exception
*/
@Override
public List<WorkspaceACL> getACLForFolderId(String folderId) throws Exception{
try {
if(folderId == null)
throw new Exception("Folder id is null");
workspaceLogger.trace("Get ACLByFolderId folder id: "+folderId);
Workspace workspace = getWorkspace();
WorkspaceItem wsItem = workspace.getItem(folderId);
if(wsItem.isShared() && (wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER))){
WorkspaceSharedFolder ite = (WorkspaceSharedFolder) workspace.getItemByPath(wsItem.getPath());
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
//TODO
ite.getACL();
return builder.getWorkspaceACLFromACLs(Arrays.asList(ACLType.values()));
}else
throw new Exception("Source item is not shared or shared folder");
} catch (Exception e) {
workspaceLogger.error("Error in server get getACLForFolderId", e);
String error = ConstantsExplorer.SERVER_ERROR +" get ACL rules for selected folder. "+e.getMessage();
throw new Exception(error);
}
}
/**
*
* @return
* @throws Exception
*/
@Override
public List<FileTrashedModel> getTrashContent() throws Exception{
workspaceLogger.trace("Get TrashContent: ");
Workspace workspace;
try {
workspace = getWorkspace();
WorkspaceTrashFolder trash = workspace.getTrash();
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
return builder.buildGXTListTrashContent(trash);
}catch (Exception e) {
workspaceLogger.error("Error in server TrashConten", e);
String error = ConstantsExplorer.SERVER_ERROR +" get Trash content. "+e.getMessage();
throw new Exception(error);
}
}
/**
*
* @return
* @throws Exception
*/
public TrashOperationResult executeOperationOnTrashItem(String trashItemId, WorkspaceTrashOperation operation) throws Exception{
workspaceLogger.trace("Get TrashContent: ");
Workspace workspace;
List<String> listErrors = null;
try {
workspace = getWorkspace();
WorkspaceTrashFolder trash = workspace.getTrash();
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
TrashOperationResult result = new TrashOperationResult();
switch (operation) {
case EMPTY_TRASH:
listErrors = trash.emptyTrash();
break;
case DELETE_PERMANENTLY:
break;
case RESTORE:
break;
case RESTORE_ALL:
listErrors = trash.restoreAll();
break;
case REFRESH:
result.setTrashContent(builder.buildGXTListTrashContent(trash));
return result;
default:
result.setTrashContent(builder.buildGXTListTrashContent(trash));
return result;
}
trash = workspace.getTrash();
result.setTrashContent(builder.buildGXTListTrashContent(trash));
if(listErrors!=null){
List<FileTrashedModel> listContentError = new ArrayList<FileTrashedModel>(listErrors.size());
for (String trashedItemId : listErrors) {
listContentError.add(builder.buildGXTTrashModelItemById(trashedItemId, trash));
}
result.setListErrors(listContentError);
}
return result;
}catch (Exception e) {
workspaceLogger.error("Error in server TrashConten", e);
String error = ConstantsExplorer.SERVER_ERROR +" get Trash content. "+e.getMessage();
throw new Exception(error);
}
}
}

View File

@ -0,0 +1,70 @@
/**
*
*/
package org.gcube.portlets.user.workspace.shared;
import java.io.Serializable;
import java.util.List;
import org.gcube.portlets.user.workspace.client.model.FileTrashedModel;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Feb 17, 2014
*
*/
public class TrashOperationResult implements Serializable{
/**
*
*/
private static final long serialVersionUID = -7428752149892396573L;
List<FileTrashedModel> trashContent;
List<FileTrashedModel> listErrors;
/**
*
*/
public TrashOperationResult() {
// TODO Auto-generated constructor stub
}
/**
* @param trashContent
* @param listErrors
*/
public TrashOperationResult(List<FileTrashedModel> trashContent,
List<FileTrashedModel> listErrors) {
this.trashContent = trashContent;
this.listErrors = listErrors;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("TrashOperationResult [trashContent=");
builder.append(trashContent);
builder.append(", listErrors=");
builder.append(listErrors);
builder.append("]");
return builder.toString();
}
public List<FileTrashedModel> getTrashContent() {
return trashContent;
}
public void setTrashContent(List<FileTrashedModel> trashContent) {
this.trashContent = trashContent;
}
public List<FileTrashedModel> getListErrors() {
return listErrors;
}
public void setListErrors(List<FileTrashedModel> listErrors) {
this.listErrors = listErrors;
}
}

View File

@ -0,0 +1,65 @@
/**
*
*/
package org.gcube.portlets.user.workspace.shared;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Feb 17, 2014
*
*/
public enum WorkspaceTrashOperation {
//SHOW TRASH WINDOW
SHOW("Show", "Show"),
//CALLING OPERATION SERVER
REFRESH("Refresh", "Refresh trash content"),
RESTORE("Restore", "Restore the trash item"),
RESTORE_ALL("Restore All", "Restore all trash content"),
DELETE_PERMANENTLY("Delete Permanently", "Delete Permanently the trash item"),
EMPTY_TRASH("Empty", "Empty definitively trash content");
public String label;
public String operationDescription;
WorkspaceTrashOperation(String label, String description)
{
this.label = label;
this.operationDescription = description;
}
/**
* @return the label
*/
public String getLabel() {
return label;
}
public static List<String> getListLabels(){
List<String> listLabels = new ArrayList<String>();
for (WorkspaceTrashOperation item : WorkspaceTrashOperation.values())
listLabels.add(item.getLabel());
return listLabels;
}
public static WorkspaceTrashOperation valueOfLabel(String label)
{
for (WorkspaceTrashOperation value:values()) if (value.getLabel().equals(label)) return value;
return null;
}
public String getOperationDescription() {
return operationDescription;
}
}