updating pullProperty() to pull property/class combos

This commit is contained in:
brianjlowe 2013-08-06 16:22:58 -04:00
parent a270043063
commit 887cc94e8d
3 changed files with 13 additions and 4 deletions

View file

@ -457,11 +457,16 @@ public class GroupedPropertyList extends BaseTemplateModel {
}
public PropertyTemplateModel pullProperty(String propertyUri) {
return pullProperty(propertyUri, null);
}
public PropertyTemplateModel pullProperty(String propertyUri, String rangeUri) {
for (PropertyGroupTemplateModel pgtm : groups) {
List<PropertyTemplateModel> properties = pgtm.getProperties();
for (PropertyTemplateModel ptm : properties) {
if (propertyUri.equals(ptm.getUri())) {
if (propertyUri.equals(ptm.getUri()) &&
(rangeUri == null || rangeUri.equals(ptm.getRangeUri()))) {
// Remove the property from the group.
// NB Works with a for-each loop instead of an iterator,
// since iteration doesn't continue after the remove.

View file

@ -80,7 +80,6 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
private PropertyListConfig config;
private String objectKey;
private String sortDirection;
private String rangeURI;
ObjectPropertyTemplateModel(ObjectProperty op, Individual subject, VitroRequest vreq,
boolean editing)
@ -90,7 +89,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
setName(op.getDomainPublic());
sortDirection = op.getDomainEntitySortDirection();
rangeURI = op.getRangeVClassURI();
rangeUri = op.getRangeVClassURI();
// Get the config for this object property
try {
@ -157,7 +156,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
protected List<Map<String, String>> getStatementData() {
ObjectPropertyStatementDao opDao = vreq.getWebappDaoFactory().getObjectPropertyStatementDao();
return opDao.getObjectPropertyStatementsForIndividualByProperty(subjectUri, propertyUri, objectKey, rangeURI, getSelectQuery(), getConstructQueries(), sortDirection);
return opDao.getObjectPropertyStatementsForIndividualByProperty(subjectUri, propertyUri, objectKey, rangeUri, getSelectQuery(), getConstructQueries(), sortDirection);
}
protected abstract boolean isEmpty();

View file

@ -29,6 +29,7 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel {
protected final VitroRequest vreq;
protected final String subjectUri;
protected final String propertyUri;
protected String rangeUri;
private final String localName;
protected Map<String, Object> verboseDisplay;
@ -110,6 +111,10 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel {
return propertyUri;
}
public String getRangeUri() {
return rangeUri;
}
public String getAddUrl() {
//log.info("addUrl=" + addUrl);
return (addUrl != null) ? addUrl : "";