NIHVIVO-2449 In search results, display preferredTitle with fallback to mostSpecificTypes

This commit is contained in:
ryounes 2011-07-06 19:02:45 +00:00
parent dbdbd81d11
commit 14cee2cbea
13 changed files with 49 additions and 28 deletions

View file

@ -58,7 +58,7 @@ import edu.cornell.mannlib.vitro.webapp.utils.NamespaceMapperFactory;
import edu.cornell.mannlib.vitro.webapp.utils.jena.ExtendedLinkedDataUtils;
import edu.cornell.mannlib.vitro.webapp.web.ContentType;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModel;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.ListedIndividual;
import freemarker.ext.beans.BeansWrapper;
/**

View file

@ -45,8 +45,8 @@ import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc;
import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames;
import edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneIndexFactory;
import edu.cornell.mannlib.vitro.webapp.search.solr.SolrSetup;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.BaseListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.BaseListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.ListedIndividual;
import freemarker.ext.beans.BeansWrapper;
import freemarker.template.TemplateModel;
@ -109,7 +109,7 @@ public class IndividualListController extends FreemarkerHttpServlet {
body.putAll(map);
List<Individual> inds = (List<Individual>)map.get("entities");
List<BaseListedIndividual> indsTm = new ArrayList<BaseListedIndividual>();
List<ListedIndividual> indsTm = new ArrayList<ListedIndividual>();
for(Individual ind : inds ){
indsTm.add(new ListedIndividual(ind,vreq));
}

View file

@ -31,8 +31,8 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Tem
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames;
import edu.cornell.mannlib.vitro.webapp.search.solr.SolrSetup;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.BaseListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.BaseListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.ListedIndividual;
import freemarker.ext.beans.BeansWrapper;
import freemarker.template.TemplateModel;
@ -96,7 +96,7 @@ public class SolrIndividualListController extends FreemarkerHttpServlet {
@SuppressWarnings("unchecked")
List<Individual> inds = (List<Individual>)map.get("entities");
List<BaseListedIndividual> indsTm = new ArrayList<BaseListedIndividual>();
List<ListedIndividual> indsTm = new ArrayList<ListedIndividual>();
for ( Individual ind : inds ) {
indsTm.add(new ListedIndividual(ind,vreq));
}

View file

@ -68,7 +68,7 @@ import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc;
import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames;
import edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneIndexFactory;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.LinkTemplateModel;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.BaseListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.BaseListedIndividual;
import freemarker.template.Configuration;
/**

View file

@ -52,8 +52,8 @@ import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQuery;
import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQueryFactory;
import edu.cornell.mannlib.vitro.webapp.search.solr.SolrSetup;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.LinkTemplateModel;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualSearchResult;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.BaseListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.BaseListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.searchresult.IndividualSearchResult;
import freemarker.template.Configuration;
/**

View file

@ -27,8 +27,8 @@ import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
import edu.cornell.mannlib.vitro.webapp.utils.JSONtoFmModel;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassGroupTemplateModel;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassTemplateModel;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.BaseListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.BaseListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.ListedIndividual;
public class BrowseDataGetter implements PageDataGetter {
final static Log log = LogFactory.getLog(BrowseDataGetter.class);
@ -146,7 +146,7 @@ public class BrowseDataGetter implements PageDataGetter {
List<Individual> inds = vreq.getWebappDaoFactory().getIndividualDao()
.getIndividualsByVClass(vclass);
List<BaseListedIndividual> tInds = new ArrayList<BaseListedIndividual>(inds.size());
List<ListedIndividual> tInds = new ArrayList<ListedIndividual>(inds.size());
for( Individual ind : inds){
tInds.add(new ListedIndividual(ind, vreq));
}

View file

@ -35,7 +35,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassGroupTemplateModel;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.BaseListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.BaseListedIndividual;
import freemarker.ext.beans.BeansWrapper;
import freemarker.template.TemplateModel;

View file

@ -33,7 +33,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassGroupTemplateModel;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.BaseListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.BaseListedIndividual;
import edu.cornell.mannlib.vitro.webapp.controller.JSONServlet;
import freemarker.ext.beans.BeansWrapper;
import freemarker.template.TemplateModel;

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual;
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist;
import java.util.ArrayList;
import java.util.List;

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual;
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual;
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.searchresult;
import java.util.ArrayList;
import java.util.List;
@ -16,20 +16,19 @@ import edu.cornell.mannlib.vitro.webapp.web.ViewFinder;
import edu.cornell.mannlib.vitro.webapp.web.ViewFinder.ClassView;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.BaseTemplateModel;
public class IndividualSearchResult extends BaseTemplateModel {
public abstract class BaseIndividualSearchResult extends BaseTemplateModel {
private static final Log log = LogFactory.getLog(IndividualSearchResult.class);
private static final Log log = LogFactory.getLog(BaseIndividualSearchResult.class);
protected Individual individual;
protected VitroRequest vreq;
public IndividualSearchResult(Individual individual, VitroRequest vreq) {
this.individual = individual;
this.vreq = vreq;
public BaseIndividualSearchResult(Individual individual, VitroRequest vreq) {
this.individual = individual;
this.vreq = vreq;
}
private String getView(ClassView view) {
protected String getView(ClassView view) {
ViewFinder vf = new ViewFinder(view);
return vf.findClassView(individual, vreq);
}

View file

@ -0,0 +1,22 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.searchresult;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
public class IndividualSearchResult extends BaseIndividualSearchResult {
private static final Log log = LogFactory.getLog(IndividualSearchResult.class);
protected Individual individual;
protected VitroRequest vreq;
public IndividualSearchResult(Individual individual, VitroRequest vreq) {
super(individual, vreq);
}
}

View file

@ -26,8 +26,8 @@ import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
import edu.cornell.mannlib.vitro.webapp.utils.JSONtoFmModel;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassGroupTemplateModel;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassTemplateModel;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.BaseListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.BaseListedIndividual;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.ListedIndividual;
import freemarker.core.Environment;
import freemarker.template.TemplateModelException;
@ -162,7 +162,7 @@ public class BrowseWidget extends Widget {
List<Individual> inds = vreq.getWebappDaoFactory().getIndividualDao()
.getIndividualsByVClass(vclass);
List<BaseListedIndividual> tInds = new ArrayList<BaseListedIndividual>(inds.size());
List<ListedIndividual> tInds = new ArrayList<ListedIndividual>(inds.size());
for( Individual ind : inds){
tInds.add(new ListedIndividual(ind, vreq));
}