NIHVIVO-2886, NIHVIVO-2940 Refactoring for clarity of admin link generation
This commit is contained in:
parent
64f930f053
commit
7c51af4a38
1 changed files with 87 additions and 88 deletions
|
@ -55,33 +55,24 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
|||
|
||||
@Override
|
||||
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
|
||||
if (PolicyHelper.isAuthorizedForActions(vreq, new EditIndividuals())) {
|
||||
body.put("dataInput", getDataInputData(vreq));
|
||||
}
|
||||
|
||||
body.put("siteConfig", getSiteConfigUrls(vreq));
|
||||
|
||||
if (PolicyHelper.isAuthorizedForActions(vreq, new UseMiscellaneousAdminPages())) {
|
||||
body.put("indexCacheRebuild", getIndexCacheRebuildUrls(vreq));
|
||||
}
|
||||
|
||||
if (PolicyHelper.isAuthorizedForActions(vreq, new EditOntology())) {
|
||||
body.put("ontologyEditor", getOntologyEditorData(vreq));
|
||||
}
|
||||
|
||||
if (PolicyHelper.isAuthorizedForActions(vreq, new UseAdvancedDataToolsPages())) {
|
||||
body.put("dataTools", getDataToolsUrls(vreq));
|
||||
}
|
||||
|
||||
return new TemplateResponseValues(TEMPLATE_DEFAULT, body);
|
||||
|
||||
}
|
||||
|
||||
private Map<String, String> getIndexCacheRebuildUrls(VitroRequest vreq) {
|
||||
|
||||
Map<String, String> urls = new HashMap<String, String>();
|
||||
|
||||
if (PolicyHelper.isAuthorizedForActions(vreq, new UseMiscellaneousAdminPages())) {
|
||||
|
||||
urls.put("recomputeInferences", UrlBuilder.getUrl("/RecomputeInferences"));
|
||||
|
||||
urls.put("rebuildClassGroupCache", UrlBuilder.getUrl("/browse?clearcache=1"));
|
||||
|
@ -90,17 +81,19 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
|||
urls.put("rebuildSearchIndex", UrlBuilder.getUrl("/SearchIndex"));
|
||||
}
|
||||
|
||||
|
||||
if (PolicyHelper.isAuthorizedForActions(vreq, new RefreshVisualizationCacheAction())) {
|
||||
urls.put("rebuildVisCache", UrlBuilder.getUrl("/vis/tools"));
|
||||
}
|
||||
|
||||
}
|
||||
return urls;
|
||||
}
|
||||
|
||||
private Map<String, Object> getDataInputData(VitroRequest vreq) {
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
if (PolicyHelper.isAuthorizedForActions(vreq, new EditIndividuals())) {
|
||||
|
||||
map.put("formAction", UrlBuilder.getUrl("/edit/editRequestDispatch.jsp"));
|
||||
|
||||
WebappDaoFactory wadf = vreq.getFullWebappDaoFactory();
|
||||
|
@ -108,7 +101,6 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
|||
// Create map for data input entry form options list
|
||||
List classGroups = wadf.getVClassGroupDao().getPublicGroupsWithVClasses(true,true,false); // order by displayRank, include uninstantiated classes, don't get the counts of individuals
|
||||
|
||||
|
||||
Set<String> seenGroupNames = new HashSet<String>();
|
||||
|
||||
Iterator classGroupIt = classGroups.iterator();
|
||||
|
@ -129,6 +121,7 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
|||
}
|
||||
|
||||
map.put("groupedClassOptions", orderedClassGroups);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
@ -161,6 +154,8 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
|||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
if (PolicyHelper.isAuthorizedForActions(vreq, new EditOntology())) {
|
||||
|
||||
String pelletError = null;
|
||||
String pelletExplanation = null;
|
||||
Object plObj = getServletContext().getAttribute("pelletListener");
|
||||
|
@ -192,6 +187,7 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
|||
urls.put("propertyGroups", UrlBuilder.getUrl("/listPropertyGroups"));
|
||||
urls.put("objectPropertyHierarchy", UrlBuilder.getUrl("/showObjectPropertyHierarchy", new ParamMap("iffRoot", "true")));
|
||||
map.put("urls", urls);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
@ -199,11 +195,14 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
|||
private Map<String, String> getDataToolsUrls(VitroRequest vreq) {
|
||||
|
||||
Map<String, String> urls = new HashMap<String, String>();
|
||||
|
||||
if (PolicyHelper.isAuthorizedForActions(vreq, new UseAdvancedDataToolsPages())) {
|
||||
urls.put("ingest", UrlBuilder.getUrl("/ingest"));
|
||||
urls.put("rdfData", UrlBuilder.getUrl("/uploadRDFForm"));
|
||||
urls.put("rdfExport", UrlBuilder.getUrl("/export"));
|
||||
urls.put("sparqlQuery", UrlBuilder.getUrl("/admin/sparqlquery"));
|
||||
urls.put("sparqlQueryBuilder", UrlBuilder.getUrl("/admin/sparqlquerybuilder"));
|
||||
}
|
||||
|
||||
return urls;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue