Removed getStorageID property because it is very slow, see #2109
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@122763 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5f312fe737
commit
567cce8630
20
.classpath
20
.classpath
|
@ -1,5 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
|
@ -18,15 +28,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
|
||||
<property name="context-root" value="workspace-explorer"/>
|
||||
<property name="java-output-path" value="/workspace-explorer/target/workspace-explorer-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
||||
</wb-module>
|
||||
|
|
|
@ -108,18 +108,27 @@ public class ItemBuilder {
|
|||
|
||||
_log.debug("Building Item for: "+itemName);
|
||||
|
||||
String storageID = null;
|
||||
if(workspaceItem instanceof FolderItem){
|
||||
storageID = workspaceItem.getStorageID();
|
||||
Item item = null;
|
||||
try{
|
||||
|
||||
//THIS CALL IS VERY SLOW!!
|
||||
// String storageID = null;
|
||||
// if(workspaceItem instanceof FolderItem){
|
||||
// storageID = workspaceItem.getStorageID();
|
||||
// }
|
||||
|
||||
item = new Item(parent, workspaceItem.getId(), itemName, type, workspaceItem.getPath(), UserUtil.getUserFullName(workspaceItem.getOwner().getPortalLogin()), isFolder, false);
|
||||
item.setSharedFolder(isSharedFolder);
|
||||
}catch(Exception e){
|
||||
_log.error("Error on getting item: "+itemName+" with id: "+workspaceItem.getId()+", from HL, so skipping item");
|
||||
return null;
|
||||
}
|
||||
Item item = new Item(parent, workspaceItem.getId(), itemName, type, workspaceItem.getPath(), UserUtil.getUserFullName(workspaceItem.getOwner().getPortalLogin()), storageID, isFolder, false);
|
||||
item.setSharedFolder(isSharedFolder);
|
||||
|
||||
if(loadChildren){
|
||||
for (WorkspaceItem child: workspaceItem.getChildren()){
|
||||
_log.trace("Converting child item: "+itemName);
|
||||
_log.trace("\n\nConverting child item: "+child.getName());
|
||||
Item itemChild = getItem(item, child, showableTypes, filterCriteria, false);
|
||||
_log.trace("Item: "+itemName +" converted!!!");
|
||||
_log.trace("Item: "+child.getName() +" converted!!!");
|
||||
if (itemChild!=null){
|
||||
item.addChild(itemChild);
|
||||
}
|
||||
|
@ -338,7 +347,7 @@ public class ItemBuilder {
|
|||
}
|
||||
|
||||
//BUILDS A SIMPLE ITEM FOR BREADCRUMB
|
||||
Item item = new Item(null, wsFolder.getId(), name, ItemType.FOLDER, wsFolder.getPath(), null, null, true, isRoot);
|
||||
Item item = new Item(null, wsFolder.getId(), name, ItemType.FOLDER, wsFolder.getPath(), null, true, isRoot);
|
||||
item.setSpecialFolder(isSpecialFolder);
|
||||
|
||||
_log.debug("breadcrumb returning: "+item);
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.gcube.common.homelibrary.home.workspace.exceptions.InsufficientPrivil
|
|||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemAlreadyExistException;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerConstants;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
|
@ -98,7 +99,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
*/
|
||||
protected Workspace getWorkspace() throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException {
|
||||
ASLSession session = getASLSession(this.getThreadLocalRequest().getSession());
|
||||
|
||||
ScopeProvider.instance.set(session.getScope());
|
||||
Workspace workspace = HomeLibrary.getUserWorkspace(session.getUsername());
|
||||
return workspace;
|
||||
}
|
||||
|
@ -208,12 +209,12 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
}else if(fullName.indexOf(".")>0){
|
||||
fullName = fullName.substring(0, fullName.indexOf("."));
|
||||
}
|
||||
item = new Item(null, root.getId(), fullName+"'s", ItemType.FOLDER, root.getPath(), root.getOwner().getPortalLogin(), null, true, true);
|
||||
item = new Item(null, root.getId(), fullName+"'s", ItemType.FOLDER, root.getPath(), root.getOwner().getPortalLogin(), true, true);
|
||||
break;
|
||||
}
|
||||
case VRE_FOLDER:{
|
||||
WorkspaceItem folder = workspace.getMySpecialFolders();
|
||||
item = new Item(null, folder.getId(), WorkspaceExplorerConstants.VRE_FOLDERS_LABEL, ItemType.FOLDER, folder.getPath(), folder.getOwner().getPortalLogin(), null, true, false);
|
||||
item = new Item(null, folder.getId(), WorkspaceExplorerConstants.VRE_FOLDERS_LABEL, ItemType.FOLDER, folder.getPath(), folder.getOwner().getPortalLogin(), true, false);
|
||||
//SET SPECIAL FOLDER /Workspace/MySpecialFolders
|
||||
item.setSpecialFolder(true);
|
||||
break;
|
||||
|
|
|
@ -28,7 +28,6 @@ public class Item implements IsSerializable {
|
|||
private boolean isSpecialFolder = false;
|
||||
private boolean isSharedFolder = false;
|
||||
private boolean isRoot = false;
|
||||
private String storageId;
|
||||
|
||||
/**
|
||||
* Instantiates a new item.
|
||||
|
@ -47,31 +46,6 @@ public class Item implements IsSerializable {
|
|||
this.isFolder = isFolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new item.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param id the id
|
||||
* @param name the name
|
||||
* @param type the type
|
||||
* @param path the path
|
||||
* @param owner the owner
|
||||
* @param storageId the storage id
|
||||
* @param isFolder the is folder
|
||||
* @param isRoot the is root
|
||||
*/
|
||||
public Item(Item parent, String id, String name, ItemType type, String path, String owner, String storageId, boolean isFolder, boolean isRoot) {
|
||||
this(id, name, isFolder);
|
||||
this.parent = parent;
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.storageId = storageId;
|
||||
this.path = path;
|
||||
this.children = new ArrayList<Item>();
|
||||
this.owner = owner;
|
||||
this.isRoot = isRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new item.
|
||||
*
|
||||
|
@ -95,25 +69,6 @@ public class Item implements IsSerializable {
|
|||
this.isRoot = isRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the storage id.
|
||||
*
|
||||
* @return the storageId
|
||||
*/
|
||||
public String getStorageId() {
|
||||
|
||||
return storageId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the storage id.
|
||||
*
|
||||
* @param storageId the storageId to set
|
||||
*/
|
||||
public void setStorageId(String storageId) {
|
||||
|
||||
this.storageId = storageId;
|
||||
}
|
||||
/**
|
||||
* Sets the id.
|
||||
*
|
||||
|
@ -363,7 +318,9 @@ public class Item implements IsSerializable {
|
|||
public String toString() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("Item [id=");
|
||||
builder.append("Item [parent=");
|
||||
builder.append(parent);
|
||||
builder.append(", id=");
|
||||
builder.append(id);
|
||||
builder.append(", name=");
|
||||
builder.append(name);
|
||||
|
@ -383,8 +340,6 @@ public class Item implements IsSerializable {
|
|||
builder.append(isSharedFolder);
|
||||
builder.append(", isRoot=");
|
||||
builder.append(isRoot);
|
||||
builder.append(", storageId=");
|
||||
builder.append(storageId);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
|
|
@ -58,30 +58,30 @@ public class TestGetChildren {
|
|||
.getHome("francesco.mangiacrapa")
|
||||
.getWorkspace();
|
||||
//
|
||||
_log.trace("Start getRoot...");
|
||||
_log.debug("Start getRoot...");
|
||||
|
||||
WorkspaceItem root = workspace.getRoot();
|
||||
|
||||
System.out.println(root.getChildren());
|
||||
|
||||
|
||||
_log.trace("GetRoot - Replyiing root");
|
||||
_log.debug("GetRoot - Replyiing root");
|
||||
long startTime = System.currentTimeMillis();
|
||||
_log.trace("start time - " + startTime);
|
||||
_log.debug("start time - " + startTime);
|
||||
|
||||
Item rootItem = ItemBuilder.getItem(null, root, showableTypes, filterCriteria, true);
|
||||
rootItem.setName(WorkspaceExplorerConstants.HOME_LABEL);
|
||||
|
||||
if(rootItem==null)
|
||||
throw new WorkspaceNavigatorServiceException("Sorry, an error occurred when performing get root");
|
||||
|
||||
rootItem.setName(WorkspaceExplorerConstants.HOME_LABEL);
|
||||
|
||||
if (purgeEmpyFolders) rootItem = ItemBuilder.purgeEmptyFolders(rootItem);
|
||||
|
||||
_log.trace("Returning:");
|
||||
_log.debug("Returning:");
|
||||
Long endTime = System.currentTimeMillis() - startTime;
|
||||
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
|
||||
_log.trace("end time - " + time);
|
||||
_log.debug("end time - " + time);
|
||||
|
||||
Collections.sort(rootItem.getChildren(), new ItemComparator());
|
||||
_log.info("Returning children size: "+rootItem.getChildren().size());
|
||||
_log.debug("Returning children size: "+rootItem.getChildren().size());
|
||||
|
||||
return rootItem;
|
||||
|
||||
|
|
Loading…
Reference in New Issue