NIHVIVO-1780 Treat a negative display value as no display value. Debugging output in ObjectPropertyTemplateModel.

This commit is contained in:
rjy7 2011-01-18 20:12:26 +00:00
parent 6dadd82a80
commit 11ed388dea
2 changed files with 28 additions and 1 deletions

View file

@ -45,7 +45,9 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel {
// 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() ) {
int displayLimit = dp.getDisplayLimit();
// Display limit of -1 (default value for new property) doesn't count
if ( (displayLimit < 0) || (displayLimit > statements.size()) ) {
RequestedAction action = new AddDataPropStmt(subjectUri, propertyUri,RequestActionConstants.SOME_LITERAL, null, null);
if (policyHelper.isAuthorizedAction(action)) {
addAccess = true;

View file

@ -151,6 +151,12 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
/** Apply post-processing to query results to prepare for template */
protected void postprocess(List<Map<String, String>> data, WebappDaoFactory wdf) {
if (log.isDebugEnabled()) {
log.debug("Data before postprocessing");
logData(data);
}
String postprocessorName = config.postprocessor;
if (postprocessorName == null) {
//return;
@ -165,6 +171,25 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
} catch (Exception e) {
log.error(e, e);
}
if (log.isDebugEnabled()) {
log.debug("Data after postprocessing");
logData(data);
}
}
private void logData(List<Map<String, String>> data) {
if (log.isDebugEnabled()) {
int count = 1;
for (Map<String, String> map : data) {
log.debug("List item " + count);
count++;
for (String key : map.keySet()) {
log.debug(key + ": " + map.get(key));
}
}
}
}
/* Post-processing that must occur after collation, because it does reordering on collated subclass