Changes to AddRoleToPersonTwoStage and subclasses
This commit is contained in:
parent
5a2e1c76f0
commit
a55bab3002
15 changed files with 438 additions and 1499 deletions
|
@ -2,116 +2,38 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.vocabulary.XSD;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||
/**
|
||||
* Generates the edit configuration for adding a Role to a Person.
|
||||
|
||||
Stage one is selecting the type of the non-person thing
|
||||
associated with the Role with the intention of reducing the
|
||||
number of Individuals that the user has to select from.
|
||||
Stage two is selecting the non-person Individual to associate
|
||||
with the Role.
|
||||
|
||||
This is intended to create a set of statements like:
|
||||
|
||||
?person core:hasResearchActivityRole ?newRole.
|
||||
?newRole rdf:type core:ResearchActivityRole ;
|
||||
roleToActivityPredicate ?someActivity .
|
||||
?someActivity rdf:type core:ResearchActivity .
|
||||
?someActivity rdfs:label "activity title" .
|
||||
|
||||
|
||||
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||
methods, and must always implement the following methods:
|
||||
getRoleType
|
||||
getRoleActivityTypeOptionsType
|
||||
getRoleActivityTypeObjectClassUri
|
||||
getRoleActivityTypeLiteralOptions
|
||||
|
||||
*
|
||||
*/
|
||||
public class AddAttendeeRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
private Log log = LogFactory.getLog(AddAttendeeRoleToPersonGenerator.class);
|
||||
private static String template = "addAttendeeRoleToPerson.ftl";
|
||||
|
||||
//Should this be overridden
|
||||
@Override
|
||||
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||
VitroRequest vreq) {
|
||||
editConfiguration.setTemplate(template);
|
||||
}
|
||||
|
||||
private static String TEMPLATE = "addAttendeeRoleToPerson.ftl";
|
||||
|
||||
@Override
|
||||
String getTemplate(){ return TEMPLATE; }
|
||||
|
||||
|
||||
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||
//correct for this subclass so they don't need to be overwritten
|
||||
|
||||
//role type will always be set based on particular form
|
||||
public String getRoleType(VitroRequest vreq) {
|
||||
//TODO: Get dynamic way of including vivoweb ontology
|
||||
return "http://vivoweb.org/ontology/core#AttendeeRole";
|
||||
}
|
||||
|
||||
//Each subclass generator will return its own type of option here:
|
||||
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||
}
|
||||
|
||||
//This too will depend on the specific subclass of generator
|
||||
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//Attendee role involves hard-coded options for the "right side" of the role or activity
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||
literalOptions.put("", "Select type");
|
||||
@Override
|
||||
String getRoleType() {
|
||||
return "http://vivoweb.org/ontology/core#AttendeeRole";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
//no ClassURI since it uses hard coded literals
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleActivityOptionTypes getRoleActivityTypeOptionsType() {
|
||||
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||
}
|
||||
|
||||
//Editor role involves hard-coded options for the "right side" of the role or activity
|
||||
@Override
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions() {
|
||||
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||
literalOptions.put("", "Select type");
|
||||
literalOptions.put("http://purl.org/NET/c4dm/event.owl#Event", "Event");
|
||||
literalOptions.put("http://vivoweb.org/ontology/core#Competition", "Competition");
|
||||
literalOptions.put("http://purl.org/ontology/bibo/Conference", "Conference");
|
||||
|
@ -125,10 +47,11 @@ public class AddAttendeeRoleToPersonGenerator extends AddRoleToPersonTwoStageGen
|
|||
literalOptions.put("http://vivoweb.org/ontology/core#ConferenceSeries", "Conference Series");
|
||||
literalOptions.put("http://vivoweb.org/ontology/core#SeminarSeries", "Seminar Series");
|
||||
literalOptions.put("http://vivoweb.org/ontology/core#WorkshopSeries", "Workshop Series");
|
||||
return literalOptions;
|
||||
}
|
||||
return literalOptions;
|
||||
}
|
||||
|
||||
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||
|
||||
|
||||
@Override
|
||||
boolean isShowRoleLabelField() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,114 +2,38 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.vocabulary.XSD;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||
/**
|
||||
* Generates the edit configuration for adding a Role to a Person.
|
||||
|
||||
Stage one is selecting the type of the non-person thing
|
||||
associated with the Role with the intention of reducing the
|
||||
number of Individuals that the user has to select from.
|
||||
Stage two is selecting the non-person Individual to associate
|
||||
with the Role.
|
||||
|
||||
This is intended to create a set of statements like:
|
||||
|
||||
?person core:hasResearchActivityRole ?newRole.
|
||||
?newRole rdf:type core:ResearchActivityRole ;
|
||||
roleToActivityPredicate ?someActivity .
|
||||
?someActivity rdf:type core:ResearchActivity .
|
||||
?someActivity rdfs:label "activity title" .
|
||||
|
||||
|
||||
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||
methods, and must always implement the following methods:
|
||||
getRoleType
|
||||
getRoleActivityTypeOptionsType
|
||||
getRoleActivityTypeObjectClassUri
|
||||
getRoleActivityTypeLiteralOptions
|
||||
|
||||
*
|
||||
*/
|
||||
public class AddClinicalRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
private Log log = LogFactory.getLog(AddClinicalRoleToPersonGenerator.class);
|
||||
|
||||
private static String template = "addClinicalRoleToPerson.ftl";
|
||||
|
||||
//Should this be overridden
|
||||
@Override
|
||||
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||
VitroRequest vreq) {
|
||||
editConfiguration.setTemplate(template);
|
||||
String getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||
//correct for this subclass so they don't need to be overwritten
|
||||
|
||||
//role type will always be set based on particular form
|
||||
public String getRoleType(VitroRequest vreq) {
|
||||
//TODO: Get dynamic way of including vivoweb ontology
|
||||
@Override
|
||||
String getRoleType() {
|
||||
return "http://vivoweb.org/ontology/core#ClinicalRole";
|
||||
}
|
||||
|
||||
//Each subclass generator will return its own type of option here:
|
||||
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||
@Override
|
||||
RoleActivityOptionTypes getRoleActivityTypeOptionsType() {
|
||||
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||
}
|
||||
|
||||
//This too will depend on the specific subclass of generator
|
||||
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
return null;
|
||||
|
||||
@Override
|
||||
String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
return null; //not needed since the options are hard coded
|
||||
}
|
||||
|
||||
|
||||
//Clinical role involves hard-coded options for the "right side" of the role or activity
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||
@Override
|
||||
HashMap<String, String> getRoleActivityTypeLiteralOptions() {
|
||||
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||
literalOptions.put("", "Select one");
|
||||
literalOptions.put("http://vivoweb.org/ontology/core#Project", "Project");
|
||||
|
@ -118,6 +42,9 @@ public class AddClinicalRoleToPersonGenerator extends AddRoleToPersonTwoStageGen
|
|||
}
|
||||
|
||||
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||
|
||||
@Override
|
||||
boolean isShowRoleLabelField(){
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -74,47 +74,35 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.
|
|||
*
|
||||
*/
|
||||
public class AddEditorRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
private static String TEMPLATE = "addEditorRoleToPerson.ftl";
|
||||
|
||||
private Log log = LogFactory.getLog(AddEditorRoleToPersonGenerator.class);
|
||||
private static String template = "addEditorRoleToPerson.ftl";
|
||||
|
||||
//Should this be overridden
|
||||
@Override
|
||||
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||
VitroRequest vreq) {
|
||||
editConfiguration.setTemplate(template);
|
||||
}
|
||||
String getTemplate(){ return TEMPLATE; }
|
||||
|
||||
//role type will always be set based on particular form
|
||||
public String getRoleType(VitroRequest vreq) {
|
||||
//TODO: Get dynamic way of including vivoweb ontology
|
||||
@Override
|
||||
String getRoleType() {
|
||||
return "http://vivoweb.org/ontology/core#EditorRole";
|
||||
}
|
||||
|
||||
//Each subclass generator will return its own type of option here:
|
||||
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||
@Override
|
||||
public RoleActivityOptionTypes getRoleActivityTypeOptionsType() {
|
||||
return RoleActivityOptionTypes.CHILD_VCLASSES;
|
||||
}
|
||||
|
||||
//This too will depend on the specific subclass of generator
|
||||
@Override
|
||||
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
return "http://purl.org/ontology/bibo/Collection";
|
||||
}
|
||||
|
||||
|
||||
//Editor role involves hard-coded options for the "right side" of the role or activity
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||
@Override
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions() {
|
||||
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||
literalOptions.put("", "Select type");
|
||||
return literalOptions;
|
||||
}
|
||||
|
||||
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||
public boolean isShowRoleLabelField(VitroRequest vreq) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/** Do not show the role label field for the AddEditorRoleToPerson form */
|
||||
@Override
|
||||
boolean isShowRoleLabelField() { return false; }
|
||||
}
|
||||
|
|
|
@ -144,17 +144,10 @@ public class AddGrantRoleToPersonGenerator implements EditConfigurationGenerator
|
|||
editConfiguration.setVarNameForPredicate("rolePredicate");
|
||||
editConfiguration.setPredicateUri(predicateUri);
|
||||
//by definition, this is an object property
|
||||
this.initObjectParameters(vreq);
|
||||
this.processObjectPropForm(vreq, editConfiguration);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void initObjectParameters(VitroRequest vreq) {
|
||||
//in case of object property
|
||||
objectUri = EditConfigurationUtils.getObjectUri(vreq);
|
||||
}
|
||||
|
||||
this.processObjectPropForm(vreq, editConfiguration);
|
||||
}
|
||||
|
||||
private void processObjectPropForm(VitroRequest vreq, EditConfigurationVTwo editConfiguration) {
|
||||
editConfiguration.setVarNameForObject("role");
|
||||
|
|
|
@ -2,114 +2,38 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.vocabulary.XSD;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||
/**
|
||||
* Generates the edit configuration for adding a Role to a Person.
|
||||
|
||||
Stage one is selecting the type of the non-person thing
|
||||
associated with the Role with the intention of reducing the
|
||||
number of Individuals that the user has to select from.
|
||||
Stage two is selecting the non-person Individual to associate
|
||||
with the Role.
|
||||
|
||||
This is intended to create a set of statements like:
|
||||
|
||||
?person core:hasResearchActivityRole ?newRole.
|
||||
?newRole rdf:type core:ResearchActivityRole ;
|
||||
roleToActivityPredicate ?someActivity .
|
||||
?someActivity rdf:type core:ResearchActivity .
|
||||
?someActivity rdfs:label "activity title" .
|
||||
|
||||
|
||||
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||
methods, and must always implement the following methods:
|
||||
getRoleType
|
||||
getRoleActivityTypeOptionsType
|
||||
getRoleActivityTypeObjectClassUri
|
||||
getRoleActivityTypeLiteralOptions
|
||||
|
||||
*
|
||||
*/
|
||||
public class AddHeadOfRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
private Log log = LogFactory.getLog(AddHeadOfRoleToPersonGenerator.class);
|
||||
private static String template = "addHeadOfRoleToPerson.ftl";
|
||||
|
||||
//Should this be overridden
|
||||
@Override
|
||||
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||
VitroRequest vreq) {
|
||||
editConfiguration.setTemplate(template);
|
||||
String getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||
//correct for this subclass so they don't need to be overwritten
|
||||
|
||||
//role type will always be set based on particular form
|
||||
public String getRoleType(VitroRequest vreq) {
|
||||
//TODO: Get dynamic way of including vivoweb ontology
|
||||
@Override
|
||||
String getRoleType() {
|
||||
return "http://vivoweb.org/ontology/core#LeaderRole";
|
||||
}
|
||||
|
||||
//Each subclass generator will return its own type of option here:
|
||||
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||
@Override
|
||||
RoleActivityOptionTypes getRoleActivityTypeOptionsType() {
|
||||
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||
}
|
||||
|
||||
//This too will depend on the specific subclass of generator
|
||||
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
return null; //not needed since this is HARDCODED_LITERALS
|
||||
}
|
||||
|
||||
//Head Of role involves hard-coded options for the "right side" of the role or activity
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||
/** Head Of role involves hard-coded options for the "right side" of the role or activity */
|
||||
@Override
|
||||
HashMap<String, String> getRoleActivityTypeLiteralOptions() {
|
||||
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||
literalOptions.put("", "Select type");
|
||||
literalOptions.put("http://vivoweb.org/ontology/core#Association", "Association");
|
||||
|
@ -144,7 +68,8 @@ public class AddHeadOfRoleToPersonGenerator extends AddRoleToPersonTwoStageGener
|
|||
return literalOptions;
|
||||
}
|
||||
|
||||
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||
@Override
|
||||
boolean isShowRoleLabelField(){return true;}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,121 +2,44 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.vocabulary.XSD;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||
/**
|
||||
* Generates the edit configuration for adding a Role to a Person.
|
||||
|
||||
Stage one is selecting the type of the non-person thing
|
||||
associated with the Role with the intention of reducing the
|
||||
number of Individuals that the user has to select from.
|
||||
Stage two is selecting the non-person Individual to associate
|
||||
with the Role.
|
||||
|
||||
This is intended to create a set of statements like:
|
||||
|
||||
?person core:hasResearchActivityRole ?newRole.
|
||||
?newRole rdf:type core:ResearchActivityRole ;
|
||||
roleToActivityPredicate ?someActivity .
|
||||
?someActivity rdf:type core:ResearchActivity .
|
||||
?someActivity rdfs:label "activity title" .
|
||||
|
||||
|
||||
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||
methods, and must always implement the following methods:
|
||||
getRoleType
|
||||
getRoleActivityTypeOptionsType
|
||||
getRoleActivityTypeObjectClassUri
|
||||
getRoleActivityTypeLiteralOptions
|
||||
|
||||
*
|
||||
*/
|
||||
public class AddMemberRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
private Log log = LogFactory.getLog(AddMemberRoleToPersonGenerator.class);
|
||||
private static String template = "addMemberRoleToPerson.ftl";
|
||||
|
||||
//Should this be overridden
|
||||
@Override
|
||||
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||
VitroRequest vreq) {
|
||||
editConfiguration.setTemplate(template);
|
||||
}
|
||||
|
||||
|
||||
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||
//correct for this subclass so they don't need to be overwritten
|
||||
|
||||
String getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
//role type will always be set based on particular form
|
||||
public String getRoleType(VitroRequest vreq) {
|
||||
//TODO: Get dynamic way of including vivoweb ontology
|
||||
@Override
|
||||
String getRoleType() {
|
||||
return "http://vivoweb.org/ontology/core#MemberRole";
|
||||
}
|
||||
|
||||
//Each subclass generator will return its own type of option here:
|
||||
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||
@Override
|
||||
RoleActivityOptionTypes getRoleActivityTypeOptionsType() {
|
||||
return RoleActivityOptionTypes.VCLASSGROUP;
|
||||
}
|
||||
|
||||
//This too will depend on the specific subclass of generator
|
||||
@Override
|
||||
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
//this is needed since the OptionTypes is VCLASSGROUP
|
||||
return "http://vivoweb.org/ontology#vitroClassGrouporganizations";
|
||||
}
|
||||
|
||||
|
||||
//Member role involves hard-coded options for the "right side" of the role or activity
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||
@Override
|
||||
HashMap<String, String> getRoleActivityTypeLiteralOptions() {
|
||||
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||
literalOptions.put("", "Select type");
|
||||
return literalOptions;
|
||||
}
|
||||
|
||||
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||
|
||||
@Override
|
||||
boolean isShowRoleLabelField(){return true;}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,114 +2,38 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.vocabulary.XSD;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||
/**
|
||||
* Generates the edit configuration for adding a Role to a Person.
|
||||
|
||||
Stage one is selecting the type of the non-person thing
|
||||
associated with the Role with the intention of reducing the
|
||||
number of Individuals that the user has to select from.
|
||||
Stage two is selecting the non-person Individual to associate
|
||||
with the Role.
|
||||
|
||||
This is intended to create a set of statements like:
|
||||
|
||||
?person core:hasResearchActivityRole ?newRole.
|
||||
?newRole rdf:type core:ResearchActivityRole ;
|
||||
roleToActivityPredicate ?someActivity .
|
||||
?someActivity rdf:type core:ResearchActivity .
|
||||
?someActivity rdfs:label "activity title" .
|
||||
|
||||
|
||||
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||
methods, and must always implement the following methods:
|
||||
getRoleType
|
||||
getRoleActivityTypeOptionsType
|
||||
getRoleActivityTypeObjectClassUri
|
||||
getRoleActivityTypeLiteralOptions
|
||||
|
||||
*
|
||||
*/
|
||||
public class AddOrganizerRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
private Log log = LogFactory.getLog(AddOrganizerRoleToPersonGenerator.class);
|
||||
private static String template = "addOrganizerRoleToPerson.ftl";
|
||||
|
||||
//Should this be overridden
|
||||
|
||||
@Override
|
||||
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||
VitroRequest vreq) {
|
||||
editConfiguration.setTemplate(template);
|
||||
String getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||
//correct for this subclass so they don't need to be overwritten
|
||||
|
||||
//role type will always be set based on particular form
|
||||
public String getRoleType(VitroRequest vreq) {
|
||||
//TODO: Get dynamic way of including vivoweb ontology
|
||||
@Override
|
||||
String getRoleType() {
|
||||
return "http://vivoweb.org/ontology/core#OrganizerRole";
|
||||
}
|
||||
|
||||
//Each subclass generator will return its own type of option here:
|
||||
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||
@Override
|
||||
RoleActivityOptionTypes getRoleActivityTypeOptionsType() {
|
||||
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||
}
|
||||
|
||||
//This too will depend on the specific subclass of generator
|
||||
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
@Override
|
||||
String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Organizer role involves hard-coded options for the "right side" of the role or activity
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||
@Override
|
||||
HashMap<String, String> getRoleActivityTypeLiteralOptions() {
|
||||
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||
literalOptions.put("", "Select type");
|
||||
literalOptions.put("http://purl.org/NET/c4dm/event.owl#Event", "Event");
|
||||
|
@ -128,10 +52,9 @@ public class AddOrganizerRoleToPersonGenerator extends AddRoleToPersonTwoStageGe
|
|||
return literalOptions;
|
||||
}
|
||||
|
||||
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||
public boolean isShowRoleLabelField(VitroRequest vreq) {
|
||||
@Override
|
||||
boolean isShowRoleLabelField() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,114 +2,37 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.vocabulary.XSD;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||
/**
|
||||
* Generates the edit configuration for adding a Role to a Person.
|
||||
|
||||
Stage one is selecting the type of the non-person thing
|
||||
associated with the Role with the intention of reducing the
|
||||
number of Individuals that the user has to select from.
|
||||
Stage two is selecting the non-person Individual to associate
|
||||
with the Role.
|
||||
|
||||
This is intended to create a set of statements like:
|
||||
|
||||
?person core:hasResearchActivityRole ?newRole.
|
||||
?newRole rdf:type core:ResearchActivityRole ;
|
||||
roleToActivityPredicate ?someActivity .
|
||||
?someActivity rdf:type core:ResearchActivity .
|
||||
?someActivity rdfs:label "activity title" .
|
||||
|
||||
|
||||
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||
methods, and must always implement the following methods:
|
||||
getRoleType
|
||||
getRoleActivityTypeOptionsType
|
||||
getRoleActivityTypeObjectClassUri
|
||||
getRoleActivityTypeLiteralOptions
|
||||
|
||||
*
|
||||
*/
|
||||
public class AddOutreachProviderRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
private Log log = LogFactory.getLog(AddOutreachProviderRoleToPersonGenerator.class);
|
||||
private static String template = "addOutreachProviderRoleToPerson.ftl";
|
||||
|
||||
//Should this be overridden
|
||||
@Override
|
||||
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||
VitroRequest vreq) {
|
||||
editConfiguration.setTemplate(template);
|
||||
String getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||
//correct for this subclass so they don't need to be overwritten
|
||||
|
||||
//role type will always be set based on particular form
|
||||
public String getRoleType(VitroRequest vreq) {
|
||||
//TODO: Get dynamic way of including vivoweb ontology
|
||||
@Override
|
||||
String getRoleType() {
|
||||
return "http://vivoweb.org/ontology/core#OutreachProviderRole";
|
||||
}
|
||||
|
||||
//Each subclass generator will return its own type of option here:
|
||||
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||
|
||||
@Override
|
||||
RoleActivityOptionTypes getRoleActivityTypeOptionsType() {
|
||||
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||
}
|
||||
|
||||
//This too will depend on the specific subclass of generator
|
||||
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
@Override
|
||||
String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Outreach Provider role involves hard-coded options for the "right side" of the role or activity
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||
@Override
|
||||
HashMap<String, String> getRoleActivityTypeLiteralOptions() {
|
||||
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||
literalOptions.put("", "Select type");
|
||||
literalOptions.put("http://vivoweb.org/ontology/core#Association", "Association");
|
||||
|
@ -144,6 +67,6 @@ public class AddOutreachProviderRoleToPersonGenerator extends AddRoleToPersonTwo
|
|||
return literalOptions;
|
||||
}
|
||||
|
||||
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||
|
||||
@Override
|
||||
boolean isShowRoleLabelField(){return true;}
|
||||
}
|
||||
|
|
|
@ -2,114 +2,40 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.vocabulary.XSD;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||
/**
|
||||
* Generates the edit configuration for adding a Role to a Person.
|
||||
|
||||
Stage one is selecting the type of the non-person thing
|
||||
associated with the Role with the intention of reducing the
|
||||
number of Individuals that the user has to select from.
|
||||
Stage two is selecting the non-person Individual to associate
|
||||
with the Role.
|
||||
|
||||
This is intended to create a set of statements like:
|
||||
|
||||
?person core:hasResearchActivityRole ?newRole.
|
||||
?newRole rdf:type core:ResearchActivityRole ;
|
||||
roleToActivityPredicate ?someActivity .
|
||||
?someActivity rdf:type core:ResearchActivity .
|
||||
?someActivity rdfs:label "activity title" .
|
||||
|
||||
|
||||
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||
methods, and must always implement the following methods:
|
||||
getRoleType
|
||||
getRoleActivityTypeOptionsType
|
||||
getRoleActivityTypeObjectClassUri
|
||||
getRoleActivityTypeLiteralOptions
|
||||
|
||||
*
|
||||
*/
|
||||
public class AddPresenterRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
private Log log = LogFactory.getLog(AddPresenterRoleToPersonGenerator.class);
|
||||
private static String template = "addPresenterRoleToPerson.ftl";
|
||||
|
||||
//Should this be overridden
|
||||
|
||||
@Override
|
||||
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||
VitroRequest vreq) {
|
||||
editConfiguration.setTemplate(template);
|
||||
String getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||
//correct for this subclass so they don't need to be overwritten
|
||||
|
||||
//role type will always be set based on particular form
|
||||
public String getRoleType(VitroRequest vreq) {
|
||||
//TODO: Get dynamic way of including vivoweb ontology
|
||||
@Override
|
||||
String getRoleType() {
|
||||
return "http://vivoweb.org/ontology/core#PresenterRole";
|
||||
}
|
||||
|
||||
//Each subclass generator will return its own type of option here:
|
||||
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||
@Override
|
||||
RoleActivityOptionTypes getRoleActivityTypeOptionsType() {
|
||||
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||
}
|
||||
|
||||
//This too will depend on the specific subclass of generator
|
||||
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
|
||||
@Override
|
||||
String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//Presenter role involves hard-coded options for the "right side" of the role or activity
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||
@Override
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions() {
|
||||
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||
literalOptions.put("", "Select type");
|
||||
literalOptions.put("http://vivoweb.org/ontology/core#Presentation", "Presentation");
|
||||
|
@ -117,6 +43,6 @@ public class AddPresenterRoleToPersonGenerator extends AddRoleToPersonTwoStageGe
|
|||
return literalOptions;
|
||||
}
|
||||
|
||||
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||
|
||||
@Override
|
||||
boolean isShowRoleLabelField(){return true;}
|
||||
}
|
||||
|
|
|
@ -2,114 +2,37 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.vocabulary.XSD;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||
/**
|
||||
* Generates the edit configuration for adding a Role to a Person.
|
||||
|
||||
Stage one is selecting the type of the non-person thing
|
||||
associated with the Role with the intention of reducing the
|
||||
number of Individuals that the user has to select from.
|
||||
Stage two is selecting the non-person Individual to associate
|
||||
with the Role.
|
||||
|
||||
This is intended to create a set of statements like:
|
||||
|
||||
?person core:hasResearchActivityRole ?newRole.
|
||||
?newRole rdf:type core:ResearchActivityRole ;
|
||||
roleToActivityPredicate ?someActivity .
|
||||
?someActivity rdf:type core:ResearchActivity .
|
||||
?someActivity rdfs:label "activity title" .
|
||||
|
||||
|
||||
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||
methods, and must always implement the following methods:
|
||||
getRoleType
|
||||
getRoleActivityTypeOptionsType
|
||||
getRoleActivityTypeObjectClassUri
|
||||
getRoleActivityTypeLiteralOptions
|
||||
|
||||
*
|
||||
*/
|
||||
public class AddResearcherRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
private Log log = LogFactory.getLog(AddResearcherRoleToPersonGenerator.class);
|
||||
private static String template = "addResearcherRoleToPerson.ftl";
|
||||
|
||||
//Should this be overridden
|
||||
|
||||
@Override
|
||||
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||
VitroRequest vreq) {
|
||||
editConfiguration.setTemplate(template);
|
||||
String getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||
//correct for this subclass so they don't need to be overwritten
|
||||
|
||||
//role type will always be set based on particular form
|
||||
public String getRoleType(VitroRequest vreq) {
|
||||
//TODO: Get dynamic way of including vivoweb ontology
|
||||
@Override
|
||||
public String getRoleType() {
|
||||
return "http://vivoweb.org/ontology/core#ResearcherRole";
|
||||
}
|
||||
|
||||
//Each subclass generator will return its own type of option here:
|
||||
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||
@Override
|
||||
RoleActivityOptionTypes getRoleActivityTypeOptionsType() {
|
||||
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||
}
|
||||
|
||||
//This too will depend on the specific subclass of generator
|
||||
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
@Override
|
||||
String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//Researcher role involves hard-coded options for the "right side" of the role or activity
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||
@Override
|
||||
HashMap<String, String> getRoleActivityTypeLiteralOptions() {
|
||||
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||
literalOptions.put("", "Select one");
|
||||
literalOptions.put("http://vivoweb.org/ontology/core#Grant", "Grant");
|
||||
|
@ -117,6 +40,6 @@ public class AddResearcherRoleToPersonGenerator extends AddRoleToPersonTwoStageG
|
|||
return literalOptions;
|
||||
}
|
||||
|
||||
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||
|
||||
@Override
|
||||
boolean isShowRoleLabelField() { return true; }
|
||||
}
|
||||
|
|
|
@ -2,88 +2,14 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.vocabulary.XSD;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||
/**
|
||||
* Generates the edit configuration for adding a Role to a Person.
|
||||
|
||||
Stage one is selecting the type of the non-person thing
|
||||
associated with the Role with the intention of reducing the
|
||||
number of Individuals that the user has to select from.
|
||||
Stage two is selecting the non-person Individual to associate
|
||||
with the Role.
|
||||
|
||||
This is intended to create a set of statements like:
|
||||
|
||||
?person core:hasResearchActivityRole ?newRole.
|
||||
?newRole rdf:type core:ResearchActivityRole ;
|
||||
roleToActivityPredicate ?someActivity .
|
||||
?someActivity rdf:type core:ResearchActivity .
|
||||
?someActivity rdfs:label "activity title" .
|
||||
|
||||
|
||||
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||
methods, and must always implement the following methods:
|
||||
getRoleType
|
||||
getRoleActivityTypeOptionsType
|
||||
getRoleActivityTypeObjectClassUri
|
||||
getRoleActivityTypeLiteralOptions
|
||||
|
||||
*
|
||||
*/
|
||||
public class AddReviewerRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
public class AddReviewerRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
private Log log = LogFactory.getLog(AddReviewerRoleToPersonGenerator.class);
|
||||
private static String template = "addReviewerRoleToPerson.ftl";
|
||||
|
||||
//Should this be overridden
|
||||
@Override
|
||||
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||
VitroRequest vreq) {
|
||||
editConfiguration.setTemplate(template);
|
||||
}
|
||||
String getTemplate() { return "addReviewerRoleToPerson.ftl"; }
|
||||
|
||||
|
||||
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||
|
@ -93,11 +19,11 @@ public class AddReviewerRoleToPersonGenerator extends AddRoleToPersonTwoStageGen
|
|||
}
|
||||
|
||||
public String getRoleToActivityPredicate(VitroRequest vreq) {
|
||||
return "http://vivoweb.org/ontology/core#forInformationResource";
|
||||
return "<http://vivoweb.org/ontology/core#forInformationResource>";
|
||||
}
|
||||
|
||||
//role type will always be set based on particular form
|
||||
public String getRoleType(VitroRequest vreq) {
|
||||
public String getRoleType() {
|
||||
//TODO: Get dynamic way of including vivoweb ontology
|
||||
return "http://vivoweb.org/ontology/core#ReviewerRole";
|
||||
}
|
||||
|
@ -105,7 +31,7 @@ public class AddReviewerRoleToPersonGenerator extends AddRoleToPersonTwoStageGen
|
|||
//Each subclass generator will return its own type of option here:
|
||||
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||
public RoleActivityOptionTypes getRoleActivityTypeOptionsType() {
|
||||
return RoleActivityOptionTypes.CHILD_VCLASSES;
|
||||
}
|
||||
|
||||
|
@ -116,14 +42,14 @@ public class AddReviewerRoleToPersonGenerator extends AddRoleToPersonTwoStageGen
|
|||
|
||||
|
||||
//Reviewer role involves hard-coded options for the "right side" of the role or activity
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions() {
|
||||
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||
literalOptions.put("", "Select type");
|
||||
return literalOptions;
|
||||
}
|
||||
|
||||
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||
public boolean isShowRoleLabelField(VitroRequest vreq) {
|
||||
public boolean isShowRoleLabelField() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,114 +2,38 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.vocabulary.XSD;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||
/**
|
||||
* Generates the edit configuration for adding a Role to a Person.
|
||||
|
||||
Stage one is selecting the type of the non-person thing
|
||||
associated with the Role with the intention of reducing the
|
||||
number of Individuals that the user has to select from.
|
||||
Stage two is selecting the non-person Individual to associate
|
||||
with the Role.
|
||||
|
||||
This is intended to create a set of statements like:
|
||||
|
||||
?person core:hasResearchActivityRole ?newRole.
|
||||
?newRole rdf:type core:ResearchActivityRole ;
|
||||
roleToActivityPredicate ?someActivity .
|
||||
?someActivity rdf:type core:ResearchActivity .
|
||||
?someActivity rdfs:label "activity title" .
|
||||
|
||||
|
||||
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||
methods, and must always implement the following methods:
|
||||
getRoleType
|
||||
getRoleActivityTypeOptionsType
|
||||
getRoleActivityTypeObjectClassUri
|
||||
getRoleActivityTypeLiteralOptions
|
||||
|
||||
*
|
||||
*/
|
||||
public class AddServiceProviderRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
private Log log = LogFactory.getLog(AddServiceProviderRoleToPersonGenerator.class);
|
||||
private static String template = "addServiceProviderRoleToPerson.ftl";
|
||||
|
||||
//Should this be overridden
|
||||
|
||||
@Override
|
||||
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||
VitroRequest vreq) {
|
||||
editConfiguration.setTemplate(template);
|
||||
String getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||
//correct for this subclass so they don't need to be overwritten
|
||||
|
||||
//role type will always be set based on particular form
|
||||
public String getRoleType(VitroRequest vreq) {
|
||||
//TODO: Get dynamic way of including vivoweb ontology
|
||||
@Override
|
||||
String getRoleType() {
|
||||
return "http://vivoweb.org/ontology/core#ServiceProviderRole";
|
||||
}
|
||||
|
||||
//Each subclass generator will return its own type of option here:
|
||||
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||
@Override
|
||||
RoleActivityOptionTypes getRoleActivityTypeOptionsType() {
|
||||
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||
}
|
||||
|
||||
//This too will depend on the specific subclass of generator
|
||||
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
@Override
|
||||
String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Service Provider role involves hard-coded options for the "right side" of the role or activity
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||
@Override
|
||||
HashMap<String, String> getRoleActivityTypeLiteralOptions() {
|
||||
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||
literalOptions.put("", "Select one");
|
||||
literalOptions.put("http://purl.org/ontology/bibo/Conference", "Conference");
|
||||
|
@ -145,7 +69,8 @@ public class AddServiceProviderRoleToPersonGenerator extends AddRoleToPersonTwoS
|
|||
return literalOptions;
|
||||
}
|
||||
|
||||
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||
@Override
|
||||
boolean isShowRoleLabelField() { return false; }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,114 +2,38 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.vocabulary.XSD;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||
/**
|
||||
* Generates the edit configuration for adding a Role to a Person.
|
||||
|
||||
Stage one is selecting the type of the non-person thing
|
||||
associated with the Role with the intention of reducing the
|
||||
number of Individuals that the user has to select from.
|
||||
Stage two is selecting the non-person Individual to associate
|
||||
with the Role.
|
||||
|
||||
This is intended to create a set of statements like:
|
||||
|
||||
?person core:hasResearchActivityRole ?newRole.
|
||||
?newRole rdf:type core:ResearchActivityRole ;
|
||||
roleToActivityPredicate ?someActivity .
|
||||
?someActivity rdf:type core:ResearchActivity .
|
||||
?someActivity rdfs:label "activity title" .
|
||||
|
||||
|
||||
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||
methods, and must always implement the following methods:
|
||||
getRoleType
|
||||
getRoleActivityTypeOptionsType
|
||||
getRoleActivityTypeObjectClassUri
|
||||
getRoleActivityTypeLiteralOptions
|
||||
|
||||
*
|
||||
*/
|
||||
public class AddTeacherRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
private Log log = LogFactory.getLog(AddTeacherRoleToPersonGenerator.class);
|
||||
private static String template = "addTeacherRoleToPerson.ftl";
|
||||
|
||||
//Should this be overridden
|
||||
|
||||
@Override
|
||||
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||
VitroRequest vreq) {
|
||||
editConfiguration.setTemplate(template);
|
||||
String getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||
//correct for this subclass so they don't need to be overwritten
|
||||
|
||||
//role type will always be set based on particular form
|
||||
public String getRoleType(VitroRequest vreq) {
|
||||
//TODO: Get dynamic way of including vivoweb ontology
|
||||
@Override
|
||||
String getRoleType() {
|
||||
return "http://vivoweb.org/ontology/core#TeacherRole";
|
||||
}
|
||||
|
||||
//Each subclass generator will return its own type of option here:
|
||||
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||
@Override
|
||||
RoleActivityOptionTypes getRoleActivityTypeOptionsType() {
|
||||
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||
}
|
||||
|
||||
//This too will depend on the specific subclass of generator
|
||||
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
@Override
|
||||
String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//Teacher role involves hard-coded options for the "right side" of the role or activity
|
||||
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||
@Override
|
||||
HashMap<String, String> getRoleActivityTypeLiteralOptions() {
|
||||
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||
literalOptions.put("", "Select one");
|
||||
literalOptions.put("http://purl.org/ontology/bibo/Conference", "Conference");
|
||||
|
@ -118,7 +42,7 @@ public class AddTeacherRoleToPersonGenerator extends AddRoleToPersonTwoStageGene
|
|||
return literalOptions;
|
||||
}
|
||||
|
||||
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||
|
||||
@Override
|
||||
boolean isShowRoleLabelField() { return false; }
|
||||
|
||||
}
|
||||
|
|
|
@ -168,17 +168,12 @@ public class NewIndividualFormGenerator implements EditConfigurationGenerator {
|
|||
editConfiguration.setPredicateUri(predicateUri);
|
||||
|
||||
//not concerned about remainder, can move into default obj prop form if required
|
||||
this.isObjectPropForm = true;
|
||||
this.initObjectParameters(vreq);
|
||||
this.isObjectPropForm = true;
|
||||
objectUri = EditConfigurationUtils.getObjectUri(vreq);
|
||||
|
||||
this.processObjectPropForm(vreq, editConfiguration);
|
||||
}
|
||||
|
||||
|
||||
private void initObjectParameters(VitroRequest vreq) {
|
||||
//in case of object property
|
||||
objectUri = EditConfigurationUtils.getObjectUri(vreq);
|
||||
}
|
||||
|
||||
private void processObjectPropForm(VitroRequest vreq, EditConfigurationVTwo editConfiguration) {
|
||||
editConfiguration.setVarNameForObject("objectNotUsed");
|
||||
editConfiguration.setObject(objectUri);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue