Working on default data process form
This commit is contained in:
parent
3dbd67d5c2
commit
221a38eca7
17 changed files with 496 additions and 436 deletions
|
@ -152,9 +152,10 @@ public class EditConfigurationUtils {
|
|||
return (dataProp != null);
|
||||
}
|
||||
|
||||
public static String getDataPropKey(VitroRequest vreq) {
|
||||
return vreq.getParameter("datapropKey");
|
||||
protected static String getDataPropKey(VitroRequest vreq) {
|
||||
return vreq.getParameter("datapropKey");
|
||||
}
|
||||
|
||||
//is object property
|
||||
public static boolean isObjectProperty(String predicateUri, VitroRequest vreq) {
|
||||
if(predicateUri == null) {
|
||||
|
@ -171,25 +172,21 @@ public class EditConfigurationUtils {
|
|||
return predicateUri.equals(VitroVocabulary.LABEL);
|
||||
}
|
||||
|
||||
public static DataPropertyStatement getDataPropertyStatement(VitroRequest vreq, HttpSession session, int dataHash, String predicateUri) {
|
||||
/**
|
||||
* May return null if data property statement cannot be found.
|
||||
*/
|
||||
public static DataPropertyStatement getDataPropertyStatement(VitroRequest vreq, HttpSession session, Integer dataHash, String predicateUri) {
|
||||
DataPropertyStatement dps = null;
|
||||
if( dataHash != 0) {
|
||||
Model model = (Model)session.getServletContext().getAttribute("jenaOntModel");
|
||||
dps = RdfLiteralHash.getPropertyStmtByHash(EditConfigurationUtils.getSubjectIndividual(vreq), predicateUri, dataHash, model);
|
||||
|
||||
if (dps==null) {
|
||||
//log.error("No match to existing data property \""+predicateUri+"\" statement for subject \""+subjectUri+"\" via key "+datapropKeyStr);
|
||||
//TODO: Needs to forward to dataPropMissingStatement.jsp
|
||||
//return null;
|
||||
}
|
||||
|
||||
dps = RdfLiteralHash.getPropertyStmtByHash(EditConfigurationUtils.getSubjectUri(vreq), predicateUri, dataHash, model);
|
||||
}
|
||||
return dps;
|
||||
}
|
||||
|
||||
//TODO: Include get object property statement
|
||||
public static int getDataHash(VitroRequest vreq) {
|
||||
int dataHash = 0;
|
||||
public static Integer getDataHash(VitroRequest vreq) {
|
||||
Integer dataHash = null;
|
||||
String datapropKey = EditConfigurationUtils.getDataPropKey(vreq);
|
||||
if (datapropKey!=null && datapropKey.trim().length()>0) {
|
||||
try {
|
||||
|
|
|
@ -27,13 +27,13 @@ import com.hp.hpl.jena.rdf.model.Literal;
|
|||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.EditLiteral;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.ModelSelector;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.StandardModelSelector;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.StandardWDFSelector;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.WDFSelector;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultDataPropertyFormGenerator;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ModelChangePreprocessor;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||
|
@ -98,7 +98,7 @@ public class EditConfigurationVTwo {
|
|||
String object;
|
||||
String varNameForObject;
|
||||
|
||||
String datapropKey;
|
||||
Integer datapropKey=null;
|
||||
String datapropValue;
|
||||
|
||||
|
||||
|
@ -300,28 +300,21 @@ public class EditConfigurationVTwo {
|
|||
}
|
||||
}
|
||||
|
||||
//TODO: Check if require
|
||||
/**
|
||||
* Make a copy of this EditConfiguration, prepare for a DataProperty update
|
||||
* and return it.
|
||||
*
|
||||
* TODO: there is a good chance that this could be moved to the generator for
|
||||
* the default data property form since that is the only place this is useful.
|
||||
* Prepare an EditConfiguration for a DataProperty update.
|
||||
* This should only be used when editing a existing data property statement.
|
||||
*/
|
||||
public void prepareForDataPropUpdate( Model model, DataPropertyStatement dpStmt){
|
||||
public void prepareForDataPropUpdate( Model model, DataPropertyDao dataPropertyDao ){
|
||||
if( model == null ) throw new Error("EditConfiguration.prepareForDataPropUpdate() needs a Model");
|
||||
if( isObjectResource() ){
|
||||
throw new Error("This request does not seems to be a DataPropStmt update");
|
||||
} else if (datapropKey == null) {
|
||||
throw new Error("This request does not appear to be for an update since it lacks a dataprop object or a dataProp hash key ");
|
||||
throw new Error("This request does not appear to be for an update since it lacks a dataProp hash key ");
|
||||
}
|
||||
|
||||
basicPrepare();
|
||||
|
||||
//TODO: Check if multiple statements might affect this implementation?
|
||||
List<Literal> dataPropLiterals = new ArrayList<Literal>();
|
||||
dataPropLiterals.add(new EditLiteral(dpStmt.getData(),dpStmt.getDatatypeURI(), dpStmt.getLanguage()));
|
||||
literalsInScope.put(varNameForObject, dataPropLiterals);
|
||||
DefaultDataPropertyFormGenerator.prepareForDataPropUpdate(model, this,dataPropertyDao );
|
||||
|
||||
// run SPARQL, sub in values
|
||||
SparqlEvaluateVTwo sparqlEval = new SparqlEvaluateVTwo(model);
|
||||
|
@ -332,13 +325,13 @@ public class EditConfigurationVTwo {
|
|||
}
|
||||
|
||||
/**
|
||||
* Make a copy of this EditConfiguration, prepare for a ObjectProperty update
|
||||
* and return it.
|
||||
* Prepare for a ObjectProperty update. Run SPARQL for existing values.
|
||||
* This can be used for an object property or a direct form.
|
||||
*/
|
||||
public void prepareForObjPropUpdate( Model model ){
|
||||
if( model == null ) {
|
||||
log.debug("Model is null and will be throwing an error");
|
||||
throw new Error("EditConfiguration.prepareForObjPropUpdate() needs a Model");}
|
||||
throw new Error("EditConfiguration.prepareForObjPropUpdate() needs a non-null Model");}
|
||||
if( !isObjectResource() ) {
|
||||
log.debug("This does not seem to be an object property update. Lacks object.");
|
||||
throw new Error("This request does not appear to be for a object property update.");
|
||||
|
@ -358,9 +351,12 @@ public class EditConfigurationVTwo {
|
|||
hasBeenPreparedForUpdate = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run SPARQL for Additional values. This can be used for
|
||||
* a data property, an object property or a direct form.
|
||||
*/
|
||||
public void prepareForNonUpdate( Model model ){
|
||||
if( model == null ) throw new Error("EditConfiguration.prepareForNonUpdate() needs a Model");
|
||||
if( model == null ) throw new Error("prepareForNonUpdate() needs a non-null Model");
|
||||
|
||||
basicPrepare();
|
||||
|
||||
|
@ -675,18 +671,18 @@ public class EditConfigurationVTwo {
|
|||
boolean dataKeyFound = false;
|
||||
if( object != null && ! object.trim().isEmpty() )
|
||||
objectFound = true;
|
||||
if( getDatapropKey() != null && ! getDatapropKey().isEmpty() )
|
||||
if( getDatapropKey() != null )
|
||||
dataKeyFound = true;
|
||||
if( dataKeyFound && objectFound )
|
||||
throw new Error("Bad configuration: both datapropKey and object are defined.");
|
||||
return objectFound;
|
||||
}
|
||||
|
||||
public String getDatapropKey() {
|
||||
public Integer getDatapropKey() {
|
||||
return datapropKey;
|
||||
}
|
||||
|
||||
public void setDatapropKey(String datapropKey) {
|
||||
public void setDatapropKey(Integer datapropKey) {
|
||||
this.datapropKey = datapropKey;
|
||||
}
|
||||
|
||||
|
@ -893,7 +889,7 @@ public class EditConfigurationVTwo {
|
|||
}
|
||||
|
||||
public boolean isDataPropertyUpdate() {
|
||||
return this.getDatapropKey() != null && this.getDatapropKey().length() > 0;
|
||||
return this.getDatapropKey() != null ;
|
||||
}
|
||||
|
||||
//This is for specific data for a form that will be set by the generator
|
||||
|
@ -974,5 +970,13 @@ public class EditConfigurationVTwo {
|
|||
|
||||
private static final String INDIVIDUAL_CONTROLLER = "/individual";
|
||||
|
||||
public EditConfigurationVTwo addLiteralInScope(String key, Literal ... values) {
|
||||
if( literalsInScope == null ){
|
||||
literalsInScope = new HashMap<String, List<Literal>>();
|
||||
}
|
||||
literalsInScope.put(key, Arrays.asList(values));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.RDFSLabelGenerator;
|
||||
|
||||
public class JspToGeneratorMapping {
|
||||
static Log log = LogFactory.getLog( JspToGeneratorMapping.class );
|
||||
|
||||
public static Map<String,String> jspsToGenerators;
|
||||
|
||||
static{
|
||||
jspsToGenerators = new HashMap<String,String>();
|
||||
Map<String, String> map = jspsToGenerators;
|
||||
|
||||
// vitro forms:
|
||||
// map.put("autoCompleteDatapropForm.jsp",
|
||||
// edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AutoCompleteDatapropFormGenerator.class.getName());
|
||||
// map.put("autoCompleteObjPropForm.jsp",
|
||||
// edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AutoCompleteObjPropFormGenerator.class.getName());
|
||||
map.put("datapropStmtDelete.jsp",
|
||||
edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultDeleteGenerator.class.getName());
|
||||
// map.put("dateTimeIntervalForm.jsp",
|
||||
// edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DateTimeIntervalFormGenerator.class.getName());
|
||||
// map.put("dateTimeValueForm.jsp",
|
||||
// edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DateTimeValueFormGenerator.class.getName());
|
||||
map.put("defaultAddMissingIndividualForm.jsp",
|
||||
edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultAddMissingIndividualFormGenerator.class.getName());
|
||||
map.put("defaultDatapropForm.jsp",
|
||||
edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultDataPropertyFormGenerator.class.getName());
|
||||
map.put("defaultObjPropForm.jsp",
|
||||
edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultObjectPropertyFormGenerator.class.getName());
|
||||
map.put("newIndividualForm.jsp",
|
||||
edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.NewIndividualFormGenerator.class.getName());
|
||||
map.put("propDelete.jsp",
|
||||
edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultDeleteGenerator.class.getName());
|
||||
map.put("rdfsLabelForm.jsp",
|
||||
RDFSLabelGenerator.class.getName());
|
||||
|
||||
//add in the vivo mappings if they exist
|
||||
Object object = null;
|
||||
try {
|
||||
Class classDefinition =
|
||||
Class.forName("edu.cornell.mannlib.vitro.webapp.edit.n3editing.N3TransitionToV2Mapping");
|
||||
object = classDefinition.newInstance();
|
||||
Map<String,String> vivoJspsToGenerators = (Map) object;
|
||||
if( vivoJspsToGenerators != null )
|
||||
map.putAll( vivoJspsToGenerators );
|
||||
|
||||
} catch (Throwable th){
|
||||
log.error( "could not load VIVO jsp mappings",th );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,9 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
|
@ -10,6 +12,8 @@ import com.hp.hpl.jena.rdf.model.Literal;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.EditConfigurationGenerator;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.RDFSLabelGenerator;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ModelChangePreprocessor;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||
|
||||
|
@ -109,12 +113,14 @@ public class N3EditUtils {
|
|||
dps.setLanguage( submittedLiteral.getLanguage() );
|
||||
dps.setData( submittedLiteral.getLexicalForm() );
|
||||
|
||||
copy.prepareForDataPropUpdate(writeModel, dps);
|
||||
copy.setDatapropKey( Integer.toString(RdfLiteralHash.makeRdfLiteralHash(dps)) );
|
||||
copy.prepareForDataPropUpdate(writeModel, vreq.getWebappDaoFactory().getDataPropertyDao());
|
||||
copy.setDatapropKey( RdfLiteralHash.makeRdfLiteralHash(dps));
|
||||
}
|
||||
EditConfigurationVTwo.putConfigInSession(copy,vreq.getSession());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public abstract class BaseEditConfigurationGenerator implements EditConfiguratio
|
|||
* Method to turn Strings or multiple List<String> to List<String>.
|
||||
* Only accepts String and List<String> as multi args.
|
||||
*/
|
||||
List<String> list( Object ... objs){
|
||||
static List<String> list( Object ... objs){
|
||||
List<String> rv = new ArrayList<String>();
|
||||
for( Object obj: objs){
|
||||
if( obj instanceof String)
|
||||
|
|
|
@ -2,124 +2,83 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
||||
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.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.EditLiteral;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.DefaultDataPropEmptyField;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||
|
||||
public class DefaultDataPropertyFormGenerator implements EditConfigurationGenerator {
|
||||
public class DefaultDataPropertyFormGenerator extends BaseEditConfigurationGenerator implements EditConfigurationGenerator {
|
||||
|
||||
private Log log = LogFactory.getLog(DefaultDataPropertyFormGenerator.class);
|
||||
private static HashMap<String,String> defaultsForXSDtypes;
|
||||
private static Log log = LogFactory.getLog(DefaultDataPropertyFormGenerator.class);
|
||||
|
||||
static {
|
||||
defaultsForXSDtypes = new HashMap<String,String>();
|
||||
//defaultsForXSDtypes.put("http://www.w3.org/2001/XMLSchema#dateTime","2001-01-01T12:00:00");
|
||||
defaultsForXSDtypes.put("http://www.w3.org/2001/XMLSchema#dateTime","#Unparseable datetime defaults to now");
|
||||
}
|
||||
static String literalVar = "literal";
|
||||
static String literalPlaceholder = "?"+literalVar;
|
||||
|
||||
@Override
|
||||
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
|
||||
HttpSession session) {
|
||||
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, HttpSession session) {
|
||||
String command = vreq.getParameter("cmd");
|
||||
|
||||
String subjectUri = vreq.getParameter("subjectUri");
|
||||
Individual subject = vreq.getWebappDaoFactory().getIndividualDao().getIndividualByURI(subjectUri);
|
||||
if( subject == null )
|
||||
throw new Error("In DefaultDataPropertyFormGenerator, could not find individual for URI " + subjectUri);
|
||||
|
||||
String subjectUri = vreq.getParameter("subjectUri");
|
||||
String predicateUri = vreq.getParameter("predicateUri");
|
||||
String subjectUriJson = (String)vreq.getAttribute("subjectUriJson");
|
||||
String predicateUriJson = (String)vreq.getAttribute("predicateUriJson");
|
||||
String objectUriJson = (String)vreq.getAttribute("objectUriJson");
|
||||
|
||||
DataPropertyStatement dps = (DataPropertyStatement)vreq.getAttribute("dataprop");
|
||||
|
||||
String datapropKeyStr = vreq.getParameter("datapropKey");
|
||||
int dataHash=0;
|
||||
|
||||
DataProperty prop = (DataProperty)vreq.getAttribute("predicate");
|
||||
//if( prop == null ) return doHelp(vreq, "In DefaultDataPropertyFormGenerator, could not find predicate " + predicateUri);
|
||||
vreq.setAttribute("propertyName",prop.getPublicName());
|
||||
|
||||
Individual subject = (Individual)vreq.getAttribute("subject");
|
||||
//if( subject == null ) return doHelp(vreq,"In DefaultDataPropertyFormGenerator, could not find subject " + subjectUri);
|
||||
vreq.setAttribute("subjectName",subject.getName());
|
||||
|
||||
String rangeDatatypeUri = vreq.getWebappDaoFactory().getDataPropertyDao().getRequiredDatatypeURI(subject, prop);
|
||||
//String rangeDatatypeUri = prop.getRangeDatatypeURI();
|
||||
vreq.setAttribute("rangeDatatypeUriJson", MiscWebUtils.escape(rangeDatatypeUri));
|
||||
|
||||
|
||||
if( dps != null ){
|
||||
try {
|
||||
dataHash = Integer.parseInt(datapropKeyStr);
|
||||
log.debug("dataHash is " + dataHash);
|
||||
} catch (NumberFormatException ex) {
|
||||
log.debug("could not parse dataprop hash "+
|
||||
"but there was a dataproperty; hash: '"+datapropKeyStr+"'");
|
||||
}
|
||||
|
||||
String rangeDatatype = dps.getDatatypeURI();
|
||||
if( rangeDatatype == null ){
|
||||
log.debug("no range datatype uri set on data property statement when property's range datatype is "+prop.getRangeDatatypeURI()+" in DefaultDataPropertyFormGenerator");
|
||||
vreq.setAttribute("rangeDatatypeUriJson","");
|
||||
} else {
|
||||
log.debug("range datatype uri of ["+rangeDatatype+"] on data property statement in DefaultDataPropertyFormGenerator");
|
||||
vreq.setAttribute("rangeDatatypeUriJson",rangeDatatype);
|
||||
}
|
||||
String rangeLang = dps.getLanguage();
|
||||
if( rangeLang == null ) {
|
||||
log.debug("no language attribute on data property statement in DefaultDataPropertyFormGenerator");
|
||||
vreq.setAttribute("rangeLangJson","");
|
||||
}else{
|
||||
log.debug("language attribute of ["+rangeLang+"] on data property statement in DefaultDataPropertyFormGenerator");
|
||||
vreq.setAttribute("rangeLangJson", rangeLang);
|
||||
}
|
||||
} else {
|
||||
log.debug("No incoming dataproperty statement attribute for property "+prop.getPublicName()+"; adding a new statement");
|
||||
if(rangeDatatypeUri != null && rangeDatatypeUri.length() > 0) {
|
||||
String defaultVal = defaultsForXSDtypes.get(rangeDatatypeUri);
|
||||
if( defaultVal == null )
|
||||
vreq.setAttribute("rangeDefaultJson", "");
|
||||
else
|
||||
vreq.setAttribute("rangeDefaultJson", '"' + MiscWebUtils.escape(defaultVal) + '"' );
|
||||
WebappDaoFactory unfilteredWdf = vreq.getUnfilteredWebappDaoFactory();
|
||||
DataProperty dataproperty = unfilteredWdf.getDataPropertyDao().getDataPropertyByURI( predicateUri );
|
||||
if( dataproperty == null) {
|
||||
// No dataproperty will be returned for rdfs:label, but we shouldn't throw an error.
|
||||
// This is controlled by the Jena layer, so we can't change the behavior.
|
||||
if (! predicateUri.equals(VitroVocabulary.LABEL)) {
|
||||
log.error("Could not find data property '"+predicateUri+"' in model");
|
||||
throw new Error("editDatapropStmtRequest.jsp: Could not find DataProperty in model: " + predicateUri);
|
||||
}
|
||||
}
|
||||
|
||||
String rangeDatatypeUri = dataproperty.getRangeDatatypeURI();
|
||||
if( rangeDatatypeUri == null || rangeDatatypeUri.trim().isEmpty() ){
|
||||
rangeDatatypeUri = vreq.getWebappDaoFactory().getDataPropertyDao().getRequiredDatatypeURI(subject, dataproperty);
|
||||
}
|
||||
|
||||
String localName = prop.getLocalName();
|
||||
String dataLiteral = localName + "Edited";
|
||||
String formUrl = (String)vreq.getAttribute("formUrl");
|
||||
String editKey = (String)vreq.getAttribute("editKey");
|
||||
EditConfigurationVTwo editConfiguration = new EditConfigurationVTwo();
|
||||
|
||||
EditConfigurationVTwo editConfiguration = new EditConfigurationVTwo();
|
||||
editConfiguration.setTemplate("defaultDataPropertyForm.ftl");
|
||||
|
||||
List<String> n3ForEdit = new ArrayList<String>();
|
||||
n3ForEdit.add("?subject");
|
||||
n3ForEdit.add("?predicate");
|
||||
n3ForEdit.add("?"+dataLiteral);
|
||||
editConfiguration.setN3Required(n3ForEdit);
|
||||
editConfiguration.setN3Required(Arrays.asList( "?subject ?predicate " + literalPlaceholder + " . "));
|
||||
|
||||
editConfiguration.setFormUrl(formUrl);
|
||||
editConfiguration.setEditKey(editKey);
|
||||
|
||||
editConfiguration.setDatapropKey((datapropKeyStr==null)?"":datapropKeyStr);
|
||||
editConfiguration.setUrlPatternToReturnTo("/individual");
|
||||
editConfiguration.setDatapropKey( EditConfigurationUtils.getDataHash(vreq) );
|
||||
|
||||
editConfiguration.setVarNameForSubject("subject");
|
||||
editConfiguration.setSubjectUri(subjectUriJson);
|
||||
editConfiguration.setSubjectUri(subjectUri);
|
||||
editConfiguration.setEntityToReturnTo( subjectUri );
|
||||
|
||||
editConfiguration.setVarNameForPredicate("predicate");
|
||||
editConfiguration.setPredicateUri(predicateUriJson);
|
||||
editConfiguration.setPredicateUri(predicateUri);
|
||||
|
||||
editConfiguration.setLiteralsOnForm( Arrays.asList( literalVar ));
|
||||
|
||||
editConfiguration.addField( new FieldVTwo()
|
||||
.setName( literalVar )
|
||||
.setPredicateUri(predicateUri)
|
||||
.setRangeDatatypeUri(rangeDatatypeUri));
|
||||
|
||||
//deal with empty field
|
||||
editConfiguration.addModelChangePreprocessor( new DefaultDataPropEmptyField() );
|
||||
|
@ -127,9 +86,51 @@ public class DefaultDataPropertyFormGenerator implements EditConfigurationGenera
|
|||
return editConfiguration;
|
||||
}
|
||||
|
||||
private EditConfigurationVTwo doHelp(VitroRequest vreq, String string) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void prepareForDataPropUpdate(Model model, EditConfigurationVTwo editConfiguration, DataPropertyDao dataPropertyDao){
|
||||
|
||||
String subjectUri = editConfiguration.getSubjectUri();
|
||||
String predicateUri = editConfiguration.getPredicateUri();
|
||||
Integer dataHash = editConfiguration.getDatapropKey();
|
||||
|
||||
DataProperty dataproperty = dataPropertyDao.getDataPropertyByURI( predicateUri );
|
||||
if( dataproperty == null )
|
||||
throw new Error("could not get data property for " + predicateUri);
|
||||
|
||||
DataPropertyStatement dps = null;
|
||||
if( dataHash == null ){
|
||||
throw new Error("prepareForDataPropUpdate() should not be called if the EditConfiguration is not a data property statement update ");
|
||||
}else{
|
||||
dps = RdfLiteralHash.getPropertyStmtByHash(subjectUri, predicateUri, dataHash, model);
|
||||
if (dps==null){
|
||||
throw new Error("No match to existing data property \""+predicateUri+"\" statement for subject \""+subjectUri+"\" via key "+dataHash);
|
||||
}else{
|
||||
|
||||
//Put data property statement's literal in scope
|
||||
//TODO: Check if multiple statements might affect this implementation?
|
||||
editConfiguration.addLiteralInScope(literalVar, new EditLiteral(dps.getData(),dps.getDatatypeURI(), dps.getLanguage()) );
|
||||
|
||||
String statementDataType = null;
|
||||
String statementLang = null;
|
||||
|
||||
statementDataType = dps.getDatatypeURI();
|
||||
if( statementDataType == null ){
|
||||
log.debug("no range datatype uri set on data property statement when property's range datatype is "+dataproperty.getRangeDatatypeURI()+" in DefaultDataPropertyFormGenerator");
|
||||
} else {
|
||||
log.debug("range datatype uri of ["+statementDataType+"] on data property statement in DefaultDataPropertyFormGenerator");
|
||||
}
|
||||
statementLang = dps.getLanguage();
|
||||
if( statementLang == null ) {
|
||||
log.debug("no language attribute on data property statement in DefaultDataPropertyFormGenerator");
|
||||
}else{
|
||||
log.debug("language attribute of ["+statementLang+"] on data property statement in DefaultDataPropertyFormGenerator");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,8 +49,7 @@ public class DefaultDeleteGenerator implements EditConfigurationGenerator {
|
|||
private String subjectUri = null;
|
||||
private String predicateUri = null;
|
||||
private String objectUri = null;
|
||||
private String datapropKeyStr= null;
|
||||
private int dataHash = 0;
|
||||
private Integer dataHash = 0;
|
||||
private DataPropertyStatement dps = null;
|
||||
private String dataLiteral = null;
|
||||
private String template = "confirmDeletePropertyForm.ftl";
|
||||
|
@ -107,14 +106,9 @@ public class DefaultDeleteGenerator implements EditConfigurationGenerator {
|
|||
}
|
||||
|
||||
private void initDataParameters(VitroRequest vreq, HttpSession session) {
|
||||
datapropKeyStr = EditConfigurationUtils.getDataPropKey(vreq);
|
||||
if( datapropKeyStr != null ){
|
||||
try {
|
||||
dataHash = Integer.parseInt(datapropKeyStr);
|
||||
log.debug("Found a datapropKey in parameters and parsed it to int: " + dataHash);
|
||||
} catch (NumberFormatException ex) {
|
||||
//return doHelp(vreq, "Cannot decode incoming datapropKey value "+datapropKeyStr+" as an integer hash in EditDataPropStmtRequestDispatchController");
|
||||
}
|
||||
dataHash = EditConfigurationUtils.getDataHash(vreq);
|
||||
if( dataHash != null ){
|
||||
log.debug("Found a datapropKey in parameters and parsed it to int: " + dataHash);
|
||||
}
|
||||
dps = EditConfigurationUtils.getDataPropertyStatement(vreq, session, dataHash, predicateUri);
|
||||
}
|
||||
|
@ -135,7 +129,7 @@ public class DefaultDeleteGenerator implements EditConfigurationGenerator {
|
|||
|
||||
private void processDataPropForm(VitroRequest vreq, EditConfigurationVTwo editConfiguration) {
|
||||
//set data prop value, data prop key str,
|
||||
editConfiguration.setDatapropKey((datapropKeyStr==null)?"":datapropKeyStr);
|
||||
editConfiguration.setDatapropKey( EditConfigurationUtils.getDataHash(vreq) );
|
||||
//original set datapropValue, which in this case would be empty string but no way here
|
||||
editConfiguration.setDatapropValue("");
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class DefaultObjectPropertyFormGenerator implements EditConfigurationGene
|
|||
private String objectUri = null;
|
||||
private String datapropKeyStr= null;
|
||||
private int dataHash = 0;
|
||||
private DataPropertyStatement dps = null;
|
||||
|
||||
private String dataLiteral = null;
|
||||
private String objectPropertyTemplate = "defaultPropertyForm.ftl";
|
||||
private String dataPropertyTemplate = "defaultDataPropertyForm.ftl";
|
||||
|
@ -161,26 +161,10 @@ public class DefaultObjectPropertyFormGenerator implements EditConfigurationGene
|
|||
this.processObjectPropForm(vreq, editConfiguration);
|
||||
} else {
|
||||
this.isObjectPropForm = false;
|
||||
this.initDataParameters(vreq, session);
|
||||
this.processDataPropForm(vreq, editConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
private void initDataParameters(VitroRequest vreq, HttpSession session) {
|
||||
dataLiteral = getDataLiteral(vreq);
|
||||
datapropKeyStr = EditConfigurationUtils.getDataPropKey(vreq);
|
||||
if( datapropKeyStr != null ){
|
||||
try {
|
||||
dataHash = Integer.parseInt(datapropKeyStr);
|
||||
log.debug("Found a datapropKey in parameters and parsed it to int: " + dataHash);
|
||||
} catch (NumberFormatException ex) {
|
||||
//return doHelp(vreq, "Cannot decode incoming datapropKey value "+datapropKeyStr+" as an integer hash in EditDataPropStmtRequestDispatchController");
|
||||
}
|
||||
}
|
||||
dps = EditConfigurationUtils.getDataPropertyStatement(vreq, session, dataHash, predicateUri);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void initObjectParameters(VitroRequest vreq) {
|
||||
//in case of object property
|
||||
|
@ -450,15 +434,7 @@ public class DefaultObjectPropertyFormGenerator implements EditConfigurationGene
|
|||
editConfiguration.prepareForNonUpdate( model );
|
||||
}
|
||||
} else {
|
||||
//TODO: why is this checking for data prop keys?
|
||||
if(datapropKeyStr != null && datapropKeyStr.trim().length() > 0 ) {
|
||||
DataPropertyStatement dps = EditConfigurationUtils.getDataPropertyStatement(vreq,
|
||||
session,
|
||||
dataHash,
|
||||
EditConfigurationUtils.getPredicateUri(vreq));
|
||||
|
||||
editConfiguration.prepareForDataPropUpdate(model, dps);
|
||||
}
|
||||
throw new Error("DefaultObjectPropertyForm does not handle data properties.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
|||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||
|
@ -175,9 +176,8 @@ public class MenuEditingFormGenerator implements EditConfigurationGenerator {
|
|||
}
|
||||
|
||||
private void processDataPropForm(VitroRequest vreq, EditConfigurationVTwo editConfiguration) {
|
||||
String datapropKeyStr = vreq.getParameter("datapropKey");
|
||||
int dataHash=0;
|
||||
DataPropertyStatement dps = (DataPropertyStatement)vreq.getAttribute("dataprop");
|
||||
Integer dataHash = EditConfigurationUtils.getDataHash(vreq);
|
||||
DataPropertyStatement dps = (DataPropertyStatement)vreq.getAttribute("dataprop");
|
||||
|
||||
//ObjectUriJson is null, so should include data prop info here
|
||||
//Use dataprop key info here instead
|
||||
|
@ -195,13 +195,7 @@ public class MenuEditingFormGenerator implements EditConfigurationGenerator {
|
|||
|
||||
|
||||
if( dps != null ){
|
||||
try {
|
||||
dataHash = Integer.parseInt(datapropKeyStr);
|
||||
log.debug("dataHash is " + dataHash);
|
||||
} catch (NumberFormatException ex) {
|
||||
log.debug("could not parse dataprop hash "+
|
||||
"but there was a dataproperty; hash: '"+datapropKeyStr+"'");
|
||||
}
|
||||
log.debug("dataHash is " + dataHash);
|
||||
|
||||
String rangeDatatype = dps.getDatatypeURI();
|
||||
if( rangeDatatype == null ){
|
||||
|
@ -229,7 +223,7 @@ public class MenuEditingFormGenerator implements EditConfigurationGenerator {
|
|||
vreq.setAttribute("rangeDefaultJson", '"' + MiscWebUtils.escape(defaultVal) + '"' );
|
||||
}
|
||||
}
|
||||
editConfiguration.setDatapropKey((datapropKeyStr==null)?"":datapropKeyStr);
|
||||
editConfiguration.setDatapropKey(dataHash);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -145,25 +145,13 @@ public class RDFSLabelGenerator implements EditConfigurationGenerator {
|
|||
|
||||
|
||||
private void initDataParameters(VitroRequest vreq, HttpSession session) {
|
||||
datapropKeyStr = EditConfigurationUtils.getDataPropKey(vreq);
|
||||
if( datapropKeyStr != null ){
|
||||
try {
|
||||
dataHash = Integer.parseInt(datapropKeyStr);
|
||||
log.debug("Found a datapropKey in parameters and parsed it to int: " + dataHash);
|
||||
} catch (NumberFormatException ex) {
|
||||
//return doHelp(vreq, "Cannot decode incoming datapropKey value "+datapropKeyStr+" as an integer hash in EditDataPropStmtRequestDispatchController");
|
||||
}
|
||||
}
|
||||
dataHash = EditConfigurationUtils.getDataHash(vreq);
|
||||
dps = EditConfigurationUtils.getDataPropertyStatement(vreq, session, dataHash, predicateUri);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void processDataPropForm(VitroRequest vreq, EditConfigurationVTwo editConfiguration) {
|
||||
//set data prop value, data prop key str,
|
||||
editConfiguration.setDatapropKey((datapropKeyStr==null)?"":datapropKeyStr);
|
||||
editConfiguration.setDatapropKey( EditConfigurationUtils.getDataHash(vreq) );
|
||||
editConfiguration.setVarNameForObject(literalName);
|
||||
|
||||
//original set datapropValue, which in this case would be empty string but no way here
|
||||
|
@ -346,7 +334,7 @@ public class RDFSLabelGenerator implements EditConfigurationGenerator {
|
|||
//Here, retrieve model from
|
||||
Model model = (Model) session.getServletContext().getAttribute("jenaOntModel");
|
||||
if(datapropKeyStr != null && datapropKeyStr.trim().length() > 0 ) {
|
||||
editConfiguration.prepareForDataPropUpdate(model, dps);
|
||||
editConfiguration.prepareForDataPropUpdate(model, vreq.getWebappDaoFactory().getDataPropertyDao());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Property;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -78,7 +79,7 @@ public class EditRequestDispatchController extends FreemarkerHttpServlet {
|
|||
|
||||
/**** make new or get an existing edit configuration ***/
|
||||
EditConfigurationVTwo editConfig = setupEditConfiguration(editConfGeneratorName, vreq);
|
||||
|
||||
log.debug("editConfiguration:\n" + editConfig );
|
||||
|
||||
//what template?
|
||||
String template = editConfig.getTemplate();
|
||||
|
@ -139,14 +140,15 @@ public class EditRequestDispatchController extends FreemarkerHttpServlet {
|
|||
editConfig.setPredicateUri( EditConfigurationUtils.getPredicateUri(vreq));
|
||||
|
||||
String objectUri = EditConfigurationUtils.getObjectUri(vreq);
|
||||
String dataKey = EditConfigurationUtils.getDataPropKey(vreq);
|
||||
Integer dataKey = EditConfigurationUtils.getDataHash(vreq);
|
||||
if (objectUri != null && ! objectUri.trim().isEmpty()) {
|
||||
// editing existing object
|
||||
if( editConfig.getObject() == null)
|
||||
editConfig.setObject( EditConfigurationUtils.getObjectUri(vreq));
|
||||
editConfig.prepareForObjPropUpdate(model);
|
||||
} else if( dataKey != null ) { // edit of a data prop
|
||||
} else if( dataKey != null ) { // edit of a data prop statement
|
||||
//do nothing since the data prop form generator must take care of it
|
||||
editConfig.prepareForDataPropUpdate(model, vreq.getWebappDaoFactory().getDataPropertyDao());
|
||||
} else{
|
||||
//this might be a create new or a form
|
||||
editConfig.prepareForNonUpdate(model);
|
||||
|
@ -168,37 +170,43 @@ public class EditRequestDispatchController extends FreemarkerHttpServlet {
|
|||
//e.g. default add individual form etc. and additional scenarios
|
||||
//TODO: Check if additional scenarios should be checked here
|
||||
private String processEditConfGeneratorName(VitroRequest vreq) {
|
||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
||||
//use default object property form if nothing else works
|
||||
String editConfGeneratorName = DEFAULT_OBJ_FORM;
|
||||
String predicateUri = getPredicateUri(vreq);
|
||||
String formParam = getFormParam(vreq);
|
||||
|
||||
//Handle deletion before any of the other cases
|
||||
if(isDeleteForm(vreq)) {
|
||||
editConfGeneratorName = DEFAULT_DELETE_FORM;
|
||||
return DEFAULT_DELETE_FORM;
|
||||
}
|
||||
|
||||
// *** handle the case where the form is specified as a request parameter ***
|
||||
//TODO: Substitute the original line in again which checks for null predicate, currently overriding
|
||||
//in order to test
|
||||
//else if( predicateUri == null && ( formParam != null && !formParam.isEmpty()) ){
|
||||
else if( formParam != null && !formParam.isEmpty() ){
|
||||
String formParam = getFormParam(vreq);
|
||||
if( formParam != null && !formParam.isEmpty() ){
|
||||
//form parameter must be a fully qualified java class name of a EditConfigurationVTwoGenerator implementation.
|
||||
editConfGeneratorName = formParam;
|
||||
} else if(isVitroLabel(predicateUri)) { //in case of data property
|
||||
editConfGeneratorName = RDFS_LABEL_FORM;
|
||||
return formParam;
|
||||
}
|
||||
|
||||
String predicateUri = getPredicateUri(vreq);
|
||||
if( isVitroLabel(predicateUri) ) { //in case of data property
|
||||
return RDFS_LABEL_FORM;
|
||||
}
|
||||
|
||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
||||
Property prop = getPropertyByUri(predicateUri, wdf);
|
||||
|
||||
if(isDataProperty( prop , wdf )){
|
||||
editConfGeneratorName = DEFAULT_DATA_FORM;
|
||||
} else{
|
||||
String customForm = getCustomForm(predicateUri, wdf);
|
||||
if(customForm != null && !customForm.isEmpty()) {
|
||||
String customForm = prop.getCustomEntryForm();
|
||||
if(customForm != null && !customForm.trim().isEmpty()) {
|
||||
editConfGeneratorName = customForm;
|
||||
}
|
||||
}
|
||||
|
||||
log.debug("generator name is " + editConfGeneratorName);
|
||||
return editConfGeneratorName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private String getCustomForm(String predicateUri, WebappDaoFactory wdf) {
|
||||
private String getCustomForm(String predicateUri, WebappDaoFactory wdf) {
|
||||
Property prop = getPropertyByUri(predicateUri, wdf);
|
||||
return prop.getCustomEntryForm();
|
||||
}
|
||||
|
@ -212,11 +220,22 @@ public class EditRequestDispatchController extends FreemarkerHttpServlet {
|
|||
return p;
|
||||
}
|
||||
|
||||
|
||||
private boolean isVitroLabel(String predicateUri) {
|
||||
return predicateUri.equals(VitroVocabulary.LABEL);
|
||||
}
|
||||
|
||||
private boolean isDataProperty(Property prop, WebappDaoFactory wdf) {
|
||||
if( prop != null && prop instanceof DataProperty ){
|
||||
return true;
|
||||
}else{
|
||||
DataProperty dataProp = wdf.getDataPropertyDao().getDataPropertyByURI(prop.getURI());
|
||||
if( dataProp != null )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if skip edit form
|
||||
private boolean isSkipEditForm(VitroRequest vreq) {
|
||||
|
|
|
@ -131,17 +131,18 @@ public class ProcessRdfFormController extends FreemarkerHttpServlet{
|
|||
if(EditConfigurationUtils.isObjectProperty(editConfig.getPredicateUri(), vreq)) {
|
||||
return false;
|
||||
}
|
||||
Individual subject = EditConfigurationUtils.getSubjectIndividual(vreq);
|
||||
|
||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
||||
if (editConfig.getDatapropKey() == null
|
||||
|| editConfig.getDatapropKey().length() == 0)
|
||||
if ( ! editConfig.isDataPropertyUpdate())
|
||||
return false;
|
||||
|
||||
int dpropHash = Integer.parseInt(editConfig.getDatapropKey());
|
||||
DataPropertyStatement dps = RdfLiteralHash.getPropertyStmtByHash(subject, editConfig.getPredicateUri(), dpropHash, model);
|
||||
|
||||
Integer dpropHash = editConfig.getDatapropKey();
|
||||
DataPropertyStatement dps =
|
||||
RdfLiteralHash.getPropertyStmtByHash(editConfig.getSubjectUri(),
|
||||
editConfig.getPredicateUri(), dpropHash, model);
|
||||
if (dps != null)
|
||||
return false;
|
||||
|
||||
DataProperty dp = wdf.getDataPropertyDao().getDataPropertyByURI(
|
||||
editConfig.getPredicateUri());
|
||||
if (dp != null) {
|
||||
|
|
|
@ -78,49 +78,18 @@ public class RdfLiteralHash {
|
|||
|
||||
/**
|
||||
* Forward to either getDataPropertyStmtByHash or getRdfsLabelStatementByHash, depending on the property.
|
||||
* @param ind
|
||||
* @param subjectUri,
|
||||
* @param predicateUri,
|
||||
* @param hash
|
||||
* @param model
|
||||
* @param model, may not be null
|
||||
* @return a DataPropertyStatement if found or null if not found
|
||||
*/
|
||||
|
||||
public static DataPropertyStatement getPropertyStmtByHash(Individual ind, String predicateUri, int hash, Model model) {
|
||||
public static DataPropertyStatement getPropertyStmtByHash(String subjectUri, String predicateUri, int hash, Model model) {
|
||||
if (subjectUri == null || predicateUri == null ) return null;
|
||||
|
||||
if (ind == null) return null;
|
||||
|
||||
// RY Instead of a code fork here, we should have a method of Individual getAllDataPropertyStatements() which
|
||||
// doesn't filter out rdfs:label.
|
||||
DataPropertyStatement dps = predicateUri.equals(VitroVocabulary.LABEL)
|
||||
? getRdfsLabelStatementByHash(ind, model, hash)
|
||||
: getDataPropertyStmtByHash(ind, hash);
|
||||
|
||||
return dps;
|
||||
}
|
||||
|
||||
|
||||
public static DataPropertyStatement getDataPropertyStmtByHash( Individual ind, int hash){
|
||||
|
||||
List<DataPropertyStatement> statements = ind.getDataPropertyStatements();
|
||||
if( statements == null ) return null;
|
||||
for( DataPropertyStatement dps : statements){
|
||||
if( doesStmtMatchHash(dps, hash) )
|
||||
return dps;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ind, may be null
|
||||
* @param hash
|
||||
* @return a DataPropertyStatement if found or null if not found
|
||||
*/
|
||||
public static DataPropertyStatement getRdfsLabelStatementByHash(Individual ind, Model model, int hash) {
|
||||
|
||||
String predicateUri = VitroVocabulary.LABEL;
|
||||
|
||||
DataPropertyStatement dps = null;
|
||||
StmtIterator stmts = model.listStatements(model.createResource(ind.getURI()),
|
||||
model.enterCriticalSection(false);
|
||||
StmtIterator stmts = model.listStatements(model.createResource(subjectUri),
|
||||
model.getProperty(predicateUri),
|
||||
(RDFNode)null);
|
||||
try {
|
||||
|
@ -128,19 +97,112 @@ public class RdfLiteralHash {
|
|||
Statement stmt = stmts.nextStatement();
|
||||
RDFNode node = stmt.getObject();
|
||||
if ( node.isLiteral() ){
|
||||
dps = makeDataPropertyStatementFromStatement(stmt, node);
|
||||
DataPropertyStatement dps =
|
||||
makeDataPropertyStatementFromStatement(stmt, node);
|
||||
if (doesStmtMatchHash(dps, hash)) {
|
||||
return dps;
|
||||
}
|
||||
}
|
||||
}
|
||||
//} catch {
|
||||
|
||||
} finally{
|
||||
stmts.close();
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
stmts.close();
|
||||
model.leaveCriticalSection();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * Get data property for subject, predicate and hash. This does not use
|
||||
// * filtering DAOs to avoid the problems when attempting to edit predicates that
|
||||
// * are filtered out.
|
||||
// *
|
||||
// * @param ind, may be null
|
||||
// * @param hash
|
||||
// * @return a DataPropertyStatement if found or null if not found
|
||||
// */
|
||||
// protected static DataPropertyStatement getStatementByHash(String subjectUri, Model model, int hash) {
|
||||
//
|
||||
//
|
||||
//
|
||||
// DataPropertyStatement dps = null;
|
||||
//
|
||||
// // Not using getAllDataPropertyStatements() because it filters out rdfs:labels
|
||||
////
|
||||
//// List<DataPropertyStatement> statements = ind.getDataPropertyStatements();
|
||||
//// if( statements == null ) return null;
|
||||
//// for( DataPropertyStatement dps : statements){
|
||||
//// if( doesStmtMatchHash(dps, hash) )
|
||||
//// return dps;
|
||||
//// }
|
||||
//// return null;
|
||||
//
|
||||
// StmtIterator stmts = model.listStatements(model.createResource(subjectUri),
|
||||
// model.getProperty(predicateUri),
|
||||
// (RDFNode)null);
|
||||
// try {
|
||||
// while (stmts.hasNext()) {
|
||||
// Statement stmt = stmts.nextStatement();
|
||||
// RDFNode node = stmt.getObject();
|
||||
// if ( node.isLiteral() ){
|
||||
// dps = makeDataPropertyStatementFromStatement(stmt, node);
|
||||
// if (doesStmtMatchHash(dps, hash)) {
|
||||
// return dps;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //} catch {
|
||||
//
|
||||
// } finally{
|
||||
// stmts.close();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get data property for subject, predicate and hash. This does not use
|
||||
* filtering DAOs to avoid the problems when attempting to edit predicates that
|
||||
* are filtered out.
|
||||
*
|
||||
* @param ind, may be null
|
||||
* @param hash
|
||||
* @return a DataPropertyStatement if found or null if not found
|
||||
*/
|
||||
// protected static DataPropertyStatement getStatementByHash(String subjectUri, String predicateUri, Model model, int hash) {
|
||||
// // Not using getAllDataPropertyStatements() because it filters out rdfs:labels
|
||||
////
|
||||
//// List<DataPropertyStatement> statements = ind.getDataPropertyStatements();
|
||||
//// if( statements == null ) return null;
|
||||
//// for( DataPropertyStatement dps : statements){
|
||||
//// if( doesStmtMatchHash(dps, hash) )
|
||||
//// return dps;
|
||||
//// }
|
||||
//// return null;
|
||||
//
|
||||
//
|
||||
// model.enterCriticalSection(false);
|
||||
// StmtIterator stmts = model.listStatements(model.createResource(subjectUri),
|
||||
// model.getProperty(predicateUri),
|
||||
// (RDFNode)null);
|
||||
// try {
|
||||
// while (stmts.hasNext()) {
|
||||
// Statement stmt = stmts.nextStatement();
|
||||
// RDFNode node = stmt.getObject();
|
||||
// if ( node.isLiteral() ){
|
||||
// DataPropertyStatement dps =
|
||||
// makeDataPropertyStatementFromStatement(stmt, node);
|
||||
// if (doesStmtMatchHash(dps, hash)) {
|
||||
// return dps;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// } finally {
|
||||
// stmts.close();
|
||||
// model.leaveCriticalSection();
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
public static int makeRdfsLabelLiteralHash( Individual subject, String value, Model model) {
|
||||
|
||||
|
|
|
@ -161,16 +161,14 @@ public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
|||
|
||||
private void setDataFormTitle() {
|
||||
String formTitle = "";
|
||||
String datapropKeyStr = editConfig.getDatapropKey();
|
||||
DataProperty prop = EditConfigurationUtils.getDataProperty(vreq);
|
||||
if(prop != null) {
|
||||
if( datapropKeyStr != null && datapropKeyStr.trim().length() > 0 ) {
|
||||
formTitle = "Change text for: <em>"+prop.getPublicName()+"</em>";
|
||||
|
||||
} else {
|
||||
formTitle ="Add new entry for: <em>"+prop.getPublicName()+"</em>";
|
||||
}
|
||||
}
|
||||
DataProperty prop = EditConfigurationUtils.getDataProperty(vreq);
|
||||
if(prop != null) {
|
||||
if( editConfig.isDataPropertyUpdate() ) {
|
||||
formTitle = "Change text for: <em>"+prop.getPublicName()+"</em>";
|
||||
} else {
|
||||
formTitle ="Add new entry for: <em>"+prop.getPublicName()+"</em>";
|
||||
}
|
||||
}
|
||||
pageData.put("formTitle", formTitle);
|
||||
}
|
||||
|
||||
|
@ -578,7 +576,10 @@ public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
|||
}
|
||||
|
||||
public String getDatapropKey() {
|
||||
return editConfig.getDatapropKey();
|
||||
if( editConfig.getDatapropKey() == null )
|
||||
return null;
|
||||
else
|
||||
return editConfig.getDatapropKey().toString();
|
||||
}
|
||||
|
||||
public DataPropertyStatement getDataPropertyStatement() {
|
||||
|
@ -592,14 +593,12 @@ public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
|||
|
||||
//Check whether deletion form should be included for default object property
|
||||
public boolean getIncludeDeletionForm() {
|
||||
if(isDeleteProhibited())
|
||||
if( isDeleteProhibited() )
|
||||
return false;
|
||||
if(isObjectProperty()) {
|
||||
return (getObjectUri() != null && !getObjectUri().isEmpty());
|
||||
}
|
||||
else {
|
||||
String datapropKey = editConfig.getDatapropKey();
|
||||
return (datapropKey != null && !datapropKey.isEmpty());
|
||||
if( isObjectProperty() ) {
|
||||
return editConfig.isObjectPropertyUpdate();
|
||||
} else {
|
||||
return editConfig.isDataPropertyUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing;
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit;
|
||||
|
||||
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
|
@ -125,95 +127,95 @@ public class RdfLiteralHashTest {
|
|||
Assert.assertTrue( ! RdfLiteralHash.doesStmtMatchHash(null, expectedHash) );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDataPropertyStmtByHash() {
|
||||
DataPropertyStatement stmtA = new DataPropertyStatementImpl();
|
||||
IndividualImpl ind = new IndividualImpl();
|
||||
List<DataPropertyStatement> stmts = new ArrayList<DataPropertyStatement>();
|
||||
// @Test
|
||||
// public void testGetDataPropertyStmtByHash() {
|
||||
// DataPropertyStatement stmtA = new DataPropertyStatementImpl();
|
||||
// IndividualImpl ind = new IndividualImpl();
|
||||
// List<DataPropertyStatement> stmts = new ArrayList<DataPropertyStatement>();
|
||||
//
|
||||
// int expectedHash = 0;
|
||||
//
|
||||
// //test to see if the same subURI, predURI and Value can be distinguished by LANG/datatype
|
||||
// stmtA.setData(TEST_VALUE);
|
||||
// stmtA.setDatapropURI(TEST_DATA_PROP_URI);
|
||||
// stmtA.setIndividualURI(TEST_INDIVIDUAL_URI);
|
||||
// stmts.add(stmtA);
|
||||
// int expectedHashForSimpleStmt = RdfLiteralHash.makeRdfLiteralHash(stmtA);
|
||||
//
|
||||
// stmtA = new DataPropertyStatementImpl();
|
||||
// stmtA.setData(TEST_VALUE );
|
||||
// stmtA.setDatapropURI(TEST_DATA_PROP_URI);
|
||||
// stmtA.setIndividualURI(TEST_INDIVIDUAL_URI);
|
||||
// stmtA.setDatatypeURI(TEST_DATA_TYPE_URI);
|
||||
// int expectedHashForDatatypeStmt = RdfLiteralHash.makeRdfLiteralHash(stmtA);
|
||||
// stmts.add(stmtA);
|
||||
//
|
||||
// stmtA = new DataPropertyStatementImpl();
|
||||
// stmtA.setData(TEST_VALUE );
|
||||
// stmtA.setDatapropURI(TEST_DATA_PROP_URI);
|
||||
// stmtA.setIndividualURI(TEST_INDIVIDUAL_URI);
|
||||
// stmtA.setLanguage(TEST_LANG);
|
||||
// int expectedHashForLangStmt = RdfLiteralHash.makeRdfLiteralHash(stmtA);
|
||||
// stmts.add(stmtA);
|
||||
//
|
||||
// ind.setDataPropertyStatements(stmts);
|
||||
//
|
||||
// DataPropertyStatement stmt = RdfLiteralHash.getDataPropertyStmtByHash(ind, expectedHashForLangStmt);
|
||||
// Assert.assertNotNull(stmt);
|
||||
// Assert.assertEquals(TEST_DATA_PROP_URI, stmt.getDatapropURI() );
|
||||
// Assert.assertEquals(TEST_INDIVIDUAL_URI, stmt.getIndividualURI() );
|
||||
// Assert.assertEquals(TEST_LANG, stmt.getLanguage() );
|
||||
// Assert.assertEquals(TEST_VALUE, stmt.getData() );
|
||||
// Assert.assertNull(stmt.getDatatypeURI());
|
||||
//
|
||||
// stmt = RdfLiteralHash.getDataPropertyStmtByHash(ind.getURI(), expectedHashForSimpleStmt);
|
||||
// Assert.assertNotNull(stmt);
|
||||
// Assert.assertEquals(TEST_DATA_PROP_URI, stmt.getDatapropURI() );
|
||||
// Assert.assertEquals(TEST_INDIVIDUAL_URI, stmt.getIndividualURI() );
|
||||
// Assert.assertEquals(TEST_VALUE, stmt.getData() );
|
||||
// Assert.assertNull(stmt.getDatatypeURI());
|
||||
// Assert.assertNull(stmt.getLanguage());
|
||||
//
|
||||
// stmt = RdfLiteralHash.getDataPropertyStmtByHash(ind, expectedHashForDatatypeStmt);
|
||||
// Assert.assertNotNull(stmt);
|
||||
// Assert.assertEquals(TEST_DATA_PROP_URI, stmt.getDatapropURI() );
|
||||
// Assert.assertEquals(TEST_INDIVIDUAL_URI, stmt.getIndividualURI() );
|
||||
// Assert.assertEquals(TEST_VALUE, stmt.getData() );
|
||||
// Assert.assertEquals(TEST_DATA_TYPE_URI, stmt.getDatatypeURI() );
|
||||
// Assert.assertNull(stmt.getLanguage());
|
||||
//
|
||||
//
|
||||
// stmt = RdfLiteralHash.getDataPropertyStmtByHash(ind, 111111);
|
||||
// Assert.assertNull(stmt);
|
||||
//
|
||||
// }
|
||||
|
||||
int expectedHash = 0;
|
||||
|
||||
//test to see if the same subURI, predURI and Value can be distinguished by LANG/datatype
|
||||
stmtA.setData(TEST_VALUE);
|
||||
stmtA.setDatapropURI(TEST_DATA_PROP_URI);
|
||||
stmtA.setIndividualURI(TEST_INDIVIDUAL_URI);
|
||||
stmts.add(stmtA);
|
||||
int expectedHashForSimpleStmt = RdfLiteralHash.makeRdfLiteralHash(stmtA);
|
||||
|
||||
stmtA = new DataPropertyStatementImpl();
|
||||
stmtA.setData(TEST_VALUE );
|
||||
stmtA.setDatapropURI(TEST_DATA_PROP_URI);
|
||||
stmtA.setIndividualURI(TEST_INDIVIDUAL_URI);
|
||||
stmtA.setDatatypeURI(TEST_DATA_TYPE_URI);
|
||||
int expectedHashForDatatypeStmt = RdfLiteralHash.makeRdfLiteralHash(stmtA);
|
||||
stmts.add(stmtA);
|
||||
|
||||
stmtA = new DataPropertyStatementImpl();
|
||||
stmtA.setData(TEST_VALUE );
|
||||
stmtA.setDatapropURI(TEST_DATA_PROP_URI);
|
||||
stmtA.setIndividualURI(TEST_INDIVIDUAL_URI);
|
||||
stmtA.setLanguage(TEST_LANG);
|
||||
int expectedHashForLangStmt = RdfLiteralHash.makeRdfLiteralHash(stmtA);
|
||||
stmts.add(stmtA);
|
||||
|
||||
ind.setDataPropertyStatements(stmts);
|
||||
|
||||
DataPropertyStatement stmt = RdfLiteralHash.getDataPropertyStmtByHash(ind, expectedHashForLangStmt);
|
||||
Assert.assertNotNull(stmt);
|
||||
Assert.assertEquals(TEST_DATA_PROP_URI, stmt.getDatapropURI() );
|
||||
Assert.assertEquals(TEST_INDIVIDUAL_URI, stmt.getIndividualURI() );
|
||||
Assert.assertEquals(TEST_LANG, stmt.getLanguage() );
|
||||
Assert.assertEquals(TEST_VALUE, stmt.getData() );
|
||||
Assert.assertNull(stmt.getDatatypeURI());
|
||||
|
||||
stmt = RdfLiteralHash.getDataPropertyStmtByHash(ind, expectedHashForSimpleStmt);
|
||||
Assert.assertNotNull(stmt);
|
||||
Assert.assertEquals(TEST_DATA_PROP_URI, stmt.getDatapropURI() );
|
||||
Assert.assertEquals(TEST_INDIVIDUAL_URI, stmt.getIndividualURI() );
|
||||
Assert.assertEquals(TEST_VALUE, stmt.getData() );
|
||||
Assert.assertNull(stmt.getDatatypeURI());
|
||||
Assert.assertNull(stmt.getLanguage());
|
||||
|
||||
stmt = RdfLiteralHash.getDataPropertyStmtByHash(ind, expectedHashForDatatypeStmt);
|
||||
Assert.assertNotNull(stmt);
|
||||
Assert.assertEquals(TEST_DATA_PROP_URI, stmt.getDatapropURI() );
|
||||
Assert.assertEquals(TEST_INDIVIDUAL_URI, stmt.getIndividualURI() );
|
||||
Assert.assertEquals(TEST_VALUE, stmt.getData() );
|
||||
Assert.assertEquals(TEST_DATA_TYPE_URI, stmt.getDatatypeURI() );
|
||||
Assert.assertNull(stmt.getLanguage());
|
||||
|
||||
|
||||
stmt = RdfLiteralHash.getDataPropertyStmtByHash(ind, 111111);
|
||||
Assert.assertNull(stmt);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRdfsLabelStatementByHash(){
|
||||
|
||||
String n3 =
|
||||
"@prefix ex: <http://example.com/> . \n" +
|
||||
"@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . \n"+
|
||||
"@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n"+
|
||||
" ex:bob rdfs:label \"Smith, Bob\"^^<"+XSD.xstring.getURI()+"> ." ;
|
||||
|
||||
Model model = (ModelFactory.createDefaultModel()).read(new StringReader(n3), "", "N3");
|
||||
|
||||
Individual bob = new IndividualImpl();
|
||||
bob.setURI("http://example.com/bob");
|
||||
|
||||
int hash = RdfLiteralHash.makeRdfsLabelLiteralHash(bob, "Smith, Bob", model);
|
||||
DataPropertyStatement stmt = RdfLiteralHash.getRdfsLabelStatementByHash(bob, model, hash);
|
||||
|
||||
String data = stmt.getData();
|
||||
String datatypeUri = stmt.getDatatypeURI();
|
||||
String predicateUri = stmt.getDatapropURI();
|
||||
String subjectUri = stmt.getIndividualURI();
|
||||
|
||||
Assert.assertEquals("Smith, Bob", data);
|
||||
Assert.assertEquals(XSD.xstring.getURI(), datatypeUri);
|
||||
Assert.assertEquals(VitroVocabulary.LABEL, predicateUri);
|
||||
Assert.assertEquals("http://example.com/bob", subjectUri);
|
||||
|
||||
}
|
||||
// @Test
|
||||
// public void testGetRdfsLabelStatementByHash(){
|
||||
//
|
||||
// String n3 =
|
||||
// "@prefix ex: <http://example.com/> . \n" +
|
||||
// "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . \n"+
|
||||
// "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n"+
|
||||
// " ex:bob rdfs:label \"Smith, Bob\"^^<"+XSD.xstring.getURI()+"> ." ;
|
||||
//
|
||||
// Model model = (ModelFactory.createDefaultModel()).read(new StringReader(n3), "", "N3");
|
||||
//
|
||||
// Individual bob = new IndividualImpl();
|
||||
// bob.setURI("http://example.com/bob");
|
||||
//
|
||||
// int hash = RdfLiteralHash.makeRdfsLabelLiteralHash(bob, "Smith, Bob", model);
|
||||
// DataPropertyStatement stmt = RdfLiteralHash.getRdfsLabelStatementByHash(bob.getURI(), model, hash);
|
||||
//
|
||||
// String data = stmt.getData();
|
||||
// String datatypeUri = stmt.getDatatypeURI();
|
||||
// String predicateUri = stmt.getDatapropURI();
|
||||
// String subjectUri = stmt.getIndividualURI();
|
||||
//
|
||||
// Assert.assertEquals("Smith, Bob", data);
|
||||
// Assert.assertEquals(XSD.xstring.getURI(), datatypeUri);
|
||||
// Assert.assertEquals(VitroVocabulary.LABEL, predicateUri);
|
||||
// Assert.assertEquals("http://example.com/bob", subjectUri);
|
||||
//
|
||||
// }
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
|
||||
|
||||
<%@page import="java.util.Map"%>
|
||||
<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.JspToGeneratorMapping"%>
|
||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
|
||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty" %>
|
||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
|
||||
|
@ -24,51 +26,7 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
|||
<vitro:confirmAuthorization />
|
||||
|
||||
<%
|
||||
HashMap<String,String> jspFormToGenerator = new HashMap<String,String>();
|
||||
HashMap<String,String> map = jspFormToGenerator;
|
||||
//vitro forms:
|
||||
map.put("autoCompleteDatapropForm.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AutoCompleteDatapropFormGenerator");
|
||||
map.put("autoCompleteObjPropForm.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AutoCompleteObjPropFormGenerator");
|
||||
map.put("datapropStmtDelete.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultDeleteGenerator");
|
||||
map.put("dateTimeIntervalForm.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DateTimeIntervalFormGenerator");
|
||||
map.put("dateTimeValueForm.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DateTimeValueFormGenerator");
|
||||
map.put("defaultAddMissingIndividualForm.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultAddMissingIndividualFormGenerator");
|
||||
map.put("defaultDatapropForm.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultDataPropertyFormGenerator");
|
||||
map.put("defaultObjPropForm.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultObjectPropertyFormGenerator");
|
||||
map.put("newIndividualForm.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.NewIndividualFormGenerator");
|
||||
map.put("propDelete.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultDeleteGenerator");
|
||||
map.put("rdfsLabelForm.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.RdfsLabelGenerator");
|
||||
|
||||
//vivo forms:
|
||||
|
||||
map.put("addAuthorsToInformationResource.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddAuthorsToInformationResourceGenerator");
|
||||
map.put("manageWebpagesForIndividual.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManageWebpagesForIndividualGenerator");
|
||||
map.put("newIndividualForm.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.NewIndividualFormGenerator");
|
||||
map.put("organizationHasPositionHistory.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.OrganizationHasPositionHistoryGenerator");
|
||||
map.put("personHasEducationalTraining.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.PersonHasEducationalTraining");
|
||||
map.put("personHasPositionHistory.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.PersonHasPositionHistoryGenerator");
|
||||
map.put("redirectToPublication.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.RedirectToPublicationGenerator");
|
||||
map.put("terminologyAnnotation.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.TerminologyAnnotationGenerator");
|
||||
map.put("unsupportedBrowserMessage.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.UnsupportedBrowserMessage");
|
||||
map.put("addGrantRoleToPerson.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddGrantRoleToPersonGenerator");
|
||||
map.put("addEditWebpageForm.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddEditWebpageFormGenerator");
|
||||
|
||||
//vivo 2 stage role forms:
|
||||
|
||||
map.put("addAttendeeRoleToPerson.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddAttendeeRoleToPersonGenerator");
|
||||
map.put("addClinicalRoleToPerson.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddClinicalRoleToPersonGenerator");
|
||||
map.put("addEditorRoleToPerson.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddEditorRoleToPersonGenerator");
|
||||
map.put("addHeadOfRoleToPerson.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddHeadOfRoleToPersonGenerator");
|
||||
map.put("addMemberRoleToPerson.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddMemberRoleToPersonGenerator");
|
||||
map.put("addOrganizerRoleToPerson.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddOrganizerRoleToPersonGenerator");
|
||||
map.put("addOutreachRoleToPerson.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddOutreachRoleToPersonGenerator");
|
||||
map.put("addPresenterRoleToPerson.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddPresenterRoleToPersonGenerator");
|
||||
map.put("addPublicationToPerson.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddPublicationToPersonGenerator");
|
||||
map.put("addResearcherRoleToPerson.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddResearcherRoleToPersonGenerator");
|
||||
map.put("addReviewerRoleToPerson.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddReviewerRoleToPersonGenerator");
|
||||
map.put("addRoleToPersonTwoStage.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddRoleToPersonTwoStageGenerator");
|
||||
map.put("addServiceProviderRoleToPerson.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddServiceProviderRoleToPersonGenerator");
|
||||
map.put("addTeacherRoleToPerson.jsp", "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddTeacherRoleToPersonGenerator");
|
||||
Map<String,String> jspFormToGenerator = JspToGeneratorMapping.jspsToGenerators;
|
||||
|
||||
//Check if special model, in which case forward
|
||||
if(request.getParameter("switchToDisplayModel") != null) {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</#if>
|
||||
|
||||
|
||||
<textarea rows="2" id="${editConfiguration.dataLiteral}" name="${editConfiguration.dataLiteral}" value="${literalValues}" class="useTinyMce" role="textarea">${literalValues}</textarea>
|
||||
<textarea rows="2" id="literal" name="literal" value="${literalValues}" class="useTinyMce" role="textarea">${literalValues}</textarea>
|
||||
|
||||
<br />
|
||||
<#--The submit label should be set within the template itself, right now
|
||||
|
|
Loading…
Add table
Reference in a new issue