Merge r7033, r7037 from trunk

This commit is contained in:
rjy7 2011-01-15 04:55:38 +00:00
parent dd82ea3927
commit eb7a3933e4
4 changed files with 18 additions and 14 deletions

View file

@ -45,8 +45,8 @@ public class CollatedObjectPropertyTemplateModel extends ObjectPropertyTemplateM
String invalidConfigMessage = checkConfiguration();
if ( ! invalidConfigMessage.isEmpty() ) {
throw new InvalidConfigurationException("Invalid configuration for property " +
op.getURI() + ":" + invalidConfigMessage);
throw new InvalidConfigurationException("Invalid configuration for collated property " +
op.getURI() + ":" + invalidConfigMessage + ". Creating uncollated display instead.");
}
/* Get the data */

View file

@ -34,14 +34,6 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel {
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 */

View file

@ -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;
}
}

View file

@ -141,7 +141,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
try {
return new CollatedObjectPropertyTemplateModel(op, subject, vreq, policyHelper);
} catch (InvalidConfigurationException e) {
log.error(e);
log.warn(e);
return new UncollatedObjectPropertyTemplateModel(op, subject, vreq, policyHelper);
}
} else {