Loading src/main/java/it/inaf/oats/vospace/persistence/NodeDAO.java +5 −5 Original line number Diff line number Diff line Loading @@ -45,10 +45,10 @@ public class NodeDAO { public Node listNode(String path) { String sql = "SELECT os.os_path, n.node_id, type, async_trans, owner_id, group_read, group_write, is_public, content_length, created_on, last_modified from node n\n" + "JOIN node_os_path os ON n.node_id = os.node_id\n" String sql = "SELECT os.vos_path, n.node_id, type, async_trans, owner_id, group_read, group_write, is_public, content_length, created_on, last_modified from node n\n" + "JOIN node_vos_path os ON n.node_id = os.node_id\n" + "WHERE n.path ~ (" + getFirstLevelChildrenSelector(path) + ")::lquery\n" + "OR os.os_path = ? ORDER BY os_path"; + "OR os.vos_path = ? ORDER BY vos_path"; List<Node> parentAndChildren = jdbcTemplate.query(conn -> { PreparedStatement ps = conn.prepareStatement(sql); Loading @@ -74,7 +74,7 @@ public class NodeDAO { } private String getFirstLevelChildrenSelector(String path) { String select = "(SELECT path FROM node WHERE node_id = (SELECT node_id FROM node_os_path WHERE os_path = ?))::varchar || '"; String select = "(SELECT path FROM node WHERE node_id = (SELECT node_id FROM node_vos_path WHERE vos_path = ?))::varchar || '"; if (!"/".equals(path)) { select += "."; Loading @@ -86,7 +86,7 @@ public class NodeDAO { private Node getNodeFromResultSet(ResultSet rs) throws SQLException { Node node = getTypedNode(rs.getString("type")); node.setUri(getUri(rs.getString("os_path"))); node.setUri(getUri(rs.getString("vos_path"))); return node; } Loading src/test/java/it/inaf/oats/vospace/persistence/DataSourceConfig.java +1 −1 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ public class DataSourceConfig { File currentDir = new File(DataSourceConfig.class.getClassLoader().getResource(".").getFile()); Path scriptDir = currentDir.toPath().resolve(scriptPath); List<String> scripts = Arrays.asList("00-init.sql", "01-pgsql_path.sql", "03-indexes.sql", "05-data.sql", "06-os_path_view.sql"); List<String> scripts = Arrays.asList("00-init.sql", "01-pgsql_path.sql", "02-indexes.sql", "03-os_path_view.sql", "05-data.sql"); for (String script : scripts) { ByteArrayResource scriptResource = replaceDollarQuoting(scriptDir.resolve(script)); Loading src/test/java/it/inaf/oats/vospace/persistence/NodeDAOTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,6 @@ public class NodeDAOTest { @Test public void testListNode() { ContainerNode root = (ContainerNode) dao.listNode("/"); assertEquals(1, root.getNodes().size()); assertEquals(4, root.getNodes().size()); } } Loading
src/main/java/it/inaf/oats/vospace/persistence/NodeDAO.java +5 −5 Original line number Diff line number Diff line Loading @@ -45,10 +45,10 @@ public class NodeDAO { public Node listNode(String path) { String sql = "SELECT os.os_path, n.node_id, type, async_trans, owner_id, group_read, group_write, is_public, content_length, created_on, last_modified from node n\n" + "JOIN node_os_path os ON n.node_id = os.node_id\n" String sql = "SELECT os.vos_path, n.node_id, type, async_trans, owner_id, group_read, group_write, is_public, content_length, created_on, last_modified from node n\n" + "JOIN node_vos_path os ON n.node_id = os.node_id\n" + "WHERE n.path ~ (" + getFirstLevelChildrenSelector(path) + ")::lquery\n" + "OR os.os_path = ? ORDER BY os_path"; + "OR os.vos_path = ? ORDER BY vos_path"; List<Node> parentAndChildren = jdbcTemplate.query(conn -> { PreparedStatement ps = conn.prepareStatement(sql); Loading @@ -74,7 +74,7 @@ public class NodeDAO { } private String getFirstLevelChildrenSelector(String path) { String select = "(SELECT path FROM node WHERE node_id = (SELECT node_id FROM node_os_path WHERE os_path = ?))::varchar || '"; String select = "(SELECT path FROM node WHERE node_id = (SELECT node_id FROM node_vos_path WHERE vos_path = ?))::varchar || '"; if (!"/".equals(path)) { select += "."; Loading @@ -86,7 +86,7 @@ public class NodeDAO { private Node getNodeFromResultSet(ResultSet rs) throws SQLException { Node node = getTypedNode(rs.getString("type")); node.setUri(getUri(rs.getString("os_path"))); node.setUri(getUri(rs.getString("vos_path"))); return node; } Loading
src/test/java/it/inaf/oats/vospace/persistence/DataSourceConfig.java +1 −1 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ public class DataSourceConfig { File currentDir = new File(DataSourceConfig.class.getClassLoader().getResource(".").getFile()); Path scriptDir = currentDir.toPath().resolve(scriptPath); List<String> scripts = Arrays.asList("00-init.sql", "01-pgsql_path.sql", "03-indexes.sql", "05-data.sql", "06-os_path_view.sql"); List<String> scripts = Arrays.asList("00-init.sql", "01-pgsql_path.sql", "02-indexes.sql", "03-os_path_view.sql", "05-data.sql"); for (String script : scripts) { ByteArrayResource scriptResource = replaceDollarQuoting(scriptDir.resolve(script)); Loading
src/test/java/it/inaf/oats/vospace/persistence/NodeDAOTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,6 @@ public class NodeDAOTest { @Test public void testListNode() { ContainerNode root = (ContainerNode) dao.listNode("/"); assertEquals(1, root.getNodes().size()); assertEquals(4, root.getNodes().size()); } }