From 94d9307b4cc2a457f57401a3a97e1d9a9233602f Mon Sep 17 00:00:00 2001 From: lucio Date: Tue, 14 Apr 2020 18:52:59 +0200 Subject: [PATCH] refactoring of some classes --- .../NodeChildrenFilterIterator.java | 51 ++++++++++++ .../gcube/data/access/storagehub/Utils.java | 16 ++-- .../storagehub/handlers/ClassHandler.java | 9 +- .../storagehub/handlers/TrashHandler.java | 82 +++++++++++-------- .../handlers/VREQueryRetriever.java | 5 +- .../handlers/items/Item2NodeConverter.java | 26 ++++++ .../handlers/items/Node2ItemConverter.java | 3 + .../storagehub/services/WorkspaceManager.java | 25 ++++-- .../services/admin/ItemManager.java | 22 +++++ src/main/webapp/WEB-INF/README | 2 +- .../org/gcube/data/access/fs/Expressions.java | 11 ++- 11 files changed, 198 insertions(+), 54 deletions(-) create mode 100644 src/main/java/org/gcube/data/access/storagehub/NodeChildrenFilterIterator.java create mode 100644 src/main/java/org/gcube/data/access/storagehub/services/admin/ItemManager.java diff --git a/src/main/java/org/gcube/data/access/storagehub/NodeChildrenFilterIterator.java b/src/main/java/org/gcube/data/access/storagehub/NodeChildrenFilterIterator.java new file mode 100644 index 0000000..c88db26 --- /dev/null +++ b/src/main/java/org/gcube/data/access/storagehub/NodeChildrenFilterIterator.java @@ -0,0 +1,51 @@ +package org.gcube.data.access.storagehub; + +import java.util.Iterator; + +import javax.jcr.Node; +import javax.jcr.NodeIterator; +import javax.jcr.RepositoryException; + +import org.gcube.common.storagehub.model.exceptions.BackendGenericError; +import org.gcube.data.access.storagehub.handlers.ClassHandler; + +public class NodeChildrenFilterIterator implements Iterator { + + private NodeIterator it; + + public NodeChildrenFilterIterator(Node node) throws BackendGenericError{ + super(); + try { + it = node.getNodes(); + } catch (RepositoryException e) { + throw new BackendGenericError(e); + } + } + + public NodeChildrenFilterIterator(NodeIterator iterator) throws BackendGenericError{ + it = iterator; + + } + + private Node currentNode = null; + + @Override + public boolean hasNext() { + try { + while (it.hasNext()) { + currentNode=it.nextNode(); + if (ClassHandler.instance().get(currentNode.getPrimaryNodeType().getName())!=null) + return true; + } + return false; + }catch (RepositoryException e) { + throw new RuntimeException(e); + } + } + + @Override + public Node next() { + return currentNode; + } + +} diff --git a/src/main/java/org/gcube/data/access/storagehub/Utils.java b/src/main/java/org/gcube/data/access/storagehub/Utils.java index a8bc699..4faa79c 100644 --- a/src/main/java/org/gcube/data/access/storagehub/Utils.java +++ b/src/main/java/org/gcube/data/access/storagehub/Utils.java @@ -119,21 +119,21 @@ public class Utils { logger.debug("query for search is {}",xpath); long start = System.currentTimeMillis(); Query jcrQuery = ses.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH); - NodeIterator it = jcrQuery.execute().getNodes(); + NodeChildrenFilterIterator iterator = new NodeChildrenFilterIterator(jcrQuery.execute().getNodes()); logger.debug("[SEARCH] real search took {} millis",(System.currentTimeMillis()-start)); - return getItemListFromNodeIterator(authChecker, it, excludes, range, showHidden, excludeTrashed, nodeTypeToInclude); + return getItemListFromNodeIterator(authChecker, iterator , excludes, range, showHidden, excludeTrashed, nodeTypeToInclude); } public static List getItemList(Node parent, List excludes, Range range, boolean showHidden, Class nodeTypeToInclude) throws RepositoryException, BackendGenericError{ logger.trace("getting children of node {}", parent.getIdentifier()); long start = System.currentTimeMillis(); - NodeIterator iterator = parent.getNodes(); + NodeChildrenFilterIterator iterator = new NodeChildrenFilterIterator(parent); logger.trace("time to get iterator {}",(System.currentTimeMillis()-start)); return getItemListFromNodeIterator(null, iterator, excludes, range, showHidden, false, nodeTypeToInclude); } - private static List getItemListFromNodeIterator(AuthorizationChecker authChecker, NodeIterator iterator, List excludes, Range range, boolean showHidden, boolean excludeTrashed, Class nodeTypeToInclude) throws RepositoryException, BackendGenericError{ + private static List getItemListFromNodeIterator(AuthorizationChecker authChecker, NodeChildrenFilterIterator iterator, List excludes, Range range, boolean showHidden, boolean excludeTrashed, Class nodeTypeToInclude) throws RepositoryException, BackendGenericError{ List returnList = new ArrayList(); logger.trace("nodeType is {}",nodeTypeToInclude); @@ -142,7 +142,7 @@ public class Utils { Node2ItemConverter node2Item= new Node2ItemConverter(); Set duplicateId = new HashSet(); while (iterator.hasNext()){ - Node current = iterator.nextNode(); + Node current = iterator.next(); logger.debug("[SEARCH] evaluating node {} ",current.hasProperty(NodeProperty.TITLE.toString())? current.getProperty(NodeProperty.TITLE.toString()):current.getName()); @@ -152,7 +152,7 @@ public class Utils { continue; } - //ECLUDES node not authorized, in case the indexes are not working + //EXCLUDES node not authorized, in case the indexes are not working if (authChecker!=null) try { authChecker.checkReadAuthorizationControl(current.getSession(), current.getIdentifier()); @@ -269,10 +269,10 @@ public class Utils { public static boolean hasSharedChildren(Node node) throws RepositoryException, BackendGenericError{ Node2ItemConverter node2Item = new Node2ItemConverter(); - NodeIterator children = node.getNodes(); + NodeChildrenFilterIterator children = new NodeChildrenFilterIterator(node); while (children.hasNext()) { - Node child= children.nextNode(); + Node child= children.next(); if (node2Item.checkNodeType(child, SharedFolder.class)) return true; if (node2Item.checkNodeType(child, FolderItem.class) && hasSharedChildren(child)) return true; } diff --git a/src/main/java/org/gcube/data/access/storagehub/handlers/ClassHandler.java b/src/main/java/org/gcube/data/access/storagehub/handlers/ClassHandler.java index 0b35a7a..31a9f08 100644 --- a/src/main/java/org/gcube/data/access/storagehub/handlers/ClassHandler.java +++ b/src/main/java/org/gcube/data/access/storagehub/handlers/ClassHandler.java @@ -1,6 +1,8 @@ package org.gcube.data.access.storagehub.handlers; +import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Set; @@ -24,6 +26,10 @@ public class ClassHandler { private Reflections reflection = new Reflections(); + private List deprecatedNode = Arrays.asList("nthl:query", "nthl:aquamapsItem", "nthl:timeSeriesItem", "nthl:report", "nthl:reportTemplate", "nthl:workflowReport", + "nthl:workflowTemplate", "nthl:gCubeMetadata", "nthl:gCubeDocument", "nthl:gCubeDocumentLink", "nthl:gCubeImageDocumentLink", "nthl:gCubePDFDocumentLink", + "nthl:gCubeImageDocument", "nthl:gCubePDFDocument", "nthl:gCubeURLDocument", "nthl:gCubeAnnotation", "nthl:externalResourceLink", "nthl:tabularDataLink"); + private Map> classMap = new HashMap>(); private Map, String> typeMap = new HashMap, String>(); @@ -44,7 +50,8 @@ public class ClassHandler { public Class get(String nodeType){ if (classMap.containsKey(nodeType)) return classMap.get(nodeType); - else return Item.class; + if (deprecatedNode.contains(nodeType)) return Item.class; + return null; //throw new RuntimeException("mapping not found for nodetype "+ nodeType); } diff --git a/src/main/java/org/gcube/data/access/storagehub/handlers/TrashHandler.java b/src/main/java/org/gcube/data/access/storagehub/handlers/TrashHandler.java index 28b8fb8..aec6452 100644 --- a/src/main/java/org/gcube/data/access/storagehub/handlers/TrashHandler.java +++ b/src/main/java/org/gcube/data/access/storagehub/handlers/TrashHandler.java @@ -20,6 +20,7 @@ import org.gcube.common.authorization.library.provider.AuthorizationProvider; import org.gcube.common.storagehub.model.Excludes; import org.gcube.common.storagehub.model.Paths; import org.gcube.common.storagehub.model.exceptions.BackendGenericError; +import org.gcube.common.storagehub.model.exceptions.InvalidCallParameters; import org.gcube.common.storagehub.model.exceptions.ItemLockedException; import org.gcube.common.storagehub.model.exceptions.StorageHubException; import org.gcube.common.storagehub.model.exceptions.UserNotAuthorizedException; @@ -43,7 +44,7 @@ public class TrashHandler { private static Logger log = LoggerFactory.getLogger(TrashHandler.class); ExecutorService executor = Executors.newFixedThreadPool(100); - + @Inject VersionHandler versionHandler; @@ -55,13 +56,13 @@ public class TrashHandler { @Inject Item2NodeConverter item2Node; - + @Inject Node2ItemConverter node2Item; @Inject StorageBackendHandler storageHandler; - + public void removeNodes(Session ses, List itemsToDelete) throws RepositoryException, StorageHubException{ log.debug("defnitively removing nodes with ids {}",itemsToDelete); for (Item item: itemsToDelete) { @@ -70,7 +71,7 @@ public class TrashHandler { } private void removeNodesInternally(Session ses, Item itemToDelete) throws RepositoryException, StorageHubException { - + try { Set contentIdsToDelete = new HashSet<>(); @@ -84,12 +85,12 @@ public class TrashHandler { Utils.getAllContentIds(ses, contentIdsToDelete, itemToDelete, versionHandler); } nodeToDelete.remove(); - + log.debug("content ids to remove are {}",contentIdsToDelete); //String user = AuthorizationProvider.instance.get().getClient().getId(); Runnable deleteFromStorageRunnable = AuthorizedTasks.bind(new Runnable() { - + @Override public void run() { for (String id: contentIdsToDelete) { @@ -100,11 +101,11 @@ public class TrashHandler { log.warn("error removing file on storage with id {}",id, t); } } - + } }); executor.execute(deleteFromStorageRunnable); - + ses.save(); }catch (LockException e) { throw new ItemLockedException("the selected node or his parent is locked", e); @@ -181,51 +182,66 @@ public class TrashHandler { } - public String restoreItem(Session ses, TrashItem item) throws RepositoryException, BackendGenericError, UserNotAuthorizedException{ + public String restoreItem(Session ses, TrashItem item, FolderItem destination) throws RepositoryException, StorageHubException, BackendGenericError{ log.debug("restoring node from trash"); final String login = AuthorizationProvider.instance.get().getClient().getId(); //final Node trashFolder = ses.getNode(Paths.append(Utils.getHomePath(),Constants.TRASH_ROOT_FOLDER_NAME).toPath()); - boolean originalParentExists = true; - boolean originalParentTrashed = false; - Node originalParent = null; - try { - originalParent = ses.getNodeByIdentifier(item.getOriginalParentId()); - }catch (ItemNotFoundException e) { - originalParentExists = false; - } - - Item originalParentItem = null; - if (originalParentExists) { - originalParentItem = node2Item.getItem(originalParent, Excludes.ALL); - originalParentTrashed = originalParentItem.isTrashed(); - } - + Node destinationNode= null; - if(originalParentExists && !originalParentTrashed) { - authChecker.checkWriteAuthorizationControl(ses, originalParentItem, originalParent, false ); - destinationNode = originalParent; - }else { - String homeWS = Utils.getWorkspacePath(login).toPath(); - Node node = ses.getNode(homeWS); + if (destination==null) { + boolean originalParentExists = true; + boolean originalParentTrashed = false; + Node originalParent = null; + try { + originalParent = ses.getNodeByIdentifier(item.getOriginalParentId()); + }catch (ItemNotFoundException e) { + originalParentExists = false; + } + + Item originalParentItem = null; + if (originalParentExists) { + originalParentItem = node2Item.getItem(originalParent, Excludes.ALL); + originalParentTrashed = originalParentItem.isTrashed(); + } + + + if(originalParentExists && !originalParentTrashed) { + authChecker.checkWriteAuthorizationControl(ses, originalParentItem, originalParent, false ); + destinationNode = originalParent; + }else { + String homeWS = Utils.getWorkspacePath(login).toPath(); + Node node = ses.getNode(homeWS); + authChecker.checkWriteAuthorizationControl(ses, node.getIdentifier(), false ); + destinationNode = node; + } + } else { + Node node = ses.getNodeByIdentifier(destination.getId()); + + if (!node2Item.checkNodeType(node, FolderItem.class)) + throw new InvalidCallParameters("destination Node is not a folder"); + authChecker.checkWriteAuthorizationControl(ses, node.getIdentifier(), false ); destinationNode = node; } + + ses.getWorkspace().getLockManager().lock(destinationNode.getPath(), true, true, 0,login); - - ses.getWorkspace().getLockManager().lock(originalParent.getPath(), true, true, 0,login); + //the real node is a child of the Trash node List items = Utils.getItemList(ses.getNodeByIdentifier(item.getId()), Excludes.ALL, null, false, null); if (items.size()!=1) { log.warn("a problem occurred restoring item from trash"); throw new BackendGenericError("An error occurred on trash item"); } Item itemToMove = items.get(0); + + item2Node.updateOwnerOnSubTree(ses.getNodeByIdentifier(itemToMove.getId()), login); + String newNodePath = Paths.append(Paths.getPath(destinationNode.getPath()), itemToMove.getName()).toPath(); ses.move(itemToMove.getPath(), newNodePath); Utils.setPropertyOnChangeNode(ses.getNode(newNodePath), login, ItemAction.MOVED); ses.removeItem(item.getPath()); ses.save(); return ses.getNode(newNodePath).getIdentifier(); - } } diff --git a/src/main/java/org/gcube/data/access/storagehub/handlers/VREQueryRetriever.java b/src/main/java/org/gcube/data/access/storagehub/handlers/VREQueryRetriever.java index 499471e..c4d5dac 100644 --- a/src/main/java/org/gcube/data/access/storagehub/handlers/VREQueryRetriever.java +++ b/src/main/java/org/gcube/data/access/storagehub/handlers/VREQueryRetriever.java @@ -24,6 +24,7 @@ import org.apache.jackrabbit.util.ISO9075; import org.gcube.common.storagehub.model.Excludes; import org.gcube.common.storagehub.model.NodeConstants; import org.gcube.common.storagehub.model.items.Item; +import org.gcube.data.access.storagehub.NodeChildrenFilterIterator; import org.gcube.data.access.storagehub.handlers.items.Node2ItemConverter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -73,10 +74,10 @@ public class VREQueryRetriever implements Callable> { jcrQuery.setLimit(CACHE_DIMENSION); lastTimestamp = System.currentTimeMillis(); - NodeIterator it = jcrQuery.execute().getNodes(); + NodeChildrenFilterIterator it = new NodeChildrenFilterIterator(jcrQuery.execute().getNodes()); logger.debug("query for recents took {}",System.currentTimeMillis()-start); while (it.hasNext()) { - Node node = it.nextNode(); + Node node = it.next(); //long lastModifiedTimeItem = node.getProperty(NodeProperty.LAST_MODIFIED.toString()).getLong(); diff --git a/src/main/java/org/gcube/data/access/storagehub/handlers/items/Item2NodeConverter.java b/src/main/java/org/gcube/data/access/storagehub/handlers/items/Item2NodeConverter.java index 3e209d5..963b2dd 100644 --- a/src/main/java/org/gcube/data/access/storagehub/handlers/items/Item2NodeConverter.java +++ b/src/main/java/org/gcube/data/access/storagehub/handlers/items/Item2NodeConverter.java @@ -13,6 +13,7 @@ import java.util.Set; import javax.inject.Singleton; import javax.jcr.ItemExistsException; import javax.jcr.Node; +import javax.jcr.NodeIterator; import javax.jcr.PathNotFoundException; import javax.jcr.RepositoryException; import javax.jcr.Value; @@ -31,10 +32,13 @@ import org.gcube.common.storagehub.model.annotations.ListNodes; import org.gcube.common.storagehub.model.annotations.MapAttribute; import org.gcube.common.storagehub.model.annotations.NodeAttribute; import org.gcube.common.storagehub.model.annotations.RootNode; +import org.gcube.common.storagehub.model.exceptions.BackendGenericError; 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.types.ItemAction; import org.gcube.common.storagehub.model.types.NodeProperty; +import org.gcube.data.access.storagehub.NodeChildrenFilterIterator; import org.gcube.data.access.storagehub.Utils; import org.gcube.data.access.storagehub.handlers.ClassHandler; import org.slf4j.Logger; @@ -222,6 +226,28 @@ public class Item2NodeConverter { node.setProperty(NodeProperty.HIDDEN.toString(), hidden); } + + public void updateOwnerOnSubTree(Node node, String owner) throws RepositoryException, BackendGenericError { + Class classToHandle = (Class)ClassHandler.instance().get(node.getPrimaryNodeType().getName()); + if (classToHandle==null) return; + if (classToHandle.isAssignableFrom(FolderItem.class)) { + NodeChildrenFilterIterator iterator = new NodeChildrenFilterIterator(node); + while (iterator.hasNext()) { + Node nextNode = iterator.next(); + updateOwnerOnSubTree(nextNode, owner); + } + } + updateOwner(node, owner); + + } + + public void updateOwner(Node node, String owner) throws RepositoryException { + //Utils.setPropertyOnChangeNode(node, login, ItemAction.UPDATED); + if (node.hasProperty(NodeProperty.PORTAL_LOGIN.toString())) + node.setProperty(NodeProperty.PORTAL_LOGIN.toString(), owner); + else logger.debug("cannot set new owner to {} "+node.getPath()); + } + public void updateMetadataNode(Node node, Map meta, String login){ try { diff --git a/src/main/java/org/gcube/data/access/storagehub/handlers/items/Node2ItemConverter.java b/src/main/java/org/gcube/data/access/storagehub/handlers/items/Node2ItemConverter.java index 2682d41..95e164d 100644 --- a/src/main/java/org/gcube/data/access/storagehub/handlers/items/Node2ItemConverter.java +++ b/src/main/java/org/gcube/data/access/storagehub/handlers/items/Node2ItemConverter.java @@ -53,6 +53,7 @@ public class Node2ItemConverter { public T getFilteredItem(Node node, List excludes, Class nodeTypeToInclude) throws RepositoryException, BackendGenericError{ @SuppressWarnings("unchecked") Class classToHandle = (Class)ClassHandler.instance().get(node.getPrimaryNodeType().getName()); + if (classToHandle==null) return null; if (nodeTypeToInclude!=null && !(nodeTypeToInclude.isAssignableFrom(classToHandle))) return null; else return retrieveItem(node, excludes, classToHandle); } @@ -65,6 +66,7 @@ public class Node2ItemConverter { public T getItem(Node node, List excludes) throws RepositoryException, BackendGenericError{ @SuppressWarnings("unchecked") Class classToHandle = (Class)ClassHandler.instance().get(node.getPrimaryNodeType().getName()); + if (classToHandle==null) return null; /*Node nodeToRetrieve= node; if (SharedFolder.class.isAssignableFrom(classToHandle)) { NodeIterator it= node.getSharedSet(); @@ -323,6 +325,7 @@ public class Node2ItemConverter { return values; } + //Checks if a node is a subtype od classToCompare public boolean checkNodeType(Node node, Class classToCompare) throws BackendGenericError{ try { diff --git a/src/main/java/org/gcube/data/access/storagehub/services/WorkspaceManager.java b/src/main/java/org/gcube/data/access/storagehub/services/WorkspaceManager.java index 249d63a..c5d0a2d 100644 --- a/src/main/java/org/gcube/data/access/storagehub/services/WorkspaceManager.java +++ b/src/main/java/org/gcube/data/access/storagehub/services/WorkspaceManager.java @@ -17,6 +17,7 @@ import javax.jcr.query.QueryResult; import javax.servlet.ServletContext; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; +import javax.ws.rs.FormParam; import javax.ws.rs.GET; import javax.ws.rs.PUT; import javax.ws.rs.Path; @@ -30,12 +31,14 @@ import org.gcube.common.gxrest.response.outbound.GXOutboundErrorResponse; import org.gcube.common.storagehub.model.Excludes; import org.gcube.common.storagehub.model.Paths; import org.gcube.common.storagehub.model.exceptions.BackendGenericError; +import org.gcube.common.storagehub.model.exceptions.InvalidCallParameters; import org.gcube.common.storagehub.model.exceptions.InvalidItemException; import org.gcube.common.storagehub.model.exceptions.StorageHubException; import org.gcube.common.storagehub.model.exceptions.UserNotAuthorizedException; import org.gcube.common.storagehub.model.expressions.Expression; import org.gcube.common.storagehub.model.expressions.logical.And; import org.gcube.common.storagehub.model.expressions.logical.ISDescendant; +import org.gcube.common.storagehub.model.items.FolderItem; import org.gcube.common.storagehub.model.items.Item; import org.gcube.common.storagehub.model.items.TrashItem; import org.gcube.common.storagehub.model.service.ItemList; @@ -273,22 +276,22 @@ public class WorkspaceManager { } @PUT - @Consumes(MediaType.TEXT_PLAIN) + @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Path("trash/restore") - public String restoreItem(String identifier){ + public String restoreItem(@FormParam("trashedItemId") String trashedItemId,@FormParam("destinationId") String destinationFolderId){ InnerMethodName.instance.set("restoreItem"); Session ses = null; String toReturn = null; try{ - log.info("restoring node with id {}", identifier); + log.info("restoring node with id {}", trashedItemId); //TODO check if it is possible to change all the ACL on a workspace ses = repository.getRepository().login(CredentialHandler.getAdminCredentials(context)); //authChecker.checkWriteAuthorizationControl(ses, identifier, false); - final Node nodeToRestore = ses.getNodeByIdentifier(identifier); + final Node nodeToRestore = ses.getNodeByIdentifier(trashedItemId); Item itemToRestore = node2Item.getItem(nodeToRestore, Excludes.ALL); @@ -299,11 +302,21 @@ public class WorkspaceManager { org.gcube.common.storagehub.model.Path trashPath = Paths.append(Utils.getWorkspacePath(), Constants.TRASH_ROOT_FOLDER_NAME); if (!itemToRestore.getPath().startsWith(trashPath.toPath())) throw new UserNotAuthorizedException("this item is not in the user "+user+" trash"); + + Item destinationItem = null; + if (destinationFolderId!=null ) { + destinationItem = node2Item.getItem(ses.getNodeByIdentifier(destinationFolderId), Excludes.ALL); + if (!(destinationItem instanceof FolderItem)) + throw new InvalidCallParameters("destintation item is not a folder"); + + toReturn = trashHandler.restoreItem(ses, (TrashItem)itemToRestore, (FolderItem) destinationItem); + } else { + toReturn = trashHandler.restoreItem(ses, (TrashItem)itemToRestore, null); + } - toReturn = trashHandler.restoreItem(ses, (TrashItem)itemToRestore); }catch(RepositoryException re ){ - log.error("error restoring item with id {}",identifier, re); + log.error("error restoring item with id {}",trashedItemId, re); GXOutboundErrorResponse.throwException(new BackendGenericError(re)); }catch(StorageHubException she ){ log.error(she.getErrorMessage(), she); diff --git a/src/main/java/org/gcube/data/access/storagehub/services/admin/ItemManager.java b/src/main/java/org/gcube/data/access/storagehub/services/admin/ItemManager.java new file mode 100644 index 0000000..d4e8277 --- /dev/null +++ b/src/main/java/org/gcube/data/access/storagehub/services/admin/ItemManager.java @@ -0,0 +1,22 @@ +package org.gcube.data.access.storagehub.services.admin; + +import javax.jcr.Item; +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.MediaType; + +@Path("admin/items") +public class ItemManager { + + + @POST + @Consumes(MediaType.APPLICATION_JSON) + private String createItem(Item item) { + + + return null; + } + + +} diff --git a/src/main/webapp/WEB-INF/README b/src/main/webapp/WEB-INF/README index 5be5c6f..45dc4d8 100644 --- a/src/main/webapp/WEB-INF/README +++ b/src/main/webapp/WEB-INF/README @@ -25,7 +25,7 @@ The projects leading to this software have received funding from a series of Version -------------------------------------------------- -1.1.1-SNAPSHOT (2020-04-09) +1.1.1-SNAPSHOT (2020-04-14) Please see the file named "changelog.xml" in this directory for the release notes. diff --git a/src/test/java/org/gcube/data/access/fs/Expressions.java b/src/test/java/org/gcube/data/access/fs/Expressions.java index 9218943..b9f9806 100644 --- a/src/test/java/org/gcube/data/access/fs/Expressions.java +++ b/src/test/java/org/gcube/data/access/fs/Expressions.java @@ -9,6 +9,7 @@ import org.gcube.common.storagehub.model.expressions.GenericSearchableItem; import org.gcube.common.storagehub.model.expressions.date.Before; import org.gcube.common.storagehub.model.expressions.logical.And; import org.gcube.common.storagehub.model.expressions.text.Contains; +import org.gcube.data.access.storagehub.Constants; import org.gcube.data.access.storagehub.query.sql2.evaluators.Evaluators; import org.junit.Test; import org.slf4j.Logger; @@ -37,9 +38,13 @@ public class Expressions { @Test public void test2() { - String groupId ="/gcube/devsec/devVre"; - String title = groupId.substring(groupId.lastIndexOf("/")+1); - System.out.println(title); + + String workspace ="/Share/22228279-0793-4b68-b7c9-81489b68a355/Frosini - Resource Registry.MP4"; + + String rpl1 = workspace.replaceAll("/Home/[^/]*/"+Constants.WORKSPACE_ROOT_FOLDER_NAME,""); + String rpl2 = workspace.replaceAll("/Share", ""); + System.out.println(rpl1+" ---- "+rpl2 ); + }