hiding classes from index for NIHVIVO-642
This commit is contained in:
parent
f5e9df1a08
commit
68533c7bd3
1 changed files with 24 additions and 0 deletions
|
@ -9,6 +9,7 @@ import com.hp.hpl.jena.vocabulary.RDF;
|
|||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -19,6 +20,8 @@ import edu.cornell.mannlib.vitro.webapp.dao.filtering.WebappDaoFactoryFiltering;
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilterUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilters;
|
||||
import edu.cornell.mannlib.vitro.webapp.flags.PortalFlag;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassGroupTemplateModel;
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.SimpleSequence;
|
||||
|
@ -53,6 +56,7 @@ public class BrowseController extends FreeMarkerHttpServlet {
|
|||
OntModel baseModel = (OntModel)sContext.getAttribute("baseOntModel");
|
||||
OntModel infModel = (OntModel)sContext.getAttribute("inferenceOntModel");
|
||||
|
||||
|
||||
BrowseControllerChangeListener bccl = new BrowseControllerChangeListener(this);
|
||||
model.register(bccl);
|
||||
baseModel.register(bccl);
|
||||
|
@ -117,6 +121,8 @@ public class BrowseController extends FreeMarkerHttpServlet {
|
|||
//removeUnpopulatedClasses( groups);
|
||||
vcgDao.removeUnpopulatedGroups(groups);
|
||||
|
||||
removeClassesHiddenFromSearch(groups);
|
||||
|
||||
_groupListMap.put(portalId, groups);
|
||||
return groups;
|
||||
} else {
|
||||
|
@ -124,6 +130,24 @@ public class BrowseController extends FreeMarkerHttpServlet {
|
|||
}
|
||||
}
|
||||
|
||||
private void removeClassesHiddenFromSearch(List<VClassGroup> groups) {
|
||||
OntModel displayOntModel =
|
||||
(OntModel) getServletConfig().getServletContext()
|
||||
.getAttribute("displayOntModel");
|
||||
ProhibitedFromSearch pfs = new ProhibitedFromSearch(
|
||||
DisplayVocabulary.PRIMARY_LUCENE_INDEX_URI, displayOntModel);
|
||||
for (VClassGroup group : groups) {
|
||||
List<VClass> classList = new ArrayList<VClass>();
|
||||
for (VClass vclass : group.getVitroClassList()) {
|
||||
if (!pfs.isClassProhibited(vclass.getURI())) {
|
||||
classList.add(vclass);
|
||||
}
|
||||
}
|
||||
group.setVitroClassList(classList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static boolean ORDER_BY_DISPLAYRANK = true;
|
||||
private static boolean INCLUDE_UNINSTANTIATED = true;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue