NIHVIVO-2254 Clean up the RequestedAction class hierarchy
This commit is contained in:
parent
2f67bd199e
commit
7133857bb9
27 changed files with 55 additions and 133 deletions
|
@ -3,11 +3,9 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.admin;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.AdminRequestedAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||
|
||||
public class AddNewUser implements AdminRequestedAction{
|
||||
@Override
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace + this.getClass().getName();
|
||||
}
|
||||
/** Should we allow the user to create a user account? */
|
||||
public class AddNewUser extends RequestedAction implements AdminRequestedAction{
|
||||
// no members
|
||||
}
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.admin;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.AdminRequestedAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||
|
||||
public class LoadOntology implements AdminRequestedAction{
|
||||
/** Should we allow the user to load an ontology? */
|
||||
public class LoadOntology extends RequestedAction implements AdminRequestedAction{
|
||||
protected String ontologyUrl;
|
||||
|
||||
public String getOntologyUrl() {
|
||||
|
@ -15,9 +16,4 @@ public class LoadOntology implements AdminRequestedAction{
|
|||
public void setOntologyUrl(String ontologyUrl) {
|
||||
this.ontologyUrl = ontologyUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace + this.getClass().getName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,11 +3,8 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.admin;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.AdminRequestedAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||
|
||||
public class RebuildTextIndex implements AdminRequestedAction{
|
||||
@Override
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace + this.getClass().getName();
|
||||
}
|
||||
public class RebuildTextIndex extends RequestedAction implements AdminRequestedAction{
|
||||
// no members
|
||||
}
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.admin;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.AdminRequestedAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||
|
||||
public class RemoveUser implements AdminRequestedAction{
|
||||
/** Should we allow the user to remove a user account */
|
||||
public class RemoveUser extends RequestedAction implements AdminRequestedAction{
|
||||
protected String userUri;
|
||||
|
||||
public String getUserUri() {
|
||||
|
@ -15,9 +16,4 @@ public class RemoveUser implements AdminRequestedAction{
|
|||
public void setUserUri(String userUri) {
|
||||
this.userUri = userUri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace + this.getClass().getName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,17 +3,9 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.admin;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.AdminRequestedAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||
|
||||
/**
|
||||
* Represents a request to view information about the server status.
|
||||
* @author bdc34
|
||||
*
|
||||
*/
|
||||
public class ServerStatus implements AdminRequestedAction {
|
||||
|
||||
@Override
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace + this.getClass().getName();
|
||||
}
|
||||
/** Should we allow the user to view information about the server status? */
|
||||
public class ServerStatus extends RequestedAction implements AdminRequestedAction {
|
||||
// no members
|
||||
}
|
||||
|
|
|
@ -3,11 +3,8 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.admin;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.AdminRequestedAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||
|
||||
public class UpdateTextIndex implements AdminRequestedAction{
|
||||
@Override
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace + this.getClass().getName();
|
||||
}
|
||||
public class UpdateTextIndex extends RequestedAction implements AdminRequestedAction{
|
||||
// no fields
|
||||
}
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.admin;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.AdminRequestedAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||
|
||||
public class UploadFile implements AdminRequestedAction{
|
||||
/** Should we allow the user to upload a file? */
|
||||
public class UploadFile extends RequestedAction implements AdminRequestedAction{
|
||||
protected String subjectUri;
|
||||
protected String predicateUri;
|
||||
|
||||
|
@ -14,9 +15,4 @@ public class UploadFile implements AdminRequestedAction{
|
|||
this.subjectUri = subjectUri;
|
||||
this.predicateUri = predicateUri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace + this.getClass().getName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces;
|
||||
|
||||
public interface AdminRequestedAction extends RequestedAction {
|
||||
/** Denotes an action that is administrative, like adding users, etc. */
|
||||
public interface AdminRequestedAction {
|
||||
/** marker interface */
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces;
|
||||
|
||||
public interface OntoRequestedAction extends RequestedAction {
|
||||
/** Denotes an action that relates to manipulating the ontology. */
|
||||
public interface OntoRequestedAction {
|
||||
/** marker interface */
|
||||
}
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces;
|
||||
|
||||
/* Represents a request to perform an action. */
|
||||
public interface RequestedAction {
|
||||
public abstract class RequestedAction {
|
||||
/**
|
||||
* In its most basic form, a RequestAction needs to have an identifier.
|
||||
* Sometimes this will be enough. For example ServerStatusRequest.
|
||||
*
|
||||
* @return
|
||||
* Sometimes this will be enough.
|
||||
*/
|
||||
public String getURI();
|
||||
public final String getURI() {
|
||||
return RequestActionConstants.actionNamespace + this.getClass().getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces;
|
||||
|
||||
public abstract class SingleParameterAction implements RequestedAction {
|
||||
/**
|
||||
* A base class for actions that involve a single URI.
|
||||
*/
|
||||
public abstract class SingleParameterAction extends RequestedAction {
|
||||
protected String subjectUri;
|
||||
|
||||
public String getSubjectUri() {
|
||||
|
|
|
@ -1,22 +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;
|
||||
|
||||
public abstract class TwoParameterAction implements RequestedAction {
|
||||
protected String resourceUri;
|
||||
protected String secondUri;
|
||||
|
||||
public String getResourceUri() {
|
||||
return resourceUri;
|
||||
}
|
||||
public void setResourceUri(String resourceUri) {
|
||||
this.resourceUri = resourceUri;
|
||||
}
|
||||
public String getSecondUri() {
|
||||
return secondUri;
|
||||
}
|
||||
public void setSecondUri(String secondUri) {
|
||||
this.secondUri = secondUri;
|
||||
}
|
||||
|
||||
}
|
|
@ -3,13 +3,9 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ontology;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.OntoRequestedAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.SingleParameterAction;
|
||||
|
||||
/** Should we allow the user to create a new class in the ontology? */
|
||||
public class CreateOwlClass extends SingleParameterAction implements OntoRequestedAction {
|
||||
|
||||
@Override
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace + this.getClass().getName();
|
||||
}
|
||||
// no fields
|
||||
}
|
||||
|
|
|
@ -3,12 +3,9 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ontology;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.OntoRequestedAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.SingleParameterAction;
|
||||
|
||||
/** Should we allow the user to define a data property in the ontology? */
|
||||
public class DefineDataProperty extends SingleParameterAction implements OntoRequestedAction{
|
||||
@Override
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace + this.getClass().getName();
|
||||
}
|
||||
// no fields
|
||||
}
|
||||
|
|
|
@ -3,13 +3,9 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ontology;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.OntoRequestedAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.SingleParameterAction;
|
||||
|
||||
/** Should we allow the user to define a new object property in the ontology? */
|
||||
public class DefineObjectProperty extends SingleParameterAction implements OntoRequestedAction{
|
||||
|
||||
@Override
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace + this.getClass().getName();
|
||||
}
|
||||
// no fields
|
||||
}
|
||||
|
|
|
@ -3,12 +3,9 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ontology;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.OntoRequestedAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.SingleParameterAction;
|
||||
|
||||
/** Should we allow the user to remove a class from the ontology? */
|
||||
public class RemoveOwlClass extends SingleParameterAction implements OntoRequestedAction{
|
||||
@Override
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace + this.getClass().getName();
|
||||
}
|
||||
// no fields
|
||||
}
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||
|
||||
/**
|
||||
* A base class for requestion actions that relate to data properties.
|
||||
*/
|
||||
public abstract class AbstractDataPropertyAction implements RequestedAction {
|
||||
public abstract class AbstractDataPropertyAction extends RequestedAction {
|
||||
private final String subjectUri;
|
||||
private final String predicateUri;
|
||||
|
||||
|
@ -25,12 +24,6 @@ public abstract class AbstractDataPropertyAction implements RequestedAction {
|
|||
return predicateUri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace
|
||||
+ this.getClass().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + ": <" + subjectUri + "> <"
|
||||
|
|
|
@ -2,14 +2,13 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt;
|
||||
|
||||
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 AbstractObjectPropertyAction implements RequestedAction {
|
||||
public abstract class AbstractObjectPropertyAction extends RequestedAction {
|
||||
public final String uriOfSubject;
|
||||
public final String uriOfPredicate;
|
||||
public final String uriOfObject;
|
||||
|
@ -33,12 +32,6 @@ public abstract class AbstractObjectPropertyAction implements RequestedAction {
|
|||
return uriOfObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace
|
||||
+ this.getClass().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName() + ": <" + uriOfSubject + "> <"
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt;
|
||||
|
||||
|
||||
/** Should we allow the user to add this DataPropertyStatement? */
|
||||
public class AddDataPropStmt extends AbstractDataPropertyAction {
|
||||
|
||||
protected String data;
|
||||
protected String dataType;
|
||||
protected String lang;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt;
|
||||
|
||||
|
||||
/** Should we allow the user to add this ObjectPropertyStatement? */
|
||||
public class AddObjectPropStmt extends AbstractObjectPropertyAction {
|
||||
|
||||
public AddObjectPropStmt(String uriOfSub, String uriOfPred, String uriOfObj) {
|
||||
|
|
|
@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
|
||||
|
||||
/** Should we allow the user to delete this DataPropertyStatement? */
|
||||
public class DropDataPropStmt extends AbstractDataPropertyAction {
|
||||
|
||||
private final DataPropertyStatement dataPropStmt;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt;
|
||||
|
||||
/** Should we allow the user to delete this ObjectPropertyStatement? */
|
||||
public class DropObjectPropStmt extends AbstractObjectPropertyAction {
|
||||
|
||||
public DropObjectPropStmt(String sub, String pred, String obj) {
|
||||
|
|
|
@ -4,6 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt;
|
|||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
|
||||
/** Should we allow the user to edit this DataPropertyStatement? */
|
||||
public class EditDataPropStmt extends AbstractDataPropertyAction {
|
||||
|
||||
private final DataPropertyStatement dataPropStmt;
|
||||
|
|
|
@ -4,6 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt;
|
|||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||
|
||||
/** Should we allow the user to edit this ObjectPropertyStatement? */
|
||||
public class EditObjPropStmt extends AbstractObjectPropertyAction {
|
||||
|
||||
public EditObjPropStmt(ObjectPropertyStatement ops) {
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.resource;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||
|
||||
/**
|
||||
* A common base class for resource-related actions.
|
||||
*/
|
||||
public abstract class AbstractResourceAction implements RequestedAction {
|
||||
public abstract class AbstractResourceAction extends RequestedAction {
|
||||
private final String typeUri;
|
||||
private final String subjectUri;
|
||||
|
||||
|
@ -27,15 +26,8 @@ public abstract class AbstractResourceAction implements RequestedAction {
|
|||
return subjectUri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getURI() {
|
||||
return RequestActionConstants.actionNamespace
|
||||
+ this.getClass().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName() + " <" + subjectUri + ">";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.resource;
|
||||
|
||||
|
||||
/** Should we allow the user to add a Resource to the model? */
|
||||
public class AddResource extends AbstractResourceAction {
|
||||
|
||||
public AddResource(String typeUri, String subjectUri) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.resource;
|
||||
|
||||
|
||||
/** Should we allow the user to delete a Resource from the model? */
|
||||
public class DropResource extends AbstractResourceAction {
|
||||
|
||||
public DropResource(String typeUri, String subjectUri) {
|
||||
|
|
Loading…
Add table
Reference in a new issue