diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/admin/ShowConfiguration.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/admin/ShowConfiguration.java new file mode 100644 index 000000000..7a8a2322c --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/admin/ShowConfiguration.java @@ -0,0 +1,50 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.controller.admin; + +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.SortedMap; +import java.util.TreeMap; + +import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions; +import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties; +import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; + +/** + * Show the current ConfigurationProperties and the Java system properties. + */ +public class ShowConfiguration extends FreemarkerHttpServlet { + @Override + protected Actions requiredActions(VitroRequest vreq) { + return Actions.AUTHORIZED; + } + + @Override + protected ResponseValues processRequest(VitroRequest vreq) { + Map body = new HashMap(); + body.put("configurationProperties", getConfigurationProperties(vreq)); + body.put("javaSystemProperties", getSystemProperties()); + return new TemplateResponseValues("admin-showConfiguration.ftl", body); + } + + private SortedMap getConfigurationProperties( + VitroRequest vreq) { + return new TreeMap<>(ConfigurationProperties.getBean(vreq) + .getPropertyMap()); + } + + private SortedMap getSystemProperties() { + Properties props = System.getProperties(); + SortedMap map = new TreeMap<>(); + for (String key : props.stringPropertyNames()) { + map.put(key, props.getProperty(key)); + } + return map; + } + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/GroupedPropertyList.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/GroupedPropertyList.java index 8235202a6..866ea5404 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/GroupedPropertyList.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/GroupedPropertyList.java @@ -20,6 +20,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty; import edu.cornell.mannlib.vitro.webapp.beans.Property; import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup; import edu.cornell.mannlib.vitro.webapp.beans.PropertyInstance; +import edu.cornell.mannlib.vitro.webapp.beans.VClass; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao; import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao; @@ -292,6 +293,14 @@ public class GroupedPropertyList extends BaseTemplateModel { } else if (op.getRangeVClassURI() == null) { return (piOp.getRangeVClassURI() != null); } else { + //Check and see if the range vclass exists for the possible piOp and populated op properties, + //because for populated properties, if the range class is a union, + //blank nodes will be broken and the code should instead use the existing or piOp range class uri + VClass piOpRangeClass = wadf.getVClassDao().getVClassByURI(piOp.getRangeVClassURI()); + VClass opRangeClass = wadf.getVClassDao().getVClassByURI(op.getRangeVClassURI()); + //if the possible range class exists but the populated one does not, then return true to allow the possible + //class to be utilized + if(piOpRangeClass != null && opRangeClass == null) return true; return (wadf.getVClassDao().isSubClassOf( piOp.getRangeVClassURI(), op.getRangeVClassURI())); } diff --git a/webapp/web/WEB-INF/web.xml b/webapp/web/WEB-INF/web.xml index 1d393a7b9..08612be19 100644 --- a/webapp/web/WEB-INF/web.xml +++ b/webapp/web/WEB-INF/web.xml @@ -660,6 +660,15 @@ /admin/showAuth + + ShowConfiguration + edu.cornell.mannlib.vitro.webapp.controller.admin.ShowConfiguration + + + ShowConfiguration + /admin/showConfiguration + + StartupStatus edu.cornell.mannlib.vitro.webapp.controller.admin.StartupStatusController diff --git a/webapp/web/templates/freemarker/body/admin/admin-showConfiguration.ftl b/webapp/web/templates/freemarker/body/admin/admin-showConfiguration.ftl new file mode 100644 index 000000000..f77e0d518 --- /dev/null +++ b/webapp/web/templates/freemarker/body/admin/admin-showConfiguration.ftl @@ -0,0 +1,28 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- Template viewing the authorization mechanisms: current identifiers, factories, policies, etc. --> + +${stylesheets.add('')} + +

Configuration settings

+ +
+

Build and runtime properties:

+ + <#list configurationProperties?keys as key> + + + + + +
${key}${configurationProperties[key]}
+

Java system properties:

+ + <#list javaSystemProperties?keys as key> + + + + + +
${key}${javaSystemProperties[key]}
+
diff --git a/webapp/web/templates/freemarker/page/partials/developerPanel.ftl b/webapp/web/templates/freemarker/page/partials/developerPanel.ftl index 82b2a0c80..a9437a3d8 100644 --- a/webapp/web/templates/freemarker/page/partials/developerPanel.ftl +++ b/webapp/web/templates/freemarker/page/partials/developerPanel.ftl @@ -56,6 +56,8 @@ Links
Set log levels + Show Configuration +
Show authorization info Show background threads