From d3f77a374cb75b6a4df183de5e02e42824518c09 Mon Sep 17 00:00:00 2001 From: hjkhjk54 Date: Tue, 11 Oct 2011 19:44:12 +0000 Subject: [PATCH] Updates for resolving NIHVIVO-3217 and NIHVIVO-3218 --- .../vitro/webapp/dao/jena/ObjectPropertyDaoJena.java | 11 +++++++++-- .../vitro/webapp/dao/jena/WebappDaoFactoryJena.java | 10 +++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ObjectPropertyDaoJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ObjectPropertyDaoJena.java index 6d1e38308..a6a1e6600 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ObjectPropertyDaoJena.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ObjectPropertyDaoJena.java @@ -866,14 +866,21 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp if (customListViewConfigFileMap == null) { customListViewConfigFileMap = new HashMap(); OntModel displayModel = getOntModelSelector().getDisplayModel(); + //Get all property to list view config file mappings in the system QueryExecution qexec = QueryExecutionFactory.create(listViewConfigFileQuery, displayModel); - ResultSet results = qexec.execSelect(); + ResultSet results = qexec.execSelect(); + //Iterate through mappings looking for the current property and setting up a hashmap for subsequent retrieval while (results.hasNext()) { QuerySolution soln = results.next(); String propertyUri = soln.getResource("property").getURI(); ObjectProperty prop = getObjectPropertyByURI(propertyUri); if (prop == null) { - log.warn("Can't find property for uri " + propertyUri); + //This is a warning only if this property is the one for which we're searching + if(op.getURI().equals(propertyUri)){ + log.warn("Can't find property for uri " + propertyUri); + } else { + log.debug("Can't find property for uri " + propertyUri); + } } else { String filename = soln.getLiteral("filename").getLexicalForm(); customListViewConfigFileMap.put(prop, filename); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/WebappDaoFactoryJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/WebappDaoFactoryJena.java index 7cc071984..7b67785ef 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/WebappDaoFactoryJena.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/WebappDaoFactoryJena.java @@ -655,7 +655,15 @@ public class WebappDaoFactoryJena implements WebappDaoFactory { OntModelSelectorImpl specialSelector = new OntModelSelectorImpl(); specialSelector.setFullModel(unionModel); - specialSelector.setApplicationMetadataModel(specialModel); + //Keeping original application metadata model and adding special model + //adding both allows us to prevent errors in ApplicationDao which may depend on + //a specific individual from the regular application metadata model to pick theme + //Adding the new model would take care of special situations where the switch model may + //contain important information + OntModel newApplicationModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); + newApplicationModel.add(specialModel); + newApplicationModel.add(originalSelector.getApplicationMetadataModel()); + specialSelector.setApplicationMetadataModel(newApplicationModel); if(specialDisplayModel != null) { specialSelector.setDisplayModel(specialDisplayModel);