NIHVIVO-1232 Give the object property statement actions a common ancestor. Make them immutable objects.
This commit is contained in:
parent
b1fe45f9ff
commit
1e099fd488
5 changed files with 90 additions and 94 deletions
|
@ -1,41 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces;
|
||||
|
||||
/**
|
||||
* A base class for actions that work with a triple.
|
||||
*
|
||||
* @author bdc34
|
||||
*
|
||||
*/
|
||||
public abstract class ThreeParameterAction implements RequestedAction{
|
||||
|
||||
//TODO: these should not be public
|
||||
public String uriOfSubject;
|
||||
public String uriOfObject;
|
||||
public String uriOfPredicate;
|
||||
|
||||
public String getUriOfObject() {
|
||||
return uriOfObject;
|
||||
}
|
||||
public void setUriOfObject(String uriOfObject) {
|
||||
this.uriOfObject = uriOfObject;
|
||||
}
|
||||
public String getUriOfPredicate() {
|
||||
return uriOfPredicate;
|
||||
}
|
||||
public void setUriOfPredicate(String uriOfPredicate) {
|
||||
this.uriOfPredicate = uriOfPredicate;
|
||||
}
|
||||
public String getUriOfSubject() {
|
||||
return uriOfSubject;
|
||||
}
|
||||
public void setUriOfSubject(String uriOfSubject) {
|
||||
this.uriOfSubject = uriOfSubject;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return this.getClass().getName() +
|
||||
" <" + uriOfSubject + "> <" + uriOfPredicate + "> <" + uriOfObject + ">";
|
||||
}
|
||||
}
|
|
@ -5,23 +5,18 @@ package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.VisitingPolicyIface;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.ThreeParameterAction;
|
||||
|
||||
public class AddObjectPropStmt extends ThreeParameterAction implements RequestedAction {
|
||||
public class AddObjectPropStmt extends ObjectPropertyAction implements
|
||||
RequestedAction {
|
||||
|
||||
public AddObjectPropStmt(String uriOfSub, String uriOfPred, String uriOfObj){
|
||||
this.uriOfSubject = uriOfSub;
|
||||
this.uriOfObject = uriOfObj;
|
||||
this.uriOfPredicate = uriOfPred;
|
||||
}
|
||||
public AddObjectPropStmt(String uriOfSub, String uriOfPred, String uriOfObj) {
|
||||
super(uriOfSub, uriOfPred, uriOfObj);
|
||||
}
|
||||
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace + this.getClass().getName();
|
||||
}
|
||||
|
||||
public PolicyDecision accept(VisitingPolicyIface policy, IdentifierBundle ids){
|
||||
return policy.visit(ids,this);
|
||||
}
|
||||
@Override
|
||||
public PolicyDecision accept(VisitingPolicyIface policy,
|
||||
IdentifierBundle ids) {
|
||||
return policy.visit(ids, this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,22 +5,18 @@ package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.VisitingPolicyIface;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.ThreeParameterAction;
|
||||
|
||||
public class DropObjectPropStmt extends ThreeParameterAction implements RequestedAction {
|
||||
public class DropObjectPropStmt extends ObjectPropertyAction implements
|
||||
RequestedAction {
|
||||
|
||||
public DropObjectPropStmt(String sub, String pred, String obj){
|
||||
setUriOfSubject(sub);
|
||||
setUriOfPredicate(pred);
|
||||
setUriOfObject(obj);
|
||||
}
|
||||
public DropObjectPropStmt(String sub, String pred, String obj) {
|
||||
super(sub, pred, obj);
|
||||
}
|
||||
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace + this.getClass().getName();
|
||||
}
|
||||
public PolicyDecision accept(VisitingPolicyIface policy, IdentifierBundle ids){
|
||||
return policy.visit(ids,this);
|
||||
}
|
||||
@Override
|
||||
public PolicyDecision accept(VisitingPolicyIface policy,
|
||||
IdentifierBundle ids) {
|
||||
return policy.visit(ids, this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,33 +5,25 @@ package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.VisitingPolicyIface;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.ThreeParameterAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||
|
||||
public class EditObjPropStmt extends ThreeParameterAction implements RequestedAction {
|
||||
public class EditObjPropStmt extends ObjectPropertyAction implements
|
||||
RequestedAction {
|
||||
|
||||
public EditObjPropStmt(ObjectPropertyStatement ops) {
|
||||
super(ops.getSubjectURI(), ops.getPropertyURI(), ops.getObjectURI());
|
||||
}
|
||||
|
||||
public EditObjPropStmt(ObjectPropertyStatement ops){
|
||||
setUriOfSubject(ops.getSubjectURI());
|
||||
setUriOfPredicate(ops.getPropertyURI());
|
||||
setUriOfObject(ops.getObjectURI());
|
||||
}
|
||||
public EditObjPropStmt(String subjectUri, String keywordPredUri,
|
||||
String objectUri) {
|
||||
super(subjectUri, keywordPredUri, objectUri);
|
||||
}
|
||||
|
||||
public EditObjPropStmt(String subjectUri, String keywordPredUri,
|
||||
String objectUri) {
|
||||
setUriOfSubject(subjectUri);
|
||||
setUriOfPredicate(keywordPredUri);
|
||||
setUriOfObject(objectUri);
|
||||
}
|
||||
|
||||
public PolicyDecision accept(VisitingPolicyIface policy, IdentifierBundle whoToAuth) {
|
||||
return policy.visit(whoToAuth,this);
|
||||
}
|
||||
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace + this.getClass().getName();
|
||||
}
|
||||
@Override
|
||||
public PolicyDecision accept(VisitingPolicyIface policy,
|
||||
IdentifierBundle whoToAuth) {
|
||||
return policy.visit(whoToAuth, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.VisitingPolicyIface;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||
|
||||
/**
|
||||
* A base class for requested actions that involve manipulating an object
|
||||
* property.
|
||||
*/
|
||||
public abstract class ObjectPropertyAction implements RequestedAction {
|
||||
public final String uriOfSubject;
|
||||
public final String uriOfPredicate;
|
||||
public final String uriOfObject;
|
||||
|
||||
public ObjectPropertyAction(String uriOfSubject, String uriOfPredicate,
|
||||
String uriOfObject) {
|
||||
this.uriOfSubject = uriOfSubject;
|
||||
this.uriOfPredicate = uriOfPredicate;
|
||||
this.uriOfObject = uriOfObject;
|
||||
}
|
||||
|
||||
public String getUriOfSubject() {
|
||||
return uriOfSubject;
|
||||
}
|
||||
|
||||
public String getUriOfPredicate() {
|
||||
return uriOfPredicate;
|
||||
}
|
||||
|
||||
public String getUriOfObject() {
|
||||
return uriOfObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace
|
||||
+ this.getClass().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract PolicyDecision accept(VisitingPolicyIface policy,
|
||||
IdentifierBundle whoToAuth);
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName() + ": <" + uriOfSubject + "> <"
|
||||
+ uriOfPredicate + "> <" + uriOfObject + ">";
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue