|
|
|
@ -2,7 +2,6 @@ package org.gcube.portlets.user.workspaceexplorerapp.server;
|
|
|
|
|
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
@ -73,7 +72,7 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public Item getRoot(List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException {
|
|
|
|
|
logger.debug("getRoot showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+ filterCriteria);
|
|
|
|
|
logger.info("getRoot showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+ filterCriteria);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
@ -106,7 +105,7 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
|
|
|
|
logger.trace("Returning:");
|
|
|
|
|
Long endTime = System.currentTimeMillis() - startTime;
|
|
|
|
|
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
|
|
|
|
|
logger.info("end time - " + time);
|
|
|
|
|
logger.info("getRoot end time - " + time);
|
|
|
|
|
|
|
|
|
|
Collections.sort(rootItem.getChildren(), new ItemComparator());
|
|
|
|
|
logger.info("Returning children size: "+rootItem.getChildren().size());
|
|
|
|
@ -132,7 +131,7 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public Item getFolder(Item item, List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException {
|
|
|
|
|
logger.debug("getFolder item: "+item+" showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
|
|
|
|
|
logger.info("called getFolder item: "+item+" showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
|
|
|
|
|
|
|
|
|
|
WorkspaceItem workspaceItem = null;
|
|
|
|
|
Workspace workspace = null;
|
|
|
|
@ -173,7 +172,7 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
|
|
|
|
logger.trace("Returning:");
|
|
|
|
|
Long endTime = System.currentTimeMillis() - startTime;
|
|
|
|
|
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
|
|
|
|
|
logger.info("end time - " + time);
|
|
|
|
|
logger.info("getFolder end time - " + time);
|
|
|
|
|
|
|
|
|
|
Collections.sort(itemFolder.getChildren(), new ItemComparator());
|
|
|
|
|
|
|
|
|
@ -197,7 +196,7 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public Item getMySpecialFolder(List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException {
|
|
|
|
|
logger.trace("GetMySpecialFolder showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
|
|
|
|
|
logger.info("called getMySpecialFolder showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
@ -223,7 +222,7 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
|
|
|
|
logger.trace("Returning:");
|
|
|
|
|
Long endTime = System.currentTimeMillis() - startTime;
|
|
|
|
|
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
|
|
|
|
|
logger.trace("end time - " + time);
|
|
|
|
|
logger.info("getMySpecialFolder end time - " + time);
|
|
|
|
|
Collections.sort(itemFolder.getChildren(), new ItemComparator());
|
|
|
|
|
return itemFolder;
|
|
|
|
|
|
|
|
|
@ -241,8 +240,8 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
|
|
|
|
* @return the list parents by item identifier
|
|
|
|
|
* @throws Exception the exception
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<Item> getBreadcrumbsByItemIdentifier(String itemIdentifier, boolean includeItemAsParent) throws Exception {
|
|
|
|
|
//@Override
|
|
|
|
|
/*public List<Item> getBreadcrumbsByItemIdentifier(String itemIdentifier, boolean includeItemAsParent) throws Exception {
|
|
|
|
|
logger.trace("ListParents By Item Identifier "+ itemIdentifier);
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
@ -303,9 +302,8 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
|
|
|
|
}else
|
|
|
|
|
arrayParents = new Item[parents.size()-1];
|
|
|
|
|
|
|
|
|
|
/** HANDLE MY_SPECIAL_FOLDER TO AVOID COMPLETE PATH WORKSPACE/MY_SPECIAL_FOLDER
|
|
|
|
|
* BUT RETURNING ONLY /MY_SPECIAL_FOLDER
|
|
|
|
|
*/
|
|
|
|
|
// HANDLE MY_SPECIAL_FOLDER TO AVOID COMPLETE PATH WORKSPACE/MY_SPECIAL_FOLDER BUT RETURNING ONLY /MY_SPECIAL_FOLDER
|
|
|
|
|
|
|
|
|
|
if(wsItem.isFolder()){
|
|
|
|
|
if(ItemBuilder.isSpecialFolder((WorkspaceFolder) wsItem, lastItem.isRoot())){
|
|
|
|
|
return new ArrayList<Item>(Arrays.asList(arrayParents));
|
|
|
|
@ -348,7 +346,7 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
|
|
|
|
logger.error("Error in get List Parents By Item Identifier ", e);
|
|
|
|
|
throw new Exception("Sorry, an error occurred during path retrieving!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the parents by item identifier to limit.
|
|
|
|
@ -361,7 +359,7 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<Item> getBreadcrumbsByItemIdentifierToParentLimit(String itemIdentifier, String parentLimit, boolean includeItemAsParent) throws Exception {
|
|
|
|
|
logger.trace("getBreadcrumbsByItemIdentifierToParentLimit by Item Identifier " + itemIdentifier +" and limit: "+parentLimit + " and includeItemAsParent: "+includeItemAsParent);
|
|
|
|
|
logger.info("called getBreadcrumbsByItemIdentifierToParentLimit by Item Identifier " + itemIdentifier +" and limit: "+parentLimit + " and includeItemAsParent: "+includeItemAsParent);
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
Workspace workspace = getWorkspace();
|
|
|
|
@ -371,7 +369,7 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
|
|
|
|
try{
|
|
|
|
|
parents = workspace.getParentsById(itemIdentifier);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
logger.error("Error on getting list of parents from HL for id: "+itemIdentifier, e);
|
|
|
|
|
logger.error("Error on getting list of parents from SHUB for id: "+itemIdentifier, e);
|
|
|
|
|
parents = new ArrayList<WorkspaceItem>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -513,8 +511,8 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public String getPublicLinkForItemId(String itemId) throws Exception{
|
|
|
|
|
logger.info("calle getPublicLinkForItemId: "+ itemId);
|
|
|
|
|
|
|
|
|
|
logger.trace("get Public Link For ItemId: "+ itemId);
|
|
|
|
|
try{
|
|
|
|
|
|
|
|
|
|
if(itemId==null)
|
|
|
|
|