Merge branch 'maint-rel-1.6' into develop
This commit is contained in:
commit
09dd8da784
19 changed files with 276 additions and 229 deletions
|
@ -12,6 +12,9 @@ import java.util.Set;
|
|||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Resource;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
|
@ -21,6 +24,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatementImpl;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
|
||||
/**
|
||||
* Mock the basic functions of Individual for unit tests.
|
||||
|
@ -31,6 +35,8 @@ public class IndividualStub implements Individual {
|
|||
// ----------------------------------------------------------------------
|
||||
|
||||
private final String uri;
|
||||
private final String namespace;
|
||||
private final String localName;
|
||||
|
||||
private final Set<DataPropertyStatement> dpsSet = new HashSet<DataPropertyStatement>();
|
||||
private final Set<ObjectPropertyStatement> opsSet = new HashSet<ObjectPropertyStatement>();
|
||||
|
@ -40,27 +46,25 @@ public class IndividualStub implements Individual {
|
|||
|
||||
public IndividualStub(String uri) {
|
||||
this.uri = uri;
|
||||
Resource r = ResourceFactory.createResource(uri);
|
||||
this.namespace = r.getNameSpace();
|
||||
this.localName = r.getLocalName();
|
||||
}
|
||||
|
||||
public void addDataPropertyStatement(String predicateUri, String object) {
|
||||
dpsSet.add(new DataPropertyStatementImpl(this.uri, predicateUri, object));
|
||||
}
|
||||
|
||||
public void addObjectPropertyStatement(String predicateUri, String objectUri) {
|
||||
opsSet.add(new ObjectPropertyStatementImpl(this.uri, predicateUri,
|
||||
objectUri));
|
||||
public void addObjectPropertyStatement(ObjectProperty property, String objectUri) {
|
||||
ObjectPropertyStatementImpl ops = new ObjectPropertyStatementImpl();
|
||||
ops.setSubject(this);
|
||||
ops.setProperty(property);
|
||||
ops.setObjectURI(objectUri);
|
||||
opsSet.add(ops);
|
||||
}
|
||||
|
||||
public void addPopulatedObjectPropertyStatement(String predicateUri,
|
||||
String objectUri, Individual object) {
|
||||
ObjectPropertyStatementImpl stmt = new ObjectPropertyStatementImpl(
|
||||
this.uri, predicateUri, objectUri);
|
||||
stmt.setObject(object);
|
||||
opsSet.add(stmt);
|
||||
}
|
||||
|
||||
public void addVclass(String namespace, String localname, String vClassName) {
|
||||
vClasses.add(new VClass(namespace, localname, vClassName));
|
||||
public void addVclass(String ns, String localname, String vClassName) {
|
||||
vClasses.add(new VClass(ns, localname, vClassName));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -72,6 +76,22 @@ public class IndividualStub implements Individual {
|
|||
return uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAnonymous() {
|
||||
return (this.uri == null || VitroVocabulary.PSEUDO_BNODE_NS.equals(this
|
||||
.getNamespace()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalName() {
|
||||
return this.localName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespace() {
|
||||
return this.namespace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
|
@ -166,12 +186,6 @@ public class IndividualStub implements Individual {
|
|||
// does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalName() {
|
||||
// Useless for now.
|
||||
return "BOGUS Local Name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public VClass getVClass() {
|
||||
for (VClass vc : vClasses) {
|
||||
|
@ -197,69 +211,57 @@ public class IndividualStub implements Individual {
|
|||
// Un-implemented methods
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean isAnonymous() {
|
||||
throw new RuntimeException(
|
||||
"ResourceBean.isAnonymous() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setURI(String URI) {
|
||||
throw new RuntimeException("ResourceBean.setURI() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespace() {
|
||||
throw new RuntimeException(
|
||||
"ResourceBean.getNamespace() not implemented.");
|
||||
throw new RuntimeException("IndividualStub.setURI() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNamespace(String namespace) {
|
||||
throw new RuntimeException(
|
||||
"ResourceBean.setNamespace() not implemented.");
|
||||
"IndividualStub.setNamespace() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocalName(String localName) {
|
||||
throw new RuntimeException(
|
||||
"ResourceBean.setLocalName() not implemented.");
|
||||
"IndividualStub.setLocalName() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleLevel getHiddenFromDisplayBelowRoleLevel() {
|
||||
throw new RuntimeException(
|
||||
"ResourceBean.getHiddenFromDisplayBelowRoleLevel() not implemented.");
|
||||
"IndividualStub.getHiddenFromDisplayBelowRoleLevel() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHiddenFromDisplayBelowRoleLevel(RoleLevel eR) {
|
||||
throw new RuntimeException(
|
||||
"ResourceBean.setHiddenFromDisplayBelowRoleLevel() not implemented.");
|
||||
"IndividualStub.setHiddenFromDisplayBelowRoleLevel() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHiddenFromDisplayBelowRoleLevelUsingRoleUri(String roleUri) {
|
||||
throw new RuntimeException(
|
||||
"ResourceBean.setHiddenFromDisplayBelowRoleLevelUsingRoleUri() not implemented.");
|
||||
"IndividualStub.setHiddenFromDisplayBelowRoleLevelUsingRoleUri() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleLevel getProhibitedFromUpdateBelowRoleLevel() {
|
||||
throw new RuntimeException(
|
||||
"ResourceBean.getProhibitedFromUpdateBelowRoleLevel() not implemented.");
|
||||
"IndividualStub.getProhibitedFromUpdateBelowRoleLevel() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProhibitedFromUpdateBelowRoleLevel(RoleLevel eR) {
|
||||
throw new RuntimeException(
|
||||
"ResourceBean.setProhibitedFromUpdateBelowRoleLevel() not implemented.");
|
||||
"IndividualStub.setProhibitedFromUpdateBelowRoleLevel() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProhibitedFromUpdateBelowRoleLevelUsingRoleUri(String roleUri) {
|
||||
throw new RuntimeException(
|
||||
"ResourceBean.setProhibitedFromUpdateBelowRoleLevelUsingRoleUri() not implemented.");
|
||||
"IndividualStub.setProhibitedFromUpdateBelowRoleLevelUsingRoleUri() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue