Skip to content
Snippets Groups Projects
Commit af9345e9 authored by Sara Bertocco's avatar Sara Bertocco
Browse files

Working on task #3635 - Refactoring: create NodeUtils class

parent 5c4d42c2
No related branches found
No related tags found
No related merge requests found
Pipeline #959 passed
......@@ -8,6 +8,7 @@ package it.inaf.oats.vospace.datamodel;
import java.util.List;
import java.util.stream.Collectors;
import net.ivoa.xml.vospace.v2.Node;
import net.ivoa.xml.vospace.v2.Property;
/**
*
......@@ -44,6 +45,18 @@ public class NodeProperties {
public static final String TYPE_URI = "ivo://ivoa.net/vospace/core#type"; // the nature or genre of the resource
public static String getProperty(Node node, String propertyName) {
for (Property property : node.getProperties()) {
if (property.getUri().equals("ivo://ivoa.net/vospace/core#".concat(propertyName))) {
return property.getValue();
}
}
return null;
}
// Returns all properties stored inside the node under the requested
// property URI.
public static List<String> getNodePropertyByURI(Node node, String propertyURI) {
......
......@@ -87,10 +87,9 @@ public class NodeUtils {
public static boolean checkIfWritable(Node myNode, String userName, List<String> userGroups) {
// First check if parent node creator is == userid
List<String> nodeOwner
= NodeProperties.getNodePropertyByURI(myNode, NodeProperties.CREATOR_URI);
//= getNodePropertyByURI(
// toBeDeletedNode, "ivo://ivoa.net/vospace/core#creator");
if (nodeOwner == null
......@@ -125,7 +124,6 @@ public class NodeUtils {
}
// DUPLICATED code from CreateNodeController - END
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment