NIHVIVO-2790 Make vitro:moniker displayable and editable (but not addable) so existing values can be managed by editors post-1.3 upgrade.
This commit is contained in:
parent
6e4fcedb6c
commit
1fb8fdcc45
6 changed files with 44 additions and 11 deletions
|
@ -726,7 +726,7 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
//"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
//"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
||||||
//"http://www.w3.org/2000/01/rdf-schema#",
|
//"http://www.w3.org/2000/01/rdf-schema#",
|
||||||
"http://www.w3.org/2002/07/owl#",
|
"http://www.w3.org/2002/07/owl#",
|
||||||
"http://vitro.mannlib.cornell.edu/ns/vitro/0.7#",
|
//"http://vitro.mannlib.cornell.edu/ns/vitro/0.7#",
|
||||||
"http://vitro.mannlib.cornell.edu/ns/vitro/public#"
|
"http://vitro.mannlib.cornell.edu/ns/vitro/public#"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -750,7 +750,11 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
" ?property a owl:DatatypeProperty . \n" +
|
" ?property a owl:DatatypeProperty . \n" +
|
||||||
" FILTER ( \n" +
|
" FILTER ( \n" +
|
||||||
" isLiteral(?object) && \n" +
|
" isLiteral(?object) && \n" +
|
||||||
PROPERTY_FILTERS + "\n" +
|
" ( afn:namespace(?property) != \"" + VitroVocabulary.PUBLIC + "\" ) && \n" +
|
||||||
|
" ( afn:namespace(?property) != \"" + VitroVocabulary.OWL + "\" ) && \n" +
|
||||||
|
// NIHVIVO-2790 vitro:moniker has been deprecated, but display existing values for editorial management (deletion is encouraged).
|
||||||
|
// This property will be hidden from public display by default.
|
||||||
|
" ( ?property = <" + VitroVocabulary.MONIKER + "> || afn:namespace(?property) != \"" + VitroVocabulary.vitroURI + "\" ) \n" +
|
||||||
" ) \n" +
|
" ) \n" +
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
|
@ -767,6 +771,7 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
// QuerySolutionMap initialBindings = new QuerySolutionMap();
|
// QuerySolutionMap initialBindings = new QuerySolutionMap();
|
||||||
// initialBindings.add("subject", ResourceFactory.createResource(subjectUri));
|
// initialBindings.add("subject", ResourceFactory.createResource(subjectUri));
|
||||||
String queryString = QueryUtils.subUriForQueryVar(DATA_PROPERTY_QUERY_STRING, "subject", subjectUri);
|
String queryString = QueryUtils.subUriForQueryVar(DATA_PROPERTY_QUERY_STRING, "subject", subjectUri);
|
||||||
|
log.debug(queryString);
|
||||||
|
|
||||||
Query query = null;
|
Query query = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -22,6 +22,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
|
||||||
public class DataPropertyTemplateModel extends PropertyTemplateModel {
|
public class DataPropertyTemplateModel extends PropertyTemplateModel {
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel {
|
||||||
private static final String EDIT_PATH = "edit/editDatapropStmtRequestDispatch.jsp";
|
private static final String EDIT_PATH = "edit/editDatapropStmtRequestDispatch.jsp";
|
||||||
|
|
||||||
private List<DataPropertyStatementTemplateModel> statements;
|
private List<DataPropertyStatementTemplateModel> statements;
|
||||||
|
|
||||||
DataPropertyTemplateModel(DataProperty dp, Individual subject, VitroRequest vreq,
|
DataPropertyTemplateModel(DataProperty dp, Individual subject, VitroRequest vreq,
|
||||||
EditingPolicyHelper policyHelper, List<DataProperty> populatedDataPropertyList) {
|
EditingPolicyHelper policyHelper, List<DataProperty> populatedDataPropertyList) {
|
||||||
|
|
||||||
|
@ -52,8 +54,21 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel {
|
||||||
log.debug("Data property " + getUri() + " is unpopulated.");
|
log.debug("Data property " + getUri() + " is unpopulated.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine whether a new statement can be added
|
setAddAccess(policyHelper, dp);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine whether a new statement can be added
|
||||||
|
@Override
|
||||||
|
protected void setAddAccess(EditingPolicyHelper policyHelper, Property property) {
|
||||||
if (policyHelper != null) {
|
if (policyHelper != null) {
|
||||||
|
|
||||||
|
DataProperty dp = (DataProperty) property;
|
||||||
|
|
||||||
|
// NIHVIVO-2790 vitro:moniker now included in the display, but don't allow new statements
|
||||||
|
if (dp.getURI().equals(VitroVocabulary.MONIKER)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// If the display limit has already been reached, we can't add a new statement
|
// If the display limit has already been reached, we can't add a new statement
|
||||||
int displayLimit = dp.getDisplayLimit();
|
int displayLimit = dp.getDisplayLimit();
|
||||||
// Display limit of -1 (default value for new property) means no display limit
|
// Display limit of -1 (default value for new property) means no display limit
|
||||||
|
@ -63,7 +78,7 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel {
|
||||||
addAccess = true;
|
addAccess = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -92,8 +92,10 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
|
||||||
|
|
||||||
// Used for editing
|
// Used for editing
|
||||||
private boolean addAccess = false;
|
private boolean addAccess = false;
|
||||||
|
|
||||||
//To allow for checking of special parameters
|
//To allow for checking of special parameters
|
||||||
private VitroRequest vitroRequest = null;
|
private VitroRequest vitroRequest = null;
|
||||||
|
|
||||||
ObjectPropertyTemplateModel(ObjectProperty op, Individual subject, VitroRequest vreq,
|
ObjectPropertyTemplateModel(ObjectProperty op, Individual subject, VitroRequest vreq,
|
||||||
EditingPolicyHelper policyHelper)
|
EditingPolicyHelper policyHelper)
|
||||||
throws InvalidConfigurationException {
|
throws InvalidConfigurationException {
|
||||||
|
@ -113,13 +115,19 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
|
||||||
|
|
||||||
objectKey = getQueryObjectVariableName();
|
objectKey = getQueryObjectVariableName();
|
||||||
|
|
||||||
// Determine whether a new statement can be added
|
|
||||||
|
setAddAccess(policyHelper, op);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine whether a new statement can be added
|
||||||
|
@Override
|
||||||
|
protected void setAddAccess(EditingPolicyHelper policyHelper, Property property) {
|
||||||
if (policyHelper != null) {
|
if (policyHelper != null) {
|
||||||
RequestedAction action = new AddObjectPropStmt(subjectUri, propertyUri, RequestActionConstants.SOME_URI);
|
RequestedAction action = new AddObjectPropStmt(subjectUri, propertyUri, RequestActionConstants.SOME_URI);
|
||||||
if (policyHelper.isAuthorizedAction(action)) {
|
if (policyHelper.isAuthorizedAction(action)) {
|
||||||
addAccess = true;
|
addAccess = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<Map<String, String>> getStatementData() {
|
protected List<Map<String, String>> getStatementData() {
|
||||||
|
|
|
@ -46,7 +46,9 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setVerboseDisplayValues(Property property) {
|
protected void setVerboseDisplayValues(Property property) {
|
||||||
// No verbose display for these properties
|
// No verbose display for these properties.
|
||||||
|
// This models previous behavior. In theory the verbose display can be provided, but we may not want
|
||||||
|
// to give anyone access to these properties, since the application is dependent on them.
|
||||||
if (GroupedPropertyList.VITRO_PROPS_TO_ADD_TO_LIST.contains(property)) {
|
if (GroupedPropertyList.VITRO_PROPS_TO_ADD_TO_LIST.contains(property)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -84,6 +86,9 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determine whether a new statement can be added
|
||||||
|
protected abstract void setAddAccess(EditingPolicyHelper policyHelper, Property property);
|
||||||
|
|
||||||
|
|
||||||
/* Access methods for templates */
|
/* Access methods for templates */
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,9 @@ ${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/browseIndex.css
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<#list individuals as individual>
|
<#list individuals as individual>
|
||||||
<li>
|
<li>
|
||||||
<#assign moniker = individual.moniker!>
|
<a href="${individual.profileUrl}">${individual.name}</a>
|
||||||
<a href="${individual.profileUrl}">${individual.name}</a><#if moniker?has_content> <span class="moniker">${moniker}</span></#if>
|
<#-- <#if individual.moniker?has_content> <span class="moniker">${individual.moniker}</span></#if> -->
|
||||||
<#assign links = individual.links>
|
<#assign links = individual.links>
|
||||||
<#if links?has_content>
|
<#if links?has_content>
|
||||||
<ul class="individualData">
|
<ul class="individualData">
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<#-- Default individual search view -->
|
<#-- Default individual search view -->
|
||||||
|
|
||||||
<a href="${individual.profileUrl}">${individual.name}</a>
|
<a href="${individual.profileUrl}">${individual.name}</a>
|
||||||
<#if individual.moniker?has_content> | ${individual.moniker}</#if>
|
<#-- <#if individual.moniker?has_content> | ${individual.moniker}</#if> -->
|
||||||
|
|
||||||
<#if individual.description?has_content>
|
<#if individual.description?has_content>
|
||||||
<div class="searchFragment">${individual.description}</div>
|
<div class="searchFragment">${individual.description}</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue