removing query for retreiving VRE root Folder
This commit is contained in:
parent
24576cd30f
commit
68eb65e168
2
pom.xml
2
pom.xml
|
@ -12,7 +12,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.gcube.data.access</groupId>
|
<groupId>org.gcube.data.access</groupId>
|
||||||
<artifactId>storagehub</artifactId>
|
<artifactId>storagehub</artifactId>
|
||||||
<version>1.3.1</version>
|
<version>1.3.2-SNAPSHOT</version>
|
||||||
<name>storagehub</name>
|
<name>storagehub</name>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
import javax.jcr.ItemNotFoundException;
|
||||||
import javax.jcr.Node;
|
import javax.jcr.Node;
|
||||||
import javax.jcr.NodeIterator;
|
import javax.jcr.NodeIterator;
|
||||||
import javax.jcr.RepositoryException;
|
import javax.jcr.RepositoryException;
|
||||||
|
@ -101,14 +102,24 @@ public class VREManager {
|
||||||
VRE vre = this.getVRE(groupName);
|
VRE vre = this.getVRE(groupName);
|
||||||
if (vre!=null) return vre;
|
if (vre!=null) return vre;
|
||||||
else {
|
else {
|
||||||
String query = String.format("SELECT * FROM [nthl:workspaceItem] As node WHERE node.[jcr:title] like '%s' AND ISDESCENDANTNODE('%s')",groupName, vrePath.toPath());
|
|
||||||
Query jcrQuery = ses.getWorkspace().getQueryManager().createQuery(query, Constants.QUERY_LANGUAGE);
|
Node shareNode = ses.getNode(Constants.SHARED_FOLDER_PATH);
|
||||||
NodeIterator it = jcrQuery.execute().getNodes();
|
|
||||||
|
NodeIterator it = shareNode.getNodes();
|
||||||
|
|
||||||
if (!it.hasNext()) throw new BackendGenericError("vre folder not found for context "+groupName);
|
Node vreFolderNode = null;
|
||||||
|
|
||||||
|
while (it.hasNext()) {
|
||||||
|
Node nextNode = it.nextNode();
|
||||||
|
if (nextNode.hasProperty("jcr:title") && nextNode.getProperty("jcr:title").getString().equals(groupName)) {
|
||||||
|
vreFolderNode = nextNode;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vreFolderNode==null) throw new ItemNotFoundException("vre folder not found for context "+groupName);
|
||||||
|
|
||||||
Node folder = it.nextNode();
|
Item vreFolder = node2Item.getItem(vreFolderNode, excludes);
|
||||||
Item vreFolder = node2Item.getItem(folder, excludes);
|
|
||||||
return this.putVRE(vreFolder);
|
return this.putVRE(vreFolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue