the select and save dialog work
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@167667 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f1b444b2dc
commit
29e0405e97
|
@ -21,7 +21,7 @@ public class Util {
|
|||
|
||||
// public static final NumberFormat numberFormatterKB = NumberFormat.getFormat("#,##0 KB;(#,##0 KB)");
|
||||
|
||||
public static final ItemType[] FOLDERS = new ItemType[] {ItemType.FOLDER};
|
||||
public static final ItemType[] FOLDERS = new ItemType[] {ItemType.FOLDER, ItemType.PRIVATE_FOLDER, ItemType.SHARED_FOLDER, ItemType.VRE_FOLDER};
|
||||
|
||||
/**
|
||||
* Checks if is folder.
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
|
@ -179,7 +179,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
// we make a copy of showable types
|
||||
List<ItemType> showableTypesParam = new ArrayList<ItemType>(showableTypes);
|
||||
|
||||
// we get sure that folders are displayed
|
||||
// we make sure that folders are displayed
|
||||
for (ItemType folder : Util.FOLDERS) {
|
||||
if (!showableTypesParam.contains(folder))
|
||||
showableTypesParam.add(folder);
|
||||
|
@ -198,6 +198,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
}
|
||||
|
||||
public void onSuccess(Item item) {
|
||||
GWT.log("Succes getting root");
|
||||
eventBus.fireEvent(new RootLoadedEvent(item));
|
||||
updateExplorer(item.getChildren());
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ public class ItemBuilder {
|
|||
itemName = shared.isVreFolder()?shared.getDisplayName():workspaceItem.getTitle();
|
||||
isFolder = true;
|
||||
}
|
||||
|
||||
|
||||
// _log.debug("Building Item for: "+itemName);
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item item = null;
|
||||
try{
|
||||
|
@ -273,15 +273,12 @@ public class ItemBuilder {
|
|||
* @return the folder item type
|
||||
*/
|
||||
protected static ItemType getFolderItemType(Item item){
|
||||
System.out.println("***\n\n\"+getFolderItemType " + item.getTitle());
|
||||
if (item instanceof SharedFolder || item instanceof VreFolder) {
|
||||
SharedFolder folder = (SharedFolder) item;
|
||||
if (folder.isVreFolder())
|
||||
return ItemType.VRE_FOLDER;
|
||||
System.out.println("***" + item.getTitle() + " is a SHARED FOLDER");
|
||||
return ItemType.SHARED_FOLDER;
|
||||
} else if (item instanceof FolderItem) {
|
||||
System.out.println("***" + item.getTitle() + " is a PRIVATE FOLDER");
|
||||
return ItemType.PRIVATE_FOLDER;
|
||||
}
|
||||
_log.warn("Item Type non found: ");
|
||||
|
@ -468,9 +465,16 @@ public class ItemBuilder {
|
|||
if(wsFolder.getParentId() == null){ //IS ROOT
|
||||
name = WorkspaceExplorerConstants.HOME_LABEL;
|
||||
isRoot = true;
|
||||
}else if(wsFolder.isShared()){ //MANAGEMENT SHARED FOLDER NAME
|
||||
SharedFolder shared = (SharedFolder) wsFolder;
|
||||
name = shared.isVreFolder()?shared.getDisplayName():shared.getTitle();
|
||||
}
|
||||
else if(wsFolder.isShared()){ //MANAGEMENT SHARED FOLDER NAME
|
||||
if (wsFolder instanceof SharedFolder) {
|
||||
SharedFolder shared = (SharedFolder) wsFolder;
|
||||
name = shared.isVreFolder() ? shared.getDisplayName() : shared.getTitle();
|
||||
}
|
||||
else {
|
||||
FolderItem shared = (FolderItem) wsFolder;
|
||||
name = shared.getTitle();
|
||||
}
|
||||
//MANAGEMENT SPECIAL FOLDER
|
||||
}else if(isSpecialFolder(wsFolder)){
|
||||
name = WorkspaceExplorerConstants.VRE_FOLDERS_LABEL;
|
||||
|
|
|
@ -5,10 +5,10 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.storagehub.model.items.AbstractFileItem;
|
||||
import org.gcube.common.storagehub.model.items.FolderItem;
|
||||
import org.gcube.common.storagehub.model.items.Item;
|
||||
import org.gcube.common.storagehub.model.items.SharedFolder;
|
||||
|
@ -37,14 +37,17 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
|||
@SuppressWarnings("serial")
|
||||
public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implements WorkspaceExplorerService {
|
||||
|
||||
public static final Logger logger = LoggerFactory.getLogger(WorkspaceExplorerServiceImpl.class);
|
||||
public static final Logger _log = LoggerFactory.getLogger(WorkspaceExplorerServiceImpl.class);
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.gcube.portlets.widgets.wsexplorer.shared.Item getRoot(List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException {
|
||||
logger.trace("getRoot showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+ filterCriteria);
|
||||
|
||||
public org.gcube.portlets.widgets.wsexplorer.shared.Item getRoot(
|
||||
List<ItemType> showableTypes,
|
||||
boolean purgeEmpyFolders,
|
||||
FilterCriteria filterCriteria)
|
||||
throws WorkspaceNavigatorServiceException {
|
||||
_log.trace("getRoot showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+ filterCriteria);
|
||||
try {
|
||||
PortalContext pContext = PortalContext.getConfiguration();
|
||||
String userName = pContext.getCurrentUser(getThreadLocalRequest()).getUsername();
|
||||
|
@ -52,13 +55,9 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
String authorizationToken = pContext.getCurrentUserToken(scope, userName);
|
||||
SecurityTokenProvider.instance.set(authorizationToken);
|
||||
|
||||
logger.trace("Start getRoot...");
|
||||
_log.trace("Start getRoot...");
|
||||
Item root = Whorespace.getRoot(getThreadLocalRequest());
|
||||
|
||||
logger.trace("GetRoot - Replyiing root");
|
||||
long startTime = System.currentTimeMillis();
|
||||
logger.trace("start time - " + startTime);
|
||||
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item rootItem = ItemBuilder.getItem(null, root, root.getPath(), showableTypes, filterCriteria, true, false);
|
||||
rootItem.setName(WorkspaceExplorerConstants.HOME_LABEL);
|
||||
rootItem.setIsRoot(true);
|
||||
|
@ -66,18 +65,12 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
if (purgeEmpyFolders) {
|
||||
rootItem = ItemBuilder.purgeEmptyFolders(rootItem);
|
||||
}
|
||||
|
||||
logger.trace("Returning:");
|
||||
Long endTime = System.currentTimeMillis() - startTime;
|
||||
logger.debug("end time - " + String.format("%d msc %d sec", endTime - startTime, TimeUnit.MILLISECONDS.toSeconds(endTime)));
|
||||
|
||||
Collections.sort(rootItem.getChildren(), new ItemComparator());
|
||||
logger.info("Returning children size: "+rootItem.getChildren().size());
|
||||
|
||||
_log.info("->Returning children size: "+rootItem.getChildren().size());
|
||||
return rootItem;
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error during root retrieving", e);
|
||||
_log.error("Error during root retrieving", e);
|
||||
e.printStackTrace();
|
||||
throw new WorkspaceNavigatorServiceException("Sorry, an error occurred when performing get root");
|
||||
}
|
||||
}
|
||||
|
@ -86,8 +79,13 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.gcube.portlets.widgets.wsexplorer.shared.Item getFolder(ItemInterface item, List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria, boolean loadGcubeProperties) throws WorkspaceNavigatorServiceException {
|
||||
logger.trace("getFolder folderId: "+item.getId()+" showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
|
||||
public org.gcube.portlets.widgets.wsexplorer.shared.Item getFolder(
|
||||
ItemInterface item, List<ItemType> showableTypes,
|
||||
boolean purgeEmpyFolders,
|
||||
FilterCriteria filterCriteria,
|
||||
boolean loadGcubeProperties)
|
||||
throws WorkspaceNavigatorServiceException {
|
||||
_log.trace("getFolder folderId: "+item.getId()+" showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
|
||||
|
||||
try {
|
||||
|
||||
|
@ -97,7 +95,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
String authorizationToken = pContext.getCurrentUserToken(scope, userName);
|
||||
SecurityTokenProvider.instance.set(authorizationToken);
|
||||
Item folder = Whorespace.getItem(getThreadLocalRequest(), item.getId());
|
||||
logger.trace("GetFolder - Replying folder");
|
||||
_log.trace("GetFolder - Replying folder");
|
||||
|
||||
//TO AVOID SLOW CALL getPATH()
|
||||
String folderPath = item.getPath()!=null && !item.getPath().isEmpty()?item.getPath():folder.getPath();
|
||||
|
@ -109,12 +107,12 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
}
|
||||
|
||||
Collections.sort(itemFolder.getChildren(), new ItemComparator());
|
||||
logger.info("Returning children size: "+itemFolder.getChildren().size());
|
||||
_log.info("Returning children size: "+itemFolder.getChildren().size());
|
||||
|
||||
return itemFolder;
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error during folder retrieving", e);
|
||||
_log.error("Error during folder retrieving", e);
|
||||
throw new WorkspaceNavigatorServiceException("Sorry, an error occurred when performing get folder");
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +129,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
*/
|
||||
@Override
|
||||
public org.gcube.portlets.widgets.wsexplorer.shared.Item getItemByCategory(ItemCategory category) throws WorkspaceNavigatorServiceException{
|
||||
logger.trace("GetItemByCategory category: "+category);
|
||||
_log.trace("GetItemByCategory category: "+category);
|
||||
PortalContext pContext = PortalContext.getConfiguration();
|
||||
String userName = pContext.getCurrentUser(getThreadLocalRequest()).getUsername();
|
||||
String scope = pContext.getCurrentScope(getThreadLocalRequest());
|
||||
|
@ -157,7 +155,16 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
case VRE_FOLDER:{
|
||||
String vreFolderId = Whorespace.getVREFoldersId(getThreadLocalRequest());
|
||||
Item folder = Whorespace.getItem(getThreadLocalRequest(), vreFolderId);
|
||||
item = new org.gcube.portlets.widgets.wsexplorer.shared.Item(null, folder.getId(), WorkspaceExplorerConstants.VRE_FOLDERS_LABEL, ItemType.FOLDER, folder.getPath(), folder.getOwner(), null, true, false);
|
||||
item = new org.gcube.portlets.widgets.wsexplorer.shared.Item(
|
||||
null,
|
||||
folder.getId(),
|
||||
WorkspaceExplorerConstants.VRE_FOLDERS_LABEL,
|
||||
ItemType.FOLDER,
|
||||
folder.getPath(),
|
||||
folder.getOwner(),
|
||||
null,
|
||||
true,
|
||||
false);
|
||||
//SET SPECIAL FOLDER /Workspace/MySpecialFolders
|
||||
item.setSpecialFolder(true);
|
||||
break;
|
||||
|
@ -165,7 +172,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
}
|
||||
return item;
|
||||
} catch (Exception e) {
|
||||
logger.error("Error during get item by category", e);
|
||||
_log.error("Error during get item by category", e);
|
||||
throw new WorkspaceNavigatorServiceException("Sorry, an error occurred when performing get item by category");
|
||||
}
|
||||
}
|
||||
|
@ -174,8 +181,12 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public org.gcube.portlets.widgets.wsexplorer.shared.Item getMySpecialFolder(List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException {
|
||||
logger.trace("GetMySpecialFolder showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
|
||||
public org.gcube.portlets.widgets.wsexplorer.shared.Item getMySpecialFolder(
|
||||
List<ItemType> showableTypes,
|
||||
boolean purgeEmpyFolders,
|
||||
FilterCriteria filterCriteria)
|
||||
throws WorkspaceNavigatorServiceException {
|
||||
_log.trace("GetMySpecialFolder showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
|
||||
|
||||
try {
|
||||
PortalContext pContext = PortalContext.getConfiguration();
|
||||
|
@ -186,35 +197,23 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
String vreFolderId = Whorespace.getVREFoldersId(getThreadLocalRequest());
|
||||
Item folder = Whorespace.getItem(getThreadLocalRequest(), vreFolderId);
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
logger.trace("start time - " + startTime);
|
||||
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item itemFolder = ItemBuilder.getItem(null, folder, folder.getPath(), showableTypes, filterCriteria, true, false);
|
||||
//OVERRIDING VRE FOLDERS NAME - SET SPECIAL FOLDER /Workspace/MySpecialFolders
|
||||
itemFolder.setName(WorkspaceExplorerConstants.VRE_FOLDERS_LABEL);
|
||||
itemFolder.setSpecialFolder(true);
|
||||
|
||||
logger.trace("Builded MySpecialFolder: "+itemFolder);
|
||||
_log.trace("Builded MySpecialFolder: "+itemFolder);
|
||||
|
||||
logger.trace("Only showable types:");
|
||||
//printName("", folderItem);
|
||||
_log.trace("Only showable types:");
|
||||
|
||||
if (purgeEmpyFolders) {
|
||||
itemFolder = ItemBuilder.purgeEmptyFolders(itemFolder);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
//printName("", folderItem);
|
||||
Collections.sort(itemFolder.getChildren(), new ItemComparator());
|
||||
return itemFolder;
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error during special folders retrieving", e);
|
||||
_log.error("Error during special folders retrieving", e);
|
||||
throw new WorkspaceNavigatorServiceException("Sorry, an error occurred when performing get My Special Folder");
|
||||
}
|
||||
}
|
||||
|
@ -225,20 +224,12 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
*/
|
||||
@Override
|
||||
public boolean checkName(String name) throws WorkspaceNavigatorServiceException {
|
||||
logger.warn("checkName name NOT IMPLEMENTED: "+name);
|
||||
_log.warn("checkName name NOT IMPLEMENTED: "+name);
|
||||
return true; //TODO:
|
||||
}
|
||||
|
||||
/*protected void printName(String indentation, Item item)
|
||||
{
|
||||
if(item!=null){
|
||||
_log.trace(indentation+item.getName());
|
||||
for (Item child:item.getChildren()) printName(indentation+"\t", child);
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Gets Breadcrumbs (the list of parents) by item identifier.
|
||||
* Gets Breadcrumbs (the list of parents) by item identifier and name ( the name is added as last item of the breadcrumb)
|
||||
*
|
||||
* @param itemIdentifier the item identifier
|
||||
* @param includeItemAsParent - if parameter is true and item passed in input is a folder, the folder is included in path returned as last parent
|
||||
|
@ -246,18 +237,27 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public ArrayList<org.gcube.portlets.widgets.wsexplorer.shared.Item> getBreadcrumbsByItemIdentifier(String itemIdentifier, String itemName, boolean includeItemAsParent) throws Exception {
|
||||
logger.trace("ListParents By Item Identifier "+ itemIdentifier);
|
||||
public ArrayList<org.gcube.portlets.widgets.wsexplorer.shared.Item> getBreadcrumbsByItemIdentifier(
|
||||
String itemIdentifier, String itemName, boolean includeItemAsParent)
|
||||
throws Exception {
|
||||
System.out.println("ListParents By Item id "+ itemIdentifier + " name="+itemName);
|
||||
try {
|
||||
List<? extends Item> parents = Whorespace.getParents(getThreadLocalRequest(), itemIdentifier);
|
||||
System.out.println("parents size: "+parents.size() + " follows them in order");
|
||||
ArrayList<org.gcube.portlets.widgets.wsexplorer.shared.Item> toReturn = new ArrayList<>(parents.size());
|
||||
for (Item item : parents) {
|
||||
if (item instanceof SharedFolder)
|
||||
toReturn.add( ItemBuilder.buildFolderForBreadcrumbs((SharedFolder) item, null));
|
||||
else
|
||||
toReturn.add( ItemBuilder.buildFolderForBreadcrumbs((FolderItem) item, null));
|
||||
System.out.println("->"+item.getTitle());
|
||||
}
|
||||
Collections.reverse(toReturn);
|
||||
|
||||
String theClickedFolderName = (itemName == null || itemName.equals("")) ? "current folder" : itemName;
|
||||
toReturn.add(new org.gcube.portlets.widgets.wsexplorer.shared.Item(itemIdentifier, theClickedFolderName, true)); //this is the last non clickable item on the BC
|
||||
return toReturn;
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in get List Parents By Item Identifier ", e);
|
||||
_log.error("Error in get List Parents By Item Identifier ", e);
|
||||
throw new Exception("Sorry, an error occurred during path retrieving!");
|
||||
}
|
||||
}
|
||||
|
@ -273,18 +273,12 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
*/
|
||||
@Override
|
||||
public List<org.gcube.portlets.widgets.wsexplorer.shared.Item> getBreadcrumbsByItemIdentifierToParentLimit(String itemIdentifier, String parentLimit, boolean includeItemAsParent) throws Exception {
|
||||
logger.trace("getBreadcrumbsByItemIdentifierToParentLimit by Item Identifier " + itemIdentifier +" and limit: "+parentLimit);
|
||||
_log.trace("getBreadcrumbsByItemIdentifierToParentLimit by Item Identifier " + itemIdentifier +" and limit: "+parentLimit);
|
||||
try {
|
||||
|
||||
Item wsItem = Whorespace.getItem(getThreadLocalRequest(), itemIdentifier);
|
||||
System.out.println("**** workspace retrieved item name: "+wsItem.getName());
|
||||
List<? extends Item> parents = Whorespace.getParents(getThreadLocalRequest(), itemIdentifier);
|
||||
System.out.println("parents size: "+parents.size() + " follows them in order");
|
||||
for (Item item : parents) {
|
||||
System.out.println("parent: "+item.getTitle());
|
||||
}
|
||||
System.out.println("parents size: "+parents.size());
|
||||
logger.trace("parents size: "+parents.size());
|
||||
_log.trace("parents size: "+parents.size());
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item[] arrayParents;
|
||||
|
||||
if(includeItemAsParent==true && wsItem instanceof FolderItem){
|
||||
|
@ -302,33 +296,33 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
*/
|
||||
if( wsItem instanceof FolderItem){
|
||||
if(ItemBuilder.isSpecialFolder((FolderItem) wsItem)){
|
||||
logger.debug("item id is special folder, returning");
|
||||
_log.debug("item id is special folder, returning");
|
||||
return new ArrayList<org.gcube.portlets.widgets.wsexplorer.shared.Item>(Arrays.asList(arrayParents));
|
||||
}
|
||||
|
||||
if(itemIdentifier.compareTo(parentLimit)==0){
|
||||
logger.debug("item and parent limit are identical element, returning");
|
||||
_log.debug("item and parent limit are identical element, returning");
|
||||
return new ArrayList<org.gcube.portlets.widgets.wsexplorer.shared.Item>(Arrays.asList(arrayParents));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//CONVERTING PATH
|
||||
logger.trace("converting path from second-last..");
|
||||
_log.trace("converting path from second-last..");
|
||||
for (int i = parents.size()-2; i >= 0; i--) {
|
||||
FolderItem wsParentFolder = (FolderItem) parents.get(i);
|
||||
arrayParents[i] = ItemBuilder.buildFolderForBreadcrumbs(wsParentFolder, null);
|
||||
if(arrayParents[i].isSpecialFolder()){ //SKIP HOME PARENT FOR MY_SPECIAL_FOLDER
|
||||
logger.info("arrayParents index "+i+" is special folder, break");
|
||||
_log.info("arrayParents index "+i+" is special folder, break");
|
||||
break;
|
||||
}else if(parentLimit.compareTo(arrayParents[i].getId())==0){
|
||||
logger.info("reached parent limit "+parentLimit+", break");
|
||||
_log.info("reached parent limit "+parentLimit+", break");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//SET PARENTS
|
||||
logger.trace("setting parents..");
|
||||
_log.trace("setting parents..");
|
||||
for(int i=0; i<arrayParents.length-1; i++){
|
||||
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item parent = arrayParents[i];
|
||||
|
@ -339,7 +333,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
}
|
||||
}
|
||||
|
||||
logger.trace("ListParents return size: "+arrayParents.length);
|
||||
_log.trace("ListParents return size: "+arrayParents.length);
|
||||
if(arrayParents[0]==null){ //EXIT BY BREAK IN CASE OF SPECIAL FOLDER OR REACHED PARENT LIMIT
|
||||
List<org.gcube.portlets.widgets.wsexplorer.shared.Item> breadcrumbs = new ArrayList<org.gcube.portlets.widgets.wsexplorer.shared.Item>();
|
||||
for (int i=1; i<arrayParents.length; i++) {
|
||||
|
@ -354,7 +348,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in get List Parents By Item Identifier ", e);
|
||||
_log.error("Error in get List Parents By Item Identifier ", e);
|
||||
throw new Exception("Sorry, an error occurred during path retrieving!");
|
||||
}
|
||||
}
|
||||
|
@ -411,27 +405,20 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
*/
|
||||
@Override
|
||||
public String getMimeType(String itemId) throws Exception {
|
||||
return "";
|
||||
//TODO: implement later
|
||||
//
|
||||
// logger.info("get MimeType By ItemId "+ itemId);
|
||||
// try {
|
||||
// Item wsItem = Whorespace.getItem(getThreadLocalRequest(), itemId);
|
||||
// logger.trace("workspace retrieve item name: "+wsItem.getName());
|
||||
//
|
||||
//
|
||||
// if(! (wsItem instanceof FolderItem)) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// FolderItem folderItem = (FolderItem) wsItem;
|
||||
// //TODO:folderItem.getMimeType();
|
||||
// return "unknown";
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// logger.error("get MimeType By ItemId ", e);
|
||||
// throw new Exception(e.getMessage());
|
||||
// }
|
||||
_log.debug("get MimeType By ItemId "+ itemId);
|
||||
try {
|
||||
Item wsItem = Whorespace.getItem(getThreadLocalRequest(), itemId);
|
||||
_log.trace("workspace retrieve item name: "+wsItem.getName());
|
||||
if((wsItem instanceof FolderItem)) //if is a folder no mime
|
||||
return null;
|
||||
|
||||
AbstractFileItem file = (AbstractFileItem) wsItem;
|
||||
return file.getContent().getMimeType();
|
||||
|
||||
} catch (Exception e) {
|
||||
_log.error("get MimeType By ItemId ", e);
|
||||
throw new Exception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -484,7 +471,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
}
|
||||
return false;
|
||||
}catch(Exception e){
|
||||
logger.error("Error in server isASharedFolder", e);
|
||||
_log.error("Error in server isASharedFolder", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -504,11 +491,11 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
public String getReadableSizeByItemId(String itemId) throws Exception {
|
||||
|
||||
try{
|
||||
logger.info("getFormattedSize ByItemId "+ itemId);
|
||||
_log.info("getFormattedSize ByItemId "+ itemId);
|
||||
long size = getSizeByItemId(itemId);
|
||||
return StringUtil.readableFileSize(size);
|
||||
} catch (Exception e) {
|
||||
logger.error("getFormattedSize By ItemId ", e);
|
||||
_log.error("getFormattedSize By ItemId ", e);
|
||||
throw new Exception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
@ -525,7 +512,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
@Override
|
||||
public org.gcube.portlets.widgets.wsexplorer.shared.Item createFolder(String nameFolder, String description, String parentId) throws Exception {
|
||||
|
||||
logger.debug("creating folder: "+nameFolder +", parent id: "+parentId);
|
||||
_log.debug("creating folder: "+nameFolder +", parent id: "+parentId);
|
||||
//TODO
|
||||
return null;
|
||||
// try {
|
||||
|
@ -595,7 +582,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
*/
|
||||
@Override
|
||||
public Map<String, String> getGcubePropertiesForWorspaceId(String id) throws Exception {
|
||||
logger.trace("getGcubePropertiesForWorspaceId "+id);
|
||||
_log.trace("getGcubePropertiesForWorspaceId "+id);
|
||||
//TODO
|
||||
return null;
|
||||
// try {
|
||||
|
@ -625,7 +612,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
FilterCriteria filterCriteria, boolean loadGcubeProperties,
|
||||
final int startIndex, final int limit, final int serverStartIndex) throws WorkspaceNavigatorServiceException {
|
||||
|
||||
logger.trace("getFolder folderId: "+item.getId()+" showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
|
||||
_log.trace("getFolder folderId: "+item.getId()+" showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
|
||||
|
||||
try {
|
||||
|
||||
|
@ -633,7 +620,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
|
||||
int searchStartIndex = startIndex < serverStartIndex? serverStartIndex : startIndex;
|
||||
//logger.trace("GetFolder - Replyiing folder");
|
||||
logger.debug("MyLg getFolder searchIndex: "+searchStartIndex+", limit: "+limit);
|
||||
_log.debug("MyLg getFolder searchIndex: "+searchStartIndex+", limit: "+limit);
|
||||
//long startTime = System.currentTimeMillis();
|
||||
//logger.trace("start time - " + startTime);
|
||||
|
||||
|
@ -643,18 +630,18 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
|
||||
SearchedFolder sf = new SearchedFolder(itemFolderToReturn, startIndex, limit, searchStartIndex, false);
|
||||
int currentListCount = sf.getFolder().getChildren().size();
|
||||
logger.debug("MyLg Total item returning is: "+currentListCount);
|
||||
_log.debug("MyLg Total item returning is: "+currentListCount);
|
||||
|
||||
FolderItem hlFolder = (FolderItem) folder;
|
||||
int folderChildrenCount = Whorespace.getItemChildrenCount(getThreadLocalRequest(), hlFolder.getId());
|
||||
logger.debug("MyLg Folder children count is: "+folderChildrenCount);
|
||||
_log.debug("MyLg Folder children count is: "+folderChildrenCount);
|
||||
|
||||
if(currentListCount == limit || folderChildrenCount==0){
|
||||
logger.debug("Page completed returning "+currentListCount+ " items");
|
||||
_log.debug("Page completed returning "+currentListCount+ " items");
|
||||
int offset = searchStartIndex+limit;
|
||||
Collections.sort(sf.getFolder().getChildren(), new ItemComparator());
|
||||
sf.setServerSearchFinished(offset>folderChildrenCount || folderChildrenCount == 0);
|
||||
logger.debug("is Search finished: "+sf.isServerSearchFinished());
|
||||
_log.debug("is Search finished: "+sf.isServerSearchFinished());
|
||||
return sf;
|
||||
}
|
||||
|
||||
|
@ -664,25 +651,25 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
int offsetStartIndex = searchStartIndex;
|
||||
boolean pageOffsetOut = false;
|
||||
while(currentListCount < limit && !sf.isServerSearchFinished() && !pageOffsetOut){ //&& SEARCH NOT ULTIMATED
|
||||
logger.debug("MyLg new WHILE Items count: "+currentListCount+" is less than limit..");
|
||||
_log.debug("MyLg new WHILE Items count: "+currentListCount+" is less than limit..");
|
||||
|
||||
int newstartIndex = offsetStartIndex+limit+1;
|
||||
logger.debug("MyLg NewStartIndex is startIndex+limit: "+newstartIndex);
|
||||
_log.debug("MyLg NewStartIndex is startIndex+limit: "+newstartIndex);
|
||||
|
||||
//THERE ARE OTHER CHILDREN OVER NEW START INDEX
|
||||
if(newstartIndex < folderChildrenCount){
|
||||
//newLimit = limit - childrenToReturn.size();
|
||||
logger.debug("MyLg getting items with index start: "+newstartIndex + ", limit: "+limit);
|
||||
_log.debug("MyLg getting items with index start: "+newstartIndex + ", limit: "+limit);
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item newItemFolder = ItemBuilder.getItem(null, folder, folderPath, showableTypes, filterCriteria, true, loadGcubeProperties, newstartIndex, limit);
|
||||
int diff = limit - currentListCount; //How items are remaining
|
||||
//int offset = 0;
|
||||
logger.debug("MyLg new search start: "+newstartIndex + ", diff: "+diff+ ", retrieved: "+newItemFolder.getChildren().size());
|
||||
_log.debug("MyLg new search start: "+newstartIndex + ", diff: "+diff+ ", retrieved: "+newItemFolder.getChildren().size());
|
||||
if(diff >= newItemFolder.getChildren().size()){
|
||||
logger.debug("MyLg Adding sublist from 0 to 'diff' "+diff+" to children");
|
||||
_log.debug("MyLg Adding sublist from 0 to 'diff' "+diff+" to children");
|
||||
childrenToReturn.addAll(newItemFolder.getChildren().subList(0, newItemFolder.getChildren().size()));
|
||||
//offset = diff;
|
||||
}else{
|
||||
logger.debug("MyLg PageOffsetOut, the sublist size: "+newItemFolder.getChildren().size()+ " is greather than (limit-currentListCount)"+diff+" leaving WHILE...");
|
||||
_log.debug("MyLg PageOffsetOut, the sublist size: "+newItemFolder.getChildren().size()+ " is greather than (limit-currentListCount)"+diff+" leaving WHILE...");
|
||||
//childrenToReturn.addAll(newItemFolder.getChildren().subList(0, newItemFolder.getChildren().size()));
|
||||
//offset = newItemFolder.getChildren().size();
|
||||
pageOffsetOut = true;
|
||||
|
@ -690,10 +677,10 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
offsetStartIndex = newstartIndex;
|
||||
currentListCount = childrenToReturn.size();
|
||||
//int realServerEndIndex = newstartIndex+offset;
|
||||
logger.debug("MyLg New items count is: "+currentListCount + " serverEndIndex: "+offsetStartIndex);
|
||||
_log.debug("MyLg New items count is: "+currentListCount + " serverEndIndex: "+offsetStartIndex);
|
||||
sf.setServerEndIndex(offsetStartIndex);
|
||||
}else{
|
||||
logger.debug("MyLg New start index (oldStartIndex+limit) is grather than folder children count, search is finished");
|
||||
_log.debug("MyLg New start index (oldStartIndex+limit) is grather than folder children count, search is finished");
|
||||
sf.setServerSearchFinished(true);
|
||||
}
|
||||
}
|
||||
|
@ -716,11 +703,11 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
// }
|
||||
|
||||
Collections.sort(itemFolderToReturn.getChildren(), new ItemComparator());
|
||||
logger.debug("Returning: "+sf);
|
||||
_log.debug("Returning: "+sf);
|
||||
return sf;
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error during folder retrieving", e);
|
||||
_log.error("Error during folder retrieving", e);
|
||||
throw new WorkspaceNavigatorServiceException("Sorry, an error occurred when performing get folder");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ package org.gcube.portlets.widgets.wsexplorer.shared;
|
|||
* Jun 18, 2015
|
||||
*/
|
||||
public enum ItemType {
|
||||
PRIVATE_FOLDER, //MANDATORY
|
||||
PRIVATE_FOLDER,
|
||||
SHARED_FOLDER,
|
||||
VRE_FOLDER,
|
||||
FOLDER, //MANDATORY
|
||||
|
|
|
@ -25,6 +25,7 @@ m%n
|
|||
log4j.logger.org.apache.jasper.compiler.TldLocationsCache.level=ERROR, CA
|
||||
#AVOID LOGGING EHCACHE Hearbeat problem
|
||||
log4j.logger.net.sf.ehcache.distribution.PayloadUtil=OFF, CA
|
||||
log4j.loggercom.liferay.portal.kernel.log.Jdk14LogImpl=OFF, CA
|
||||
|
||||
log4j.logger.org.gcube.portal.notifications=INFO, CA
|
||||
log4j.logger.org.gcube.common.scope.impl=INFO, CA
|
||||
|
|
Loading…
Reference in New Issue