updates for not having entire edit template within read only wrapper as that was causing errors but only the object property information
This commit is contained in:
parent
fa92f36b52
commit
c833f5d76c
2 changed files with 18 additions and 33 deletions
|
@ -106,9 +106,7 @@ public class EditRequestDispatchController extends FreemarkerHttpServlet {
|
||||||
//what goes in the map for templates?
|
//what goes in the map for templates?
|
||||||
Map<String,Object> templateData = new HashMap<String,Object>();
|
Map<String,Object> templateData = new HashMap<String,Object>();
|
||||||
EditConfigurationTemplateModel etm = new EditConfigurationTemplateModel( editConfig, vreq);
|
EditConfigurationTemplateModel etm = new EditConfigurationTemplateModel( editConfig, vreq);
|
||||||
//Similar to individual controller, we're exposing getters that require paramters as well here -
|
templateData.put("editConfiguration", etm);
|
||||||
//Used specifically since we are including object property statement template model
|
|
||||||
templateData.put("editConfiguration", wrap(etm, new ReadOnlyBeansWrapper()));
|
|
||||||
templateData.put("editSubmission", submissionTemplateModel);
|
templateData.put("editSubmission", submissionTemplateModel);
|
||||||
//Corresponding to original note for consistency with selenium tests and 1.1.1
|
//Corresponding to original note for consistency with selenium tests and 1.1.1
|
||||||
templateData.put("title", "Edit");
|
templateData.put("title", "Edit");
|
||||||
|
|
|
@ -35,11 +35,16 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTw
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditElementVTwo;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditElementVTwo;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.web.beanswrappers.ReadOnlyBeansWrapper;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.BaseTemplateModel;
|
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.BaseTemplateModel;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.DataPropertyStatementTemplateModel;
|
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.DataPropertyStatementTemplateModel;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.EditingPolicyHelper;
|
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.EditingPolicyHelper;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ObjectPropertyStatementTemplateModel;
|
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ObjectPropertyStatementTemplateModel;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.PropertyStatementTemplateModel;
|
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.PropertyStatementTemplateModel;
|
||||||
|
import freemarker.ext.beans.BeansWrapper;
|
||||||
|
import freemarker.template.DefaultObjectWrapper;
|
||||||
|
import freemarker.template.TemplateModel;
|
||||||
|
import freemarker.template.TemplateModelException;
|
||||||
|
|
||||||
public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
||||||
EditConfigurationVTwo editConfig;
|
EditConfigurationVTwo editConfig;
|
||||||
|
@ -89,21 +94,6 @@ public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
||||||
//Based on certain pre-set fields/variables, look for what
|
//Based on certain pre-set fields/variables, look for what
|
||||||
//drop-downs need to be populated
|
//drop-downs need to be populated
|
||||||
private void populateDropdowns() {
|
private void populateDropdowns() {
|
||||||
|
|
||||||
// String predicateUri = editConfig.getPredicateUri();
|
|
||||||
// if(predicateUri != null) {
|
|
||||||
// if(EditConfigurationUtils.isObjectProperty(editConfig.getPredicateUri(), vreq)) {
|
|
||||||
// setRangeOptions();
|
|
||||||
// }
|
|
||||||
// if(pageData.containsKey("objectSelect")) {
|
|
||||||
// List<String> fieldNames = (List<String>)pageData.get("objectSelect");
|
|
||||||
// for(String field:fieldNames) {
|
|
||||||
// WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
|
||||||
// Map<String,String> optionsMap = SelectListGeneratorVTwo.getOptions(editConfig, field , wdf);
|
|
||||||
// pageData.put(field, optionsMap);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//For each field with an optionType defined, create the options
|
//For each field with an optionType defined, create the options
|
||||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
||||||
|
@ -120,18 +110,6 @@ public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
||||||
}
|
}
|
||||||
pageData.put(fieldName, SelectListGeneratorVTwo.getOptions(editConfig, fieldName, wdf));
|
pageData.put(fieldName, SelectListGeneratorVTwo.getOptions(editConfig, fieldName, wdf));
|
||||||
}
|
}
|
||||||
|
|
||||||
// String predicateUri = editConfig.getPredicateUri();
|
|
||||||
// if(predicateUri != null) {
|
|
||||||
// if(pageData.containsKey("objectSelect")) {
|
|
||||||
// List<String> fieldNames = (List<String>)pageData.get("objectSelect");
|
|
||||||
// for(String field:fieldNames) {
|
|
||||||
// WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
|
||||||
// Map<String,String> optionsMap = SelectListGeneratorVTwo.getOptions(editConfig, field , wdf);
|
|
||||||
// pageData.put(field, optionsMap);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Check if this should return a list instead
|
//TODO: Check if this should return a list instead
|
||||||
|
@ -254,10 +232,11 @@ public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
||||||
return (String) pageData.get("submitLabel");
|
return (String) pageData.get("submitLabel");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public Map<String, String> getRangeOptions() {
|
public Map<String, String> getRangeOptions() {
|
||||||
Map<String, String> rangeOptions = (Map<String, String>) pageData.get("rangeOptions");
|
Map<String, String> rangeOptions = (Map<String, String>) pageData.get("rangeOptions");
|
||||||
return rangeOptions;
|
return rangeOptions;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
//Get literals in scope, i.e. variable names with values assigned
|
//Get literals in scope, i.e. variable names with values assigned
|
||||||
public Map<String, List<Literal>> getLiteralValues() {
|
public Map<String, List<Literal>> getLiteralValues() {
|
||||||
|
@ -424,7 +403,7 @@ public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Implement statement display
|
//TODO: Implement statement display
|
||||||
public ObjectPropertyStatementTemplateModel getObjectStatementDisplay() {
|
public TemplateModel getObjectStatementDisplay() throws TemplateModelException {
|
||||||
Map<String, String> statementDisplay = new HashMap<String, String>();
|
Map<String, String> statementDisplay = new HashMap<String, String>();
|
||||||
String subjectUri = EditConfigurationUtils.getSubjectUri(vreq);
|
String subjectUri = EditConfigurationUtils.getSubjectUri(vreq);
|
||||||
String predicateUri = EditConfigurationUtils.getPredicateUri(vreq);
|
String predicateUri = EditConfigurationUtils.getPredicateUri(vreq);
|
||||||
|
@ -450,7 +429,15 @@ public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
||||||
objectKey,
|
objectKey,
|
||||||
statementDisplay,
|
statementDisplay,
|
||||||
null, null, vreq);
|
null, null, vreq);
|
||||||
return osm;
|
ReadOnlyBeansWrapper wrapper = new ReadOnlyBeansWrapper();
|
||||||
|
return wrapper.wrap(osm);
|
||||||
|
/* TemplateModel tm = null;
|
||||||
|
try {
|
||||||
|
tm = wrapper.wrap(osm);
|
||||||
|
} catch(Exception ex) {
|
||||||
|
log.error("Error occurred in wrapping object property statement model", ex);
|
||||||
|
}
|
||||||
|
return tm;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDataStatementDisplay() {
|
public String getDataStatementDisplay() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue