NIHVIVO-1667 Don't display an add link for data properties whose display limit has already been reached.
This commit is contained in:
parent
1e2070299d
commit
9ac7796c67
2 changed files with 15 additions and 11 deletions
|
@ -33,15 +33,7 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel {
|
|||
super(dp, subject, policyHelper);
|
||||
|
||||
setName(dp.getPublicName());
|
||||
|
||||
// Determine whether a new statement can be added
|
||||
if (policyHelper != null) {
|
||||
RequestedAction action = new AddDataPropStmt(subjectUri, propertyUri,RequestActionConstants.SOME_LITERAL, null, null);
|
||||
if (policyHelper.isAuthorizedAction(action)) {
|
||||
addAccess = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get the data property statements via a sparql query
|
||||
DataPropertyStatementDao dpDao = vreq.getWebappDaoFactory().getDataPropertyStatementDao();
|
||||
List<Literal> values = dpDao.getDataPropertyValuesForIndividualByProperty(subject, dp);
|
||||
|
@ -49,6 +41,17 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel {
|
|||
for (Literal value : values) {
|
||||
statements.add(new DataPropertyStatementTemplateModel(subjectUri, propertyUri, value, policyHelper));
|
||||
}
|
||||
|
||||
// Determine whether a new statement can be added
|
||||
if (policyHelper != null) {
|
||||
// If the display limit has already been reached, we can't add a new statement
|
||||
if ( dp.getDisplayLimit() > statements.size() ) {
|
||||
RequestedAction action = new AddDataPropStmt(subjectUri, propertyUri,RequestActionConstants.SOME_LITERAL, null, null);
|
||||
if (policyHelper.isAuthorizedAction(action)) {
|
||||
addAccess = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Access methods for templates */
|
||||
|
|
|
@ -99,8 +99,8 @@ public class GroupedPropertyList extends BaseTemplateModel {
|
|||
|
||||
// Build the template data model from the groupList
|
||||
groups = new ArrayList<PropertyGroupTemplateModel>(propertyGroupList.size());
|
||||
for (PropertyGroup pg : propertyGroupList) {
|
||||
groups.add(new PropertyGroupTemplateModel(vreq, pg, subject, policyHelper));
|
||||
for (PropertyGroup propertyGroup: propertyGroupList) {
|
||||
groups.add(new PropertyGroupTemplateModel(vreq, propertyGroup, subject, policyHelper));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -425,5 +425,6 @@ public class GroupedPropertyList extends BaseTemplateModel {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue