NIHVIVO-1853 Display statement in object property deletion form
This commit is contained in:
parent
6ffe9daa64
commit
d671cc9716
8 changed files with 69 additions and 63 deletions
|
@ -34,6 +34,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Tem
|
|||
import edu.cornell.mannlib.vitro.webapp.utils.StringUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.BreadCrumbsUtil;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.PortalWebUtil;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.functions.IndividualLocalNameMethod;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.User;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.files.Scripts;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.files.Stylesheets;
|
||||
|
@ -311,7 +312,6 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
|||
* Add any Java directives the templates should have access to.
|
||||
* This is public and static so that these may be used by other classes during
|
||||
* the transition from JSP to Freemarker.
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, Object> getDirectives() {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
@ -324,9 +324,10 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
|||
return map;
|
||||
}
|
||||
|
||||
protected Map<String, Object> getMethods() {
|
||||
public static Map<String, Object> getMethods() {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("profileUrl", new edu.cornell.mannlib.vitro.webapp.web.functions.IndividualProfileUrlMethod());
|
||||
map.put("localName", new edu.cornell.mannlib.vitro.webapp.web.functions.IndividualLocalNameMethod());
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
|
@ -130,8 +130,7 @@ public class IndividualController extends FreemarkerHttpServlet {
|
|||
* into the data model: no real data can be modified.
|
||||
*/
|
||||
body.put("individual", getNonDefaultBeansWrapper(BeansWrapper.EXPOSE_SAFE).wrap(itm));
|
||||
body.put("headContent", getRdfLinkTag(itm));
|
||||
body.put("localName", new IndividualLocalNameMethod());
|
||||
body.put("headContent", getRdfLinkTag(itm));
|
||||
|
||||
String template = getIndividualTemplate(individual, vreq);
|
||||
|
||||
|
|
|
@ -26,16 +26,14 @@ public class TemplateProcessingHelper {
|
|||
private Configuration config = null;
|
||||
private HttpServletRequest request = null;
|
||||
private ServletContext context = null;
|
||||
//private Map<String, Object> templateDataModel = null;
|
||||
|
||||
TemplateProcessingHelper(Configuration config, HttpServletRequest request, ServletContext context) {
|
||||
public TemplateProcessingHelper(Configuration config, HttpServletRequest request, ServletContext context) {
|
||||
this.config = config;
|
||||
this.request = request;
|
||||
this.context = context;
|
||||
//this.templateDataModel = new HashMap<String, Object>();
|
||||
}
|
||||
|
||||
protected StringWriter processTemplate(String templateName, Map<String, Object> map) {
|
||||
public StringWriter processTemplate(String templateName, Map<String, Object> map) {
|
||||
Template template = getTemplate(templateName);
|
||||
StringWriter sw = new StringWriter();
|
||||
processTemplate(template, map, sw);
|
||||
|
@ -65,8 +63,9 @@ public class TemplateProcessingHelper {
|
|||
}
|
||||
}
|
||||
|
||||
// In fact, we can put StringWriter objects directly into the data model, so perhaps we should eliminate the processTemplateToString() methods.
|
||||
protected String processTemplateToString(String templateName, Map<String, Object> map) {
|
||||
// For cases where we need a String instead of a StringWriter. StringWriter objects can be put in the template data model,
|
||||
// but we can use this method from a jsp, for example.
|
||||
public String processTemplateToString(String templateName, Map<String, Object> map) {
|
||||
return processTemplate(templateName, map).toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ public class CollatedObjectPropertyTemplateModel extends ObjectPropertyTemplateM
|
|||
subclassMap.put(subclassName, currentList);
|
||||
}
|
||||
currentList.add(new ObjectPropertyStatementTemplateModel(subjectUri,
|
||||
propertyUri, objectKey, map, policyHelper));
|
||||
propertyUri, objectKey, map, policyHelper, getTemplateName()));
|
||||
}
|
||||
return subclassMap;
|
||||
}
|
||||
|
|
|
@ -28,13 +28,16 @@ public class ObjectPropertyStatementTemplateModel extends PropertyStatementTempl
|
|||
|
||||
// Used for editing
|
||||
private String objectUri = null;
|
||||
private String templateName = null;
|
||||
|
||||
ObjectPropertyStatementTemplateModel(String subjectUri, String propertyUri,
|
||||
String objectKey, Map<String, String> data, EditingPolicyHelper policyHelper) {
|
||||
ObjectPropertyStatementTemplateModel(String subjectUri, String propertyUri, String objectKey,
|
||||
Map<String, String> data, EditingPolicyHelper policyHelper, String templateName) {
|
||||
super(subjectUri, propertyUri, policyHelper);
|
||||
|
||||
this.data = data;
|
||||
objectUri = data.get(objectKey);
|
||||
this.objectUri = data.get(objectKey);
|
||||
this.templateName = templateName;
|
||||
|
||||
setEditAccess(policyHelper);
|
||||
}
|
||||
|
||||
|
@ -107,6 +110,11 @@ public class ObjectPropertyStatementTemplateModel extends PropertyStatementTempl
|
|||
"predicateUri", propertyUri,
|
||||
"objectUri", objectUri,
|
||||
"cmd", "delete");
|
||||
for ( String key : data.keySet() ) {
|
||||
params.put("statement_" + key, data.get(key));
|
||||
}
|
||||
params.put("templateName", templateName);
|
||||
|
||||
deleteUrl = UrlBuilder.getUrl(EDIT_PATH, params);
|
||||
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
|
|||
Pattern.compile("ORDER\\s+BY\\s+((DESC\\()?\\?subclass\\)?\\s+)?DESC\\s*\\(\\s*\\?" +
|
||||
END_DATE_TIME_VARIABLE + "\\)", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
private static String KEY_SUBJECT = "subject";
|
||||
private static final String KEY_SUBJECT = "subject";
|
||||
private static final String KEY_PROPERTY = "property";
|
||||
private static final String DEFAULT_LIST_VIEW_QUERY_OBJECT_VARIABLE_NAME = "object";
|
||||
private static final Pattern SUBJECT_PROPERTY_OBJECT_PATTERN =
|
||||
|
@ -85,12 +85,13 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
|
|||
}
|
||||
|
||||
private PropertyListConfig config;
|
||||
private String objectKey;
|
||||
private String objectKey;
|
||||
|
||||
// Used for editing
|
||||
private boolean addAccess = false;
|
||||
|
||||
ObjectPropertyTemplateModel(ObjectProperty op, Individual subject, VitroRequest vreq, EditingPolicyHelper policyHelper)
|
||||
ObjectPropertyTemplateModel(ObjectProperty op, Individual subject, VitroRequest vreq,
|
||||
EditingPolicyHelper policyHelper)
|
||||
throws InvalidConfigurationException {
|
||||
|
||||
super(op, subject, policyHelper);
|
||||
|
@ -133,6 +134,10 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
|
|||
protected Set<String> getConstructQueries() {
|
||||
return config.constructQueries;
|
||||
}
|
||||
|
||||
protected String getTemplateName() {
|
||||
return config.templateName;
|
||||
}
|
||||
|
||||
protected boolean hasDefaultListView() {
|
||||
return config.isDefaultConfig;
|
||||
|
|
|
@ -46,7 +46,7 @@ public class UncollatedObjectPropertyTemplateModel extends ObjectPropertyTemplat
|
|||
String objectKey = getObjectKey();
|
||||
for (Map<String, String> map : statementData) {
|
||||
statements.add(new ObjectPropertyStatementTemplateModel(subjectUri,
|
||||
propertyUri, objectKey, map, policyHelper));
|
||||
propertyUri, objectKey, map, policyHelper, getTemplateName()));
|
||||
}
|
||||
|
||||
postprocessStatementList(statements);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue