diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/IndividualFiltering.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/IndividualFiltering.java index bb4b902ee..dcae6f6e2 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/IndividualFiltering.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/IndividualFiltering.java @@ -2,7 +2,7 @@ package edu.cornell.mannlib.vitro.webapp.dao.filtering; -import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants.SOME_LITERAL; +import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants.*; import java.sql.Timestamp; import java.util.ArrayList; @@ -58,6 +58,8 @@ public class IndividualFiltering implements Individual { public List getDataPropertyList() { List dprops = _innerIndividual.getDataPropertyList(); LinkedList outdProps = new LinkedList(); + if( dprops == null ) + return outdProps; Filter.filter(dprops,_filters.getDataPropertyFilter(), outdProps); ListIterator it = outdProps.listIterator(); @@ -83,6 +85,8 @@ public class IndividualFiltering implements Individual { // the DataProperty with statements. - jblake List outdProps = new ArrayList(); List dprops = _innerIndividual.getPopulatedDataPropertyList(); + if( dprops == null ) + return outdProps; for (DataProperty dp: dprops) { if (_filters.getDataPropertyStatementFilter().fn( new DataPropertyStatementImpl(this._innerIndividual.getURI(), dp.getURI(), SOME_LITERAL))) { @@ -106,6 +110,8 @@ public class IndividualFiltering implements Individual { private List filterDataPropertyStatements(List dStmts) { List outDstmts = new LinkedList(); + if( dStmts == null ) + return outDstmts; Filter.filter(dStmts,_filters.getDataPropertyStatementFilter(), outDstmts); return outDstmts; } @@ -114,7 +120,7 @@ public class IndividualFiltering implements Individual { public Map getDataPropertyMap() { Map innerMap = _innerIndividual.getDataPropertyMap(); if( innerMap == null ) - return null; + return Collections.emptyMap(); Map returnMap = new HashMap(); for( String key : innerMap.keySet() ){ @@ -136,8 +142,6 @@ public class IndividualFiltering implements Individual { @Override public List getObjectPropertyList() { List oprops = _innerIndividual.getObjectPropertyList(); -// List outOProps = new LinkedList(); -// Filter.filter(oprops, _filters.getObjectPropertyFilter(), outOProps); return ObjectPropertyDaoFiltering.filterAndWrap(oprops, _filters); } @@ -463,6 +467,9 @@ public class IndividualFiltering implements Individual { @Override public List getDataValues(String propertyUri) { List stmts = getDataPropertyStatements(propertyUri); + if( stmts == null ) + return Collections.emptyList(); + // Since the statements have been filtered, we can just take the data values without filtering. List dataValues = new ArrayList(stmts.size()); for (DataPropertyStatement stmt : stmts) { @@ -474,6 +481,9 @@ public class IndividualFiltering implements Individual { @Override public String getDataValue(String propertyUri) { List stmts = getDataPropertyStatements(propertyUri); + if( stmts == null) + return null; + // Since the statements have been filtered, we can just take the first data value without filtering. return stmts.isEmpty() ? null : stmts.get(0).getData(); } @@ -481,6 +491,9 @@ public class IndividualFiltering implements Individual { @Override public DataPropertyStatement getDataPropertyStatement(String propertyUri) { List stmts = getDataPropertyStatements(propertyUri); + if( stmts == null ) + return null; + // Since the statements have been filtered, we can just take the first data value without filtering. return stmts.isEmpty() ? null : stmts.get(0); } @@ -488,6 +501,9 @@ public class IndividualFiltering implements Individual { @Override public List getRelatedIndividuals(String propertyUri) { List stmts = getObjectPropertyStatements(propertyUri); + if( stmts == null) + return Collections.emptyList(); + // Since the statements have been filtered, we can just take the individuals without filtering. List relatedIndividuals = new ArrayList(stmts.size()); for (ObjectPropertyStatement stmt : stmts) { @@ -499,6 +515,9 @@ public class IndividualFiltering implements Individual { @Override public Individual getRelatedIndividual(String propertyUri) { List stmts = getObjectPropertyStatements(propertyUri); + if( stmts == null ) + return null; + // Since the statements have been filtered, we can just take the first individual without filtering. return stmts.isEmpty() ? null : stmts.get(0).getObject(); } @@ -507,4 +526,4 @@ public class IndividualFiltering implements Individual { public boolean hasThumb() { return _innerIndividual.hasThumb(); } -} \ No newline at end of file +}