diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryConfig.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryConfig.java index b629a2583..90e5c8c98 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryConfig.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryConfig.java @@ -8,9 +8,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.jena.atlas.lib.Pair; - -import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty; +import edu.cornell.mannlib.vitro.webapp.dao.PropertyDao.FullPropertyKey; public class WebappDaoFactoryConfig { @@ -18,7 +16,7 @@ public class WebappDaoFactoryConfig { private String defaultNamespace; private Set nonUserNamespaces; private boolean isUnderlyingStoreReasoned = false; - public Map>, String> customListViewConfigFileMap; + public Map customListViewConfigFileMap; public WebappDaoFactoryConfig() { preferredLanguages = Arrays.asList("en-US", "en", "EN"); @@ -59,12 +57,12 @@ public class WebappDaoFactoryConfig { return this.isUnderlyingStoreReasoned; } - public Map>, String> getCustomListViewConfigFileMap() { + public Map getCustomListViewConfigFileMap() { return this.getCustomListViewConfigFileMap(); } public void setCustomListViewConfigFileMap( - Map>, String> map) { + Map map) { this.customListViewConfigFileMap = map; } 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 580aa34f5..be1198c4d 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 @@ -13,7 +13,6 @@ import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.jena.atlas.lib.Pair; import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; import com.hp.hpl.jena.ontology.ConversionException; @@ -58,8 +57,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp public ObjectPropertyDaoJena(RDFService rdfService, DatasetWrapperFactory dwf, - Map>, String> - customListViewConfigFileMap, + Map customListViewConfigFileMap, WebappDaoFactoryJena wadf) { super(rdfService, dwf, wadf); this.customListViewConfigFileMap = customListViewConfigFileMap; @@ -1090,12 +1088,12 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp // Map key is inner pair of object property and range class URI, // with first member of outer pair being a domain class URI. // If domain or range is unspecified, OWL.Thing.getURI() is used in the key. - Map>, String> customListViewConfigFileMap; + Map customListViewConfigFileMap; @Override public String getCustomListViewConfigFileName(ObjectProperty op) { if (customListViewConfigFileMap == null) { - customListViewConfigFileMap = new HashMap>, String>(); + customListViewConfigFileMap = new HashMap<>(); } if (customListViewConfigFileMap.isEmpty()) { long start = System.currentTimeMillis(); @@ -1125,33 +1123,31 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp } } else { String filename = soln.getLiteral("filename").getLexicalForm(); - log.debug("putting " + domainUri + " " + prop.getURI() + " " + rangeUri + " " + filename + " into list view map"); - customListViewConfigFileMap.put( - new Pair>( - domainUri, new Pair( - prop, rangeUri)), filename); + FullPropertyKey key = new FullPropertyKey(domainUri, prop.getURI(), rangeUri); + log.debug("putting " + key + " " + filename + " into list view map"); + customListViewConfigFileMap.put(key, filename); } } // If there are no custom list views, put a bogus entry in the map // to avoid further recomputation if (customListViewConfigFileMap.isEmpty()) { - ObjectProperty bottom = new ObjectProperty(); - bottom.setURI(OWL.NS + "bottomObjectProperty"); customListViewConfigFileMap.put( - new Pair>( - null, new Pair( - bottom, null)), "nothing"); + new FullPropertyKey(null, OWL.NS + "bottomObjectProperty", null), + "nothing"); } qexec.close(); } - String customListViewConfigFileName = customListViewConfigFileMap.get(new Pair>(op.getDomainVClassURI(), new Pair(op, op.getRangeVClassURI()))); + FullPropertyKey key = new FullPropertyKey(op); + String customListViewConfigFileName = customListViewConfigFileMap.get(key); if (customListViewConfigFileName == null) { - log.debug("no list view found for " + op.getURI() + " qualified by range " + op.getRangeVClassURI() + " and domain " + op.getDomainVClassURI()); - customListViewConfigFileName = customListViewConfigFileMap.get(new Pair>(OWL.Thing.getURI(), new Pair(op, op.getRangeVClassURI()))); + log.debug("no list view found for " + key); + key = new FullPropertyKey(null, op.getURI(), op.getRangeVClassURI()); + customListViewConfigFileName = customListViewConfigFileMap.get(key); } if (customListViewConfigFileName == null) { - log.debug("no list view found for " + op.getURI() + " qualified by range " + op.getRangeVClassURI()); - customListViewConfigFileName = customListViewConfigFileMap.get(new Pair>(OWL.Thing.getURI(), new Pair(op, OWL.Thing.getURI()))); + log.debug("no list view found for " + key); + key = new FullPropertyKey(null, op.getURI(), null); + customListViewConfigFileName = customListViewConfigFileMap.get(key); } return customListViewConfigFileName; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/rdfsetup/impl/BasicShortTermDataStructuresProvider.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/rdfsetup/impl/BasicShortTermDataStructuresProvider.java index 8c371cbe7..dae15d633 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/rdfsetup/impl/BasicShortTermDataStructuresProvider.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/rdfsetup/impl/BasicShortTermDataStructuresProvider.java @@ -18,10 +18,9 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.jena.atlas.lib.Pair; -import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty; import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties; +import edu.cornell.mannlib.vitro.webapp.dao.PropertyDao.FullPropertyKey; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactoryConfig; import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess.WhichService; import edu.cornell.mannlib.vitro.webapp.modelaccess.ontmodels.JoinedOntModelCache; @@ -123,11 +122,12 @@ public class BasicShortTermDataStructuresProvider implements return ("true".equals(isStoreReasoned)); } - private Map>, String> getCustomListViewConfigFileMap() { - Map>, String> map = (Map>, String>) ctx + private Map getCustomListViewConfigFileMap() { + @SuppressWarnings("unchecked") + Map map = (Map) ctx .getAttribute("customListViewConfigFileMap"); if (map == null) { - map = new ConcurrentHashMap>, String>(); + map = new ConcurrentHashMap(); ctx.setAttribute("customListViewConfigFileMap", map); } return map;