From 49510f2a4a92477eb76b1926c0ee634c97fdbe98 Mon Sep 17 00:00:00 2001 From: ryounes Date: Tue, 22 Mar 2011 20:22:18 +0000 Subject: [PATCH] NIHVIVO-2186 Finalize changes to custom list view queries for hiding incomplete statements from non-logged-in user --- .../individual/ObjectPropertyTemplateModel.java | 13 +++++++------ webapp/web/config/listViewConfig-default.xml | 4 ++-- webapp/web/config/listViewConfig-vitroLink.xml | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel.java index 844eafcd3..0e0ca2f8c 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel.java @@ -327,7 +327,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel private static final String NODE_NAME_TEMPLATE = "template"; private static final String NODE_NAME_POSTPROCESSOR = "postprocessor"; private static final String NODE_NAME_COLLATED = "collated"; - private static final String NODE_NAME_LINKED_INDIVIDUAL_REQUIRED = "linked-individual-required"; + private static final String NODE_NAME_CRITICAL_DATA_REQUIRED = "critical-data-required"; /* NB The default post-processor is not the same as the post-processor for the default view. The latter * actually defines its own post-processor, whereas the default post-processor is used for custom views @@ -466,13 +466,14 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel String value = null; if (selectQueryNode != null) { boolean collated = ObjectPropertyTemplateModel.this instanceof CollatedObjectPropertyTemplateModel; - /* If not editing the page (policyHelper == null), hide statements with missing linked individual; otherwise, show these - * statements. We might want to refine this based on whether the user can edit the statement in question, but that + /* If not editing the page (policyHelper == null), hide statements with missing linked individual or other + * critical information missing (e.g., anchor and url on a link); otherwise, show these statements. + * We might want to refine this based on whether the user can edit the statement in question, but that * would require a completely different approach: include the statement in the query results, and then during the * postprocessing phase, check the editing policy, and remove the statement if it's not editable. We would not * preprocess the query, as here. */ - boolean linkedIndividualRequired = policyHelper == null; + boolean criticalDataRequired = policyHelper == null; NodeList children = selectQueryNode.getChildNodes(); int childCount = children.getLength(); value = ""; @@ -482,8 +483,8 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel if (collated) { value += node.getChildNodes().item(0).getNodeValue(); } // else ignore this node - } else if (node.getNodeName().equals(NODE_NAME_LINKED_INDIVIDUAL_REQUIRED)) { - if (linkedIndividualRequired) { + } else if (node.getNodeName().equals(NODE_NAME_CRITICAL_DATA_REQUIRED)) { + if (criticalDataRequired) { value += node.getChildNodes().item(0).getNodeValue(); } // else ignore this node } else { diff --git a/webapp/web/config/listViewConfig-default.xml b/webapp/web/config/listViewConfig-default.xml index 54c85d2f4..38247be41 100644 --- a/webapp/web/config/listViewConfig-default.xml +++ b/webapp/web/config/listViewConfig-default.xml @@ -20,9 +20,9 @@ OPTIONAL { ?object rdfs:label ?name } OPTIONAL { ?object vitro:moniker ?moniker } - + FILTER ( bound(?name) ) - + } ORDER BY ?subclass ?name ?object diff --git a/webapp/web/config/listViewConfig-vitroLink.xml b/webapp/web/config/listViewConfig-vitroLink.xml index 058483b5d..ee53b7501 100644 --- a/webapp/web/config/listViewConfig-vitroLink.xml +++ b/webapp/web/config/listViewConfig-vitroLink.xml @@ -18,9 +18,9 @@ OPTIONAL { ?link vitro:linkAnchor ?anchor } OPTIONAL { ?link vitro:linkURL ?url } OPTIONAL { ?link vitro:linkDisplayRank ?rank } - + FILTER ( bound(?anchor) && bound(?url) ) - + } ORDER BY ?rank