Adding null check to dump.ftl. Moving common vars to method in BrowseWidget NIHVIVO-1674
This commit is contained in:
parent
f40a33062b
commit
9e273a9df6
2 changed files with 14 additions and 28 deletions
|
@ -84,7 +84,6 @@ public class BrowseWidget extends Widget {
|
|||
map.put("class", new VClassTemplateModel(vclass));
|
||||
|
||||
JSONObject vclassRes = JSONServlet.getLuceneIndividualsByVClass(vclass.getURI(), request, context);
|
||||
map.put("vclass", JSONtoFmModel.convertJSONObjectToMap( (JSONObject) vclassRes.get("vclass") ));
|
||||
map.put("totalCount", JSONtoFmModel.convertJSONObjectToMap( (String) vclassRes.get("totalCount") ));
|
||||
map.put("alpha", JSONtoFmModel.convertJSONObjectToMap( (String) vclassRes.get("alpha") ));
|
||||
map.put("individuals", JSONtoFmModel.convertJSONArrayToList( (JSONArray) vclassRes.get("individuals") ));
|
||||
|
@ -97,7 +96,13 @@ public class BrowseWidget extends Widget {
|
|||
private Map<String,Object> getCommonValues(Environment env, ServletContext context){
|
||||
Map<String,Object> values = new HashMap<String,Object>();
|
||||
values.putAll(FreemarkerHttpServlet.getDirectives());
|
||||
|
||||
try {
|
||||
values.put("urls",env.getDataModel().get("urls"));
|
||||
values.put("currentPage", env.getDataModel().get("currentPage"));
|
||||
} catch (TemplateModelException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
|
@ -107,13 +112,6 @@ public class BrowseWidget extends Widget {
|
|||
body.putAll(getCommonValues(env,context));
|
||||
body.putAll(getAllClassGroupData(request, params, context));
|
||||
|
||||
try {
|
||||
body.put("urls",env.getDataModel().get("urls"));
|
||||
body.put("currentPage", env.getDataModel().get("currentPage"));
|
||||
} catch (TemplateModelException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
String macroName = Mode.ALL_CLASS_GROUPS.macroName;
|
||||
return new WidgetTemplateValues(macroName, body);
|
||||
}
|
||||
|
@ -146,13 +144,6 @@ public class BrowseWidget extends Widget {
|
|||
body.putAll(getCommonValues(env,context));
|
||||
body.putAll(getClassData(request,params,context));
|
||||
|
||||
try {
|
||||
body.put("urls",env.getDataModel().get("urls"));
|
||||
body.put("currentPage", env.getDataModel().get("currentPage"));
|
||||
} catch (TemplateModelException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
String macroName = Mode.VCLASS.macroName;
|
||||
return new WidgetTemplateValues(macroName, body);
|
||||
}
|
||||
|
@ -185,13 +176,6 @@ public class BrowseWidget extends Widget {
|
|||
body.putAll(getCommonValues(env,context));
|
||||
body.putAll( getClassGroupData(request,params, context));
|
||||
|
||||
try {
|
||||
body.put("urls",env.getDataModel().get("urls"));
|
||||
body.put("currentPage", env.getDataModel().get("currentPage"));
|
||||
} catch (TemplateModelException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
String macroName = Mode.CLASS_GROUP.macroName;
|
||||
return new WidgetTemplateValues(macroName, body);
|
||||
}
|
||||
|
|
|
@ -8,4 +8,6 @@
|
|||
${var}
|
||||
</div>
|
||||
|
||||
<#if stylesheets??>
|
||||
${stylesheets.add("/css/dump.css")}
|
||||
</#if>
|
||||
|
|
Loading…
Add table
Reference in a new issue