updated classes

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@115457 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-06-22 13:42:49 +00:00
parent decb4363ba
commit 7c07422e87
2 changed files with 10 additions and 62 deletions

View File

@ -23,6 +23,7 @@ public class GXTCategoryItemInterface implements Serializable {
public static final String SMF_FOLDERS = "Folders";
public static final String SMF_SHARED_FOLDERS = "Shared Folders";
public static final String SMF_GCUBE_ITEMS= "Gcube Items";
// public static final String SMF_VRE_FOLDERS = "VRE Folders";
public GXTCategoryItemInterface(){}
@ -30,4 +31,6 @@ public class GXTCategoryItemInterface implements Serializable {
public static final String MS_MESSAGES = "Messages";
public static final String MS_SENT = "Sent";
public static final String MS_RECEIVED = "Received";
}

View File

@ -44,6 +44,7 @@ import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
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;
@ -339,13 +340,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
workspaceLogger.trace("get folder children for: "+folder.getIdentifier());
workspace = getWorkspace();
List<FileModel> listFileModels = new ArrayList<FileModel>();
WorkspaceItem wsItem = workspace.getItem(folder.getIdentifier());
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
listFileModels = builder.buildGXTListFileModelItem(wsItem, folder);
//ADDING SPECIAL FOLDER?
@ -396,7 +393,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
}
workspaceLogger.info("Read special folder name: '"+sfReader.getSpecialFolderName()+"', from property file..");
return sfReader.getSpecialFolderName();
}
@ -416,26 +412,13 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
throw new Exception("Folder is null");
workspaceLogger.trace("get children for Grid for folder: "+folder.getIdentifier());
Workspace workspace = getWorkspace();
List<FileGridModel> listFileGridModels = new ArrayList<FileGridModel>();
WorkspaceFolder wsFolder = (WorkspaceFolder) workspace.getItem(folder.getIdentifier());
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
// Long startTime = System.currentTimeMillis();
List<WorkspaceItem> listItems = (List<WorkspaceItem>) wsFolder.getChildren();
// Long endTime = System.currentTimeMillis() - startTime;
// String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
// workspaceLogger.debug("##HL FILLING: grid getChildren() returning "+listItems.size()+" elements in " + time);
listFileGridModels = builder.buildGXTListFileGridModelItem(listItems, folder);
//ADDING SPECIAL FOLDER?
if(wsFolder.isRoot()){
//ADD SPECIAL FOLDER
@ -443,6 +426,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
workspaceLogger.info("Folder is root, loading special folders..");
WorkspaceFolder specialFolder = workspace.getMySpecialFolders();
FileGridModel specialFolderModel = builder.buildGXTFileGridModelItem(specialFolder, folder);
// specialFolderModel.setShortcutCategory(GXTCategoryItemInterface.SMF_VRE_FOLDERS);
specialFolderModel.setSpecialFolder(true);
String newName = getNameForSpecialFolder();
@ -462,8 +446,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} catch (Exception e) {
workspaceLogger.error("Error in server During items retrieving", e);
// workspaceLogger.trace("Error in server During items retrieving " + e);
// e.printStackTrace();
String error = ConstantsExplorer.SERVER_ERROR + RETRIEVING_ITEM_EITHER_ITEM_DOESN_T_EXIST;
//GWT can't serialize all exceptions
throw new Exception(error);
@ -497,12 +479,10 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
}
workspaceLogger.trace("get children for Grid by id: "+folderId);
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
//BUILD PARENT
WorkspaceItem wsItem = workspace.getItem(folderId);
WorkspaceFolder parent;
if(wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER) || wsItem.getType().equals(WorkspaceItemType.FOLDER)){
@ -517,7 +497,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
if(parent==null)
return listFileGridModels;
FileGridModel wsParent = builder.buildGXTFileGridModelItem(parent, null);
//PARENT BUILDED IS SHARED?
@ -530,23 +509,15 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
//GET CHILDREN
List<WorkspaceItem> listItems = (List<WorkspaceItem>) parent.getChildren();
Long endTime = System.currentTimeMillis() - startTime;
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
workspaceLogger.debug("grid getChildren() returning "+listItems.size()+" elements in " + time);
listFileGridModels = builder.buildGXTListFileGridModelItem(listItems, wsParent);
return listFileGridModels;
} catch (Exception e) {
workspaceLogger.error("Error in server During items retrieving", e);
// workspaceLogger.trace("Error in server During items retrieving " + e);
String error = ConstantsExplorer.SERVER_ERROR + RETRIEVING_ITEM_EITHER_ITEM_DOESN_T_EXIST;
// e.printStackTrace();
//GWT can't serialize all exceptions
throw new Exception(error);
}
}
@ -564,29 +535,19 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
throw new Exception(IDENTIFIER_IS_NULL);
Workspace workspace = getWorkspace();
workspaceLogger.trace("get child for Grid by id: "+itemId);
WorkspaceItem wsItem = workspace.getItem(itemId);
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
Long startTime = System.currentTimeMillis();
Long endTime = System.currentTimeMillis() - startTime;
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
workspaceLogger.debug("get child for Grid by id returning element in " + time);
//BUILD PARENT
WorkspaceFolder folder = wsItem.getParent(); //get parent
FileGridModel wsFolder = builder.buildGXTFileGridModelItem(folder, null);
//BUILD ITEM
return builder.buildGXTFileGridModelItem(wsItem, wsFolder);
} catch (Exception e) {
workspaceLogger.error("Error in server during item retrieving, getItemForFileGrid", e);
String error = ConstantsExplorer.SERVER_ERROR + RETRIEVING_ITEM_EITHER_ITEM_DOESN_T_EXIST;
@ -611,7 +572,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
throw new Exception(IDENTIFIER_IS_NULL);
workspaceLogger.trace("moveItem item: "+itemId+" destination: "+destinationId);
WorkspaceItem sourceItem = workspace.getItem(itemId); //GET SOURCE ITEM BEFORE OF MOVE
if(sourceItem==null)
@ -624,10 +584,8 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
sourceSharedId = sourceItem.getIdSharedFolder(); //GET SHARED ID BEFORE OF MOVE
workspaceLogger.trace("moveItem item: "+itemId+" sourceItem name "+sourceItem.getName() + " shared: "+sourceItemIsShared+ " destination: "+destinationId);
WorkspaceItem destinationItem = workspace.moveItem(itemId, destinationId); //move item
WorkspaceItem folderDestinationItem = workspace.getItem(destinationId); //retrieve folder destination
workspaceLogger.trace("sourceItem.isShared() "+sourceItemIsShared);
workspaceLogger.trace("folderDestinationItem item: "+destinationId+" folderDestinationItem name "+folderDestinationItem.getName() + " folderDestinationItem shared: "+folderDestinationItem.isShared());
@ -695,11 +653,8 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
sourceSharedId = sourceItem.getIdSharedFolder(); //GET SHARED ID BEFORE OF MOVE
workspaceLogger.trace("moveItem item: "+itemId+" sourceItem name "+sourceItem.getName() + " shared: "+sourceItemIsShared+ " destination: "+destinationId);
WorkspaceItem destinationItem = workspace.moveItem(itemId, destinationId); //move item
WorkspaceItem folderDestinationItem = workspace.getItem(destinationId); //retrieve folder destination
workspaceLogger.trace("sourceItem.isShared() "+sourceItemIsShared );
workspaceLogger.trace("folderDestinationItem item: "+destinationId+" folderDestinationItem name "+folderDestinationItem.getName() + " folderDestinationItem shared: "+folderDestinationItem.isShared());
@ -767,11 +722,8 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
//DEBUG
printContacts(listContacts);
Workspace workspace = getWorkspace();
WorkspaceItem destinationSharedFolder = workspace.getItem(folderDestinationItem.getIdSharedFolder());
NotificationsProducer np = getNotificationProducer();
if(destinationSharedFolder instanceof WorkspaceSharedFolder){
@ -830,13 +782,8 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
//DEBUG
printContacts(listContacts);
Workspace workspace = getWorkspace();
WorkspaceItem sourceSharedFolder = workspace.getItem(sourceSharedId);
//System.out.println(" name sourceSharedFolder: "+ sourceSharedFolder.getName());
NotificationsProducer np = getNotificationProducer();
if(sourceSharedFolder instanceof WorkspaceSharedFolder){
@ -2442,8 +2389,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
listParents.add(builder.buildGXTFolderModelItemHandleSpecialFolder((WorkspaceFolder) wsItem, null, nameSpecialFolder));
}
while(wsItem!=null && wsItem.getParent()!=null){
WorkspaceFolder wsFolder = wsItem.getParent();