Loading src/main/java/it/inaf/oats/vospace/persistence/NodeDAO.java +36 −65 Original line number Diff line number Diff line Loading @@ -37,19 +37,6 @@ public class NodeDAO { public void createNode(Node myNode) { // check if parent path exist, else throw HTTP 404 , secondo specifica vospace /* Retrieve the path (ltree) and the relative_path (ltree) of the parent node: select path, relative_path from node n join node_vos_path p on n.node_id = p.node_id where p.vos_path = '/path/to/parent’ Then perform the insert using the path and relative_path to fill the parent_path and parent_relative_path columns of the new node. */ String nodeURI = myNode.getUri(); String path = nodeURI.replaceAll("vos://[^/]+", ""); String parentPath = getParentPath(path); Loading @@ -66,7 +53,6 @@ public class NodeDAO { return getPathsFromResultSet(row); }); if (paths.isEmpty()) { throw new IllegalStateException("Unable to find parent node during node creation"); } Loading @@ -93,7 +79,6 @@ public class NodeDAO { } public Optional<Node> listNode(String path) { String sql = "SELECT os.vos_path, n.node_id, type, async_trans, busy_state, owner_id, group_read, group_write, is_public, content_length, created_on, last_modified from node n\n" Loading Loading @@ -216,32 +201,22 @@ public class NodeDAO { return "vos://" + authority + path; } private NodePaths getPathsFromResultSet(ResultSet rs) throws SQLException { NodePaths paths = new NodePaths(rs.getString("path"), rs.getString("relative_path")); return paths; } private String getNodeName(String path) { String[] parsedPath = path.split("/"); return parsedPath[parsedPath.length - 1]; } private String getNodeName(Node myNode) { String uri = myNode.getUri(); return getNodeName(uri); } private boolean getIsBusy(Node myNode) { if (myNode instanceof DataNode) { Loading @@ -251,10 +226,8 @@ public class NodeDAO { } return false; } private String getParentPath(String path) { String[] parsedPath = path.split("/"); Loading @@ -267,7 +240,6 @@ public class NodeDAO { return sb.toString(); } private String getProperty(Node node, String uri) { for (Property property : node.getProperties()) { if (uri.equals(property.getUri())) { Loading Loading @@ -303,12 +275,11 @@ public class NodeDAO { this.path = myPath; this.parentPath = myParentPath; } @Override public String toString() { return parentPath + " " + path; } } } Loading
src/main/java/it/inaf/oats/vospace/persistence/NodeDAO.java +36 −65 Original line number Diff line number Diff line Loading @@ -37,19 +37,6 @@ public class NodeDAO { public void createNode(Node myNode) { // check if parent path exist, else throw HTTP 404 , secondo specifica vospace /* Retrieve the path (ltree) and the relative_path (ltree) of the parent node: select path, relative_path from node n join node_vos_path p on n.node_id = p.node_id where p.vos_path = '/path/to/parent’ Then perform the insert using the path and relative_path to fill the parent_path and parent_relative_path columns of the new node. */ String nodeURI = myNode.getUri(); String path = nodeURI.replaceAll("vos://[^/]+", ""); String parentPath = getParentPath(path); Loading @@ -66,7 +53,6 @@ public class NodeDAO { return getPathsFromResultSet(row); }); if (paths.isEmpty()) { throw new IllegalStateException("Unable to find parent node during node creation"); } Loading @@ -93,7 +79,6 @@ public class NodeDAO { } public Optional<Node> listNode(String path) { String sql = "SELECT os.vos_path, n.node_id, type, async_trans, busy_state, owner_id, group_read, group_write, is_public, content_length, created_on, last_modified from node n\n" Loading Loading @@ -216,32 +201,22 @@ public class NodeDAO { return "vos://" + authority + path; } private NodePaths getPathsFromResultSet(ResultSet rs) throws SQLException { NodePaths paths = new NodePaths(rs.getString("path"), rs.getString("relative_path")); return paths; } private String getNodeName(String path) { String[] parsedPath = path.split("/"); return parsedPath[parsedPath.length - 1]; } private String getNodeName(Node myNode) { String uri = myNode.getUri(); return getNodeName(uri); } private boolean getIsBusy(Node myNode) { if (myNode instanceof DataNode) { Loading @@ -251,10 +226,8 @@ public class NodeDAO { } return false; } private String getParentPath(String path) { String[] parsedPath = path.split("/"); Loading @@ -267,7 +240,6 @@ public class NodeDAO { return sb.toString(); } private String getProperty(Node node, String uri) { for (Property property : node.getProperties()) { if (uri.equals(property.getUri())) { Loading Loading @@ -303,12 +275,11 @@ public class NodeDAO { this.path = myPath; this.parentPath = myParentPath; } @Override public String toString() { return parentPath + " " + path; } } }