Skip to content
Snippets Groups Projects
Commit 31002aaf authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Retrieved sticky property

parent 722dd5be
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,6 @@ import javax.servlet.http.HttpServletRequest; ...@@ -11,7 +11,6 @@ import javax.servlet.http.HttpServletRequest;
import net.ivoa.xml.uws.v1.JobSummary; import net.ivoa.xml.uws.v1.JobSummary;
import net.ivoa.xml.uws.v1.ResultReference; import net.ivoa.xml.uws.v1.ResultReference;
import net.ivoa.xml.vospace.v2.Node; import net.ivoa.xml.vospace.v2.Node;
import net.ivoa.xml.vospace.v2.Property;
import net.ivoa.xml.vospace.v2.Protocol; import net.ivoa.xml.vospace.v2.Protocol;
import net.ivoa.xml.vospace.v2.Transfer; import net.ivoa.xml.vospace.v2.Transfer;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -74,7 +73,7 @@ public class UriService { ...@@ -74,7 +73,7 @@ public class UriService {
// TODO add token for authenticated access // TODO add token for authenticated access
String endpoint = fileServiceUrl + relativePath + "?jobId=" + job.getJobId(); String endpoint = fileServiceUrl + relativePath + "?jobId=" + job.getJobId();
if (!"true".equals(NodeProperties.getProperty(node, "publicread"))) { if (!"true".equals(NodeProperties.getNodePropertyByURI(node, NodeProperties.PUBLIC_READ_URI))) {
endpoint += "&token=" + getEndpointToken(fileServiceUrl + relativePath); endpoint += "&token=" + getEndpointToken(fileServiceUrl + relativePath);
} }
......
...@@ -23,7 +23,6 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -23,7 +23,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public class NodeDAO { public class NodeDAO {
...@@ -89,7 +88,7 @@ public class NodeDAO { ...@@ -89,7 +88,7 @@ public class NodeDAO {
public Optional<Node> listNode(String path) { public Optional<Node> listNode(String path) {
String sql = "SELECT os.vos_path, n.node_id, type, async_trans, busy_state, creator_id, group_read, group_write,\n" String sql = "SELECT os.vos_path, n.node_id, type, async_trans, sticky, busy_state, creator_id, group_read, group_write,\n"
+ "is_public, content_length, created_on, last_modified, accept_views, provide_views\n" + "is_public, content_length, created_on, last_modified, accept_views, provide_views\n"
+ "FROM node n\n" + "FROM node n\n"
+ "JOIN node_vos_path os ON n.node_id = os.node_id\n" + "JOIN node_vos_path os ON n.node_id = os.node_id\n"
...@@ -178,12 +177,14 @@ public class NodeDAO { ...@@ -178,12 +177,14 @@ public class NodeDAO {
addProperty(getPropertyURI("groupwrite"), getGroupsString(rs, "group_write"), addProperty(getPropertyURI("groupwrite"), getGroupsString(rs, "group_write"),
properties); properties);
addProperty(getPropertyURI("publicread"), rs.getString("is_public"), addProperty(getPropertyURI("publicread"), String.valueOf(rs.getBoolean("is_public")),
properties); properties);
addProperty("urn:async_trans", rs.getString("async_trans"), addProperty("urn:async_trans", String.valueOf(rs.getBoolean("async_trans")),
properties); properties);
addProperty("urn:sticky", String.valueOf(rs.getBoolean("sticky")), properties);
node.setProperties(properties); node.setProperties(properties);
return node; return node;
} }
...@@ -205,7 +206,7 @@ public class NodeDAO { ...@@ -205,7 +206,7 @@ public class NodeDAO {
+ "async_trans, busy_state, owner_id, creator_id, group_read, " + "async_trans, busy_state, owner_id, creator_id, group_read, "
+ "group_write, is_public, delta, content_type, content_encoding, " + "group_write, is_public, delta, content_type, content_encoding, "
+ "content_length, content_md5, created_on, last_modified, " + "content_length, content_md5, created_on, last_modified, "
+ "accept_views, provide_views, protocols)\n"; + "accept_views, provide_views, protocols, sticky)\n";
String deleteSql = "DELETE \n" String deleteSql = "DELETE \n"
+ "FROM node n\n" + "FROM node n\n"
...@@ -218,7 +219,7 @@ public class NodeDAO { ...@@ -218,7 +219,7 @@ public class NodeDAO {
+ "async_trans, busy_state, owner_id, creator_id, group_read, " + "async_trans, busy_state, owner_id, creator_id, group_read, "
+ "group_write, is_public, delta, content_type, content_encoding, " + "group_write, is_public, delta, content_type, content_encoding, "
+ "content_length, content_md5, created_on, last_modified, " + "content_length, content_md5, created_on, last_modified, "
+ "accept_views, provide_views, protocols\n"; + "accept_views, provide_views, protocols, sticky\n";
String withSql = "WITH del AS (" + deleteSql + ")"; String withSql = "WITH del AS (" + deleteSql + ")";
......
package it.inaf.oats.vospace.persistence; package it.inaf.oats.vospace.persistence;
import it.inaf.oats.vospace.datamodel.NodeProperties;
import it.inaf.oats.vospace.datamodel.NodeUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.sql.DataSource; import javax.sql.DataSource;
...@@ -54,6 +56,8 @@ public class NodeDAOTest { ...@@ -54,6 +56,8 @@ public class NodeDAOTest {
ContainerNode root = (ContainerNode) dao.listNode("/").get(); ContainerNode root = (ContainerNode) dao.listNode("/").get();
assertEquals(2, root.getNodes().size()); assertEquals(2, root.getNodes().size());
assertEquals("true", NodeProperties.getNodePropertyAsListByURI(root, NodeProperties.PUBLIC_READ_URI).get(0));
assertEquals("group1 group2", getProperty(root.getNodes().get(0), "ivo://ivoa.net/vospace/core#groupread")); assertEquals("group1 group2", getProperty(root.getNodes().get(0), "ivo://ivoa.net/vospace/core#groupread"));
} }
......
DELETE FROM node; DELETE FROM node;
ALTER SEQUENCE node_node_id_seq RESTART WITH 1; ALTER SEQUENCE node_node_id_seq RESTART WITH 1;
INSERT INTO node (parent_path, parent_relative_path, name, type, owner_id, creator_id, location_id) VALUES (NULL, NULL, '', 'container', '0', '0', 1); INSERT INTO node (parent_path, parent_relative_path, name, type, owner_id, creator_id, location_id, is_public) VALUES (NULL, NULL, '', 'container', '0', '0', 1, true);
INSERT INTO node (parent_path, parent_relative_path, name, type, owner_id, creator_id, group_read, group_write, location_id) VALUES ('', NULL, 'test1', 'container', 'user1', 'user1', '{"group1","group2"}','{"group2"}', 1); -- /test1 INSERT INTO node (parent_path, parent_relative_path, name, type, owner_id, creator_id, group_read, group_write, location_id) VALUES ('', NULL, 'test1', 'container', 'user1', 'user1', '{"group1","group2"}','{"group2"}', 1); -- /test1
INSERT INTO node (parent_path, parent_relative_path, name, type, owner_id, creator_id, location_id) VALUES ('2', '', 'f1', 'container', 'user1', 'user1', 1); -- /test1/f1 (rel: /f1) INSERT INTO node (parent_path, parent_relative_path, name, type, owner_id, creator_id, location_id) VALUES ('2', '', 'f1', 'container', 'user1', 'user1', 1); -- /test1/f1 (rel: /f1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment