NIHVIVO-2186 Finalize changes to custom list view queries for hiding incomplete statements from non-logged-in user
This commit is contained in:
parent
f8726be1d1
commit
49510f2a4a
3 changed files with 11 additions and 10 deletions
|
@ -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 {
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
</collated>
|
||||
OPTIONAL { ?object rdfs:label ?name }
|
||||
OPTIONAL { ?object vitro:moniker ?moniker }
|
||||
<linked-individual-required>
|
||||
<critical-data-required>
|
||||
FILTER ( bound(?name) )
|
||||
</linked-individual-required>
|
||||
</critical-data-required>
|
||||
} ORDER BY <collated> ?subclass </collated> ?name ?object
|
||||
</query-select>
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
OPTIONAL { ?link vitro:linkAnchor ?anchor }
|
||||
OPTIONAL { ?link vitro:linkURL ?url }
|
||||
OPTIONAL { ?link vitro:linkDisplayRank ?rank }
|
||||
<linked-individual-required>
|
||||
<critical-data-required>
|
||||
FILTER ( bound(?anchor) && bound(?url) )
|
||||
</linked-individual-required>
|
||||
</critical-data-required>
|
||||
} ORDER BY ?rank
|
||||
</query-select>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue