NIHVIVO-1513 New individual page was generating errors when user is logged in because some property labels were not set. Fixed by setting in the property template model constructor.

NIHVIVO-1334 Initial set up for custom list views.
This commit is contained in:
rjy7 2010-12-13 22:46:42 +00:00
parent 6a52b1c1f2
commit 25b14ad78c
5 changed files with 16 additions and 7 deletions

View file

@ -23,6 +23,8 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel {
DataPropertyTemplateModel(DataProperty dp, Individual subject, WebappDaoFactory wdf) {
super(dp);
setName(dp.getPublicName());
// Get the data property statements via a sparql query
DataPropertyStatementDao dpDao = wdf.getDataPropertyStatementDao();
List<DataPropertyStatement> dpStatements = dpDao.getDataPropertyStatementsForIndividualByProperty(subject, dp);

View file

@ -3,8 +3,6 @@
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual;
import java.io.File;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@ -17,7 +15,6 @@ import org.w3c.dom.NodeList;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyStatementDao;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel {
@ -29,7 +26,8 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
ObjectPropertyTemplateModel(ObjectProperty op, Individual subject, WebappDaoFactory wdf) {
super(op);
setName(op.getDomainPublic());
// Get the config for this object property
try {
config = new PropertyListConfig(op);
@ -61,7 +59,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
private class PropertyListConfig {
private static final String DEFAULT_CONFIG_FILE = "objectPropertyList-default.xml";
private static final String CONFIG_FILE_PATH = "/views/";
private static final String CONFIG_FILE_PATH = "/config/";
private static final String NODE_NAME_QUERY = "query";
private static final String NODE_NAME_TEMPLATE = "template";
private static final String NODE_NAME_COLLATION_TARGET = "collation-target";

View file

@ -67,7 +67,7 @@ public class PropertyListBuilder {
// don't need to set editLabel, can just do this:
//propertyList.addAll(objectPropertyList);
for (ObjectProperty op : objectPropertyList) {
op.setLabel(op.getDomainPublic());
//op.setLabel(op.getDomainPublic());
propertyList.add(op);
}
@ -86,7 +86,7 @@ public class PropertyListBuilder {
// two working in parallel.
List<DataProperty> dataPropertyList = subject.getPopulatedDataPropertyList();
for (DataProperty dp : dataPropertyList) {
dp.setLabel(dp.getPublicName());
//dp.setLabel(dp.getPublicName());
propertyList.add(dp);
}
@ -169,6 +169,7 @@ public class PropertyListBuilder {
} else if (op.getURI() == null) {
log.error("ObjectProperty op returned with null propertyURI from opDao.getObjectPropertyByURI()");
} else if (! alreadyOnPropertyList(propertyList, op)) {
//op.setLabel(op.getDomainPublic());
propertyList.add(op);
}
}
@ -191,6 +192,7 @@ public class PropertyListBuilder {
if (dp.getURI() == null) {
log.error("DataProperty dp returned with null propertyURI from dpDao.getAllPossibleDatapropsForIndividual()");
} else if (! alreadyOnPropertyList(propertyList, dp)) {
//dp.setLabel(dp.getPublicName());
propertyList.add(dp);
}
} else {

View file

@ -21,10 +21,17 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel {
PropertyTemplateModel(Property property) {
this.name = property.getLabel();
// Do in subclass constructor. The label has not been set on the property, and getting the
// label differs between object and data properties.
// this.name = property.getLabel();
this.uri = property.getURI();
this.property = property;
}
protected void setName(String name) {
this.name = name;
}
/* Access methods for templates */
public abstract String getType();