VIVO-692 Restrict LOD by Publish level, not by Display level
Create a new annotation for properties and classes, HiddenFromPublishBelowRoleLevelAnnot. Provide the means to initialize these annotations, edit them, and display them in the verbose property display. Create a Permission and some requested actions so the policies can decide which statements must be filtered out, based on the user's role. Add unit tests and improve acceptance tests
This commit is contained in:
parent
95538e4c8a
commit
fdeee35bb4
55 changed files with 1977 additions and 251 deletions
|
@ -8,8 +8,6 @@ import java.util.HashSet;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||
import com.hp.hpl.jena.sdb.util.Pair;
|
||||
import com.hp.hpl.jena.vocabulary.OWL;
|
||||
|
||||
|
@ -27,7 +25,6 @@ public class PropertyRestrictionPolicyHelperStub extends
|
|||
return getInstance(null, null);
|
||||
}
|
||||
|
||||
|
||||
/** Prohibit some namespaces. */
|
||||
public static PropertyRestrictionPolicyHelperStub getInstance(
|
||||
String[] restrictedNamespaces) {
|
||||
|
@ -44,30 +41,28 @@ public class PropertyRestrictionPolicyHelperStub extends
|
|||
if (restrictedNamespaces != null) {
|
||||
namespaceSet.addAll(Arrays.asList(restrictedNamespaces));
|
||||
}
|
||||
|
||||
Map<Pair<String, Pair<String,String>>, RoleLevel> thresholdMap = new HashMap<
|
||||
Pair<String, Pair<String,String>>, RoleLevel>();
|
||||
|
||||
Map<Pair<String, Pair<String, String>>, RoleLevel> thresholdMap = new HashMap<>();
|
||||
if (restrictedProperties != null) {
|
||||
for (String prop : restrictedProperties) {
|
||||
thresholdMap.put(
|
||||
new Pair<String, Pair<String, String>>(
|
||||
OWL.Thing.getURI(), new Pair<String, String>(
|
||||
prop, OWL.Thing.getURI())),
|
||||
RoleLevel.NOBODY);
|
||||
thresholdMap.put(new Pair<String, Pair<String, String>>(
|
||||
OWL.Thing.getURI(), new Pair<String, String>(prop,
|
||||
OWL.Thing.getURI())), RoleLevel.NOBODY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return new PropertyRestrictionPolicyHelperStub(namespaceSet, null,
|
||||
null, thresholdMap);
|
||||
null, thresholdMap, null);
|
||||
}
|
||||
|
||||
private PropertyRestrictionPolicyHelperStub(
|
||||
Set<String> modifyRestrictedNamespaces,
|
||||
Set<String> modifyPermittedExceptions,
|
||||
Map<Pair<String, Pair<String,String>>, RoleLevel> displayThresholds,
|
||||
Map<Pair<String, Pair<String,String>>, RoleLevel> modifyThresholds) {
|
||||
Map<Pair<String, Pair<String, String>>, RoleLevel> displayThresholds,
|
||||
Map<Pair<String, Pair<String, String>>, RoleLevel> modifyThresholds,
|
||||
Map<Pair<String, Pair<String, String>>, RoleLevel> publishThresholds) {
|
||||
super(modifyRestrictedNamespaces, modifyPermittedExceptions,
|
||||
displayThresholds, modifyThresholds, ModelFactory.createDefaultModel());
|
||||
displayThresholds, modifyThresholds, publishThresholds);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -81,17 +81,17 @@ public class IndividualStub implements Individual {
|
|||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return getName();
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPickListName() {
|
||||
return getName();
|
||||
return getName();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<DataPropertyStatement> getDataPropertyStatements() {
|
||||
return new ArrayList<DataPropertyStatement>(dpsSet);
|
||||
|
@ -146,7 +146,6 @@ public class IndividualStub implements Individual {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isVClass(String vclassUri) {
|
||||
for (VClass vc : vClasses) {
|
||||
|
@ -263,6 +262,24 @@ public class IndividualStub implements Individual {
|
|||
"ResourceBean.setProhibitedFromUpdateBelowRoleLevelUsingRoleUri() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleLevel getHiddenFromPublishBelowRoleLevel() {
|
||||
throw new RuntimeException(
|
||||
"IndividualStub.getHiddenFromPublishBelowRoleLevel() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHiddenFromPublishBelowRoleLevel(RoleLevel eR) {
|
||||
throw new RuntimeException(
|
||||
"IndividualStub.setHiddenFromPublishBelowRoleLevel() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHiddenFromPublishBelowRoleLevelUsingRoleUri(String roleUri) {
|
||||
throw new RuntimeException(
|
||||
"IndividualStub.setHiddenFromPublishBelowRoleLevelUsingRoleUri() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Individual o) {
|
||||
throw new RuntimeException(
|
||||
|
@ -271,9 +288,10 @@ public class IndividualStub implements Individual {
|
|||
|
||||
@Override
|
||||
public List<String> getMostSpecificTypeURIs() {
|
||||
throw new RuntimeException("Individual.getMostSpecificTypeURIs() not implemented.");
|
||||
throw new RuntimeException(
|
||||
"Individual.getMostSpecificTypeURIs() not implemented.");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getRdfsLabel() {
|
||||
throw new RuntimeException("Individual.getRdfsLabel() not implemented.");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue