NIHVIVO-650 Reworked Freemarker sparkline implementation for better controller/view separation
This commit is contained in:
parent
61956f4cf5
commit
3300b7cda7
1 changed files with 9 additions and 18 deletions
|
@ -125,8 +125,7 @@ public class IndividualController extends FreemarkerHttpServlet {
|
||||||
int securityLevel = getSecurityLevel(session);
|
int securityLevel = getSecurityLevel(session);
|
||||||
UrlBuilder urlBuilder = new UrlBuilder(vreq.getPortal());
|
UrlBuilder urlBuilder = new UrlBuilder(vreq.getPortal());
|
||||||
body.put("editStatus", getEditingData(vreq, securityLevel, individual, urlBuilder));
|
body.put("editStatus", getEditingData(vreq, securityLevel, individual, urlBuilder));
|
||||||
body.put("visualization", getVisualizationData(vreq, individual));
|
body.putAll(getIndividualData(vreq, individual));
|
||||||
body.putAll(getIndividualData( vreq, individual));
|
|
||||||
body.put("title", individual.getName());
|
body.put("title", individual.getName());
|
||||||
|
|
||||||
String bodyTemplate = "individual.ftl";
|
String bodyTemplate = "individual.ftl";
|
||||||
|
@ -179,22 +178,6 @@ public class IndividualController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getVisualizationData(VitroRequest vreq, Individual individual) {
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
|
||||||
|
|
||||||
// RY We should not have references to a specific ontology in the vitro code!
|
|
||||||
if (individual.isVClass("http://xmlns.com/foaf/0.1/Person")) {
|
|
||||||
|
|
||||||
String visualizationUrl = UrlBuilder.getUrl("/visualization",
|
|
||||||
"render_mode", "dynamic",
|
|
||||||
"vis", "person_pub_count",
|
|
||||||
"vis_mode", "short",
|
|
||||||
"uri", individual.getURI());
|
|
||||||
map.put("url", visualizationUrl);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, Object> getIndividualData(VitroRequest vreq, Individual individual) throws ServletException, IOException {
|
private Map<String, Object> getIndividualData(VitroRequest vreq, Individual individual) throws ServletException, IOException {
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
@ -271,6 +254,14 @@ public class IndividualController extends FreemarkerHttpServlet {
|
||||||
//data.put("netid", netid);
|
//data.put("netid", netid);
|
||||||
//data.put("vclassName", vclassName);
|
//data.put("vclassName", vclassName);
|
||||||
|
|
||||||
|
// RY We should not have references to a specific ontology in the vitro code!
|
||||||
|
boolean isPerson = individual.isVClass("http://xmlns.com/foaf/0.1/Person");
|
||||||
|
map.put("isPerson", isPerson);
|
||||||
|
if (isPerson) {
|
||||||
|
map.put("visualizationUrl", UrlBuilder.getUrl("/visualization",
|
||||||
|
"uri", individual.getURI()));
|
||||||
|
}
|
||||||
|
|
||||||
// RY Would like to use IndividualTemplateModel object, but may just end up copying all methods. Since object is put in template
|
// RY Would like to use IndividualTemplateModel object, but may just end up copying all methods. Since object is put in template
|
||||||
// with a read-only wrapper, it should be restrictive enough.
|
// with a read-only wrapper, it should be restrictive enough.
|
||||||
map.put("individual",individual); //data.put("individual", new IndividualTemplateModel(indiv));
|
map.put("individual",individual); //data.put("individual", new IndividualTemplateModel(indiv));
|
||||||
|
|
Loading…
Add table
Reference in a new issue