VIVO-782 Create PropertyDao.FullPropertyKey class.

Replaces Pair<String,Pair<String, String>> when building maps of Properties and FauxProperties.
This commit is contained in:
Jim Blake 2014-10-27 14:20:22 -04:00
parent 4a2321db41
commit 3b4e2bc012
5 changed files with 215 additions and 135 deletions

View file

@ -8,11 +8,9 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import com.hp.hpl.jena.sdb.util.Pair;
import com.hp.hpl.jena.vocabulary.OWL;
import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionPolicyHelper;
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel;
import edu.cornell.mannlib.vitro.webapp.dao.PropertyDao.FullPropertyKey;
/**
* Allow the unit test to specify a variety of restrictions
@ -42,12 +40,10 @@ public class PropertyRestrictionPolicyHelperStub extends
namespaceSet.addAll(Arrays.asList(restrictedNamespaces));
}
Map<Pair<String, Pair<String, String>>, RoleLevel> thresholdMap = new HashMap<>();
Map<FullPropertyKey, 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 FullPropertyKey(prop), RoleLevel.NOBODY);
}
}
@ -58,11 +54,10 @@ public class PropertyRestrictionPolicyHelperStub extends
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> publishThresholds) {
Map<FullPropertyKey, RoleLevel> displayThresholds,
Map<FullPropertyKey, RoleLevel> modifyThresholds,
Map<FullPropertyKey, RoleLevel> publishThresholds) {
super(modifyRestrictedNamespaces, modifyPermittedExceptions,
displayThresholds, modifyThresholds, publishThresholds);
}
}