diff --git a/webapp/config/web.xml b/webapp/config/web.xml index 394ddb731..849f7991c 100644 --- a/webapp/config/web.xml +++ b/webapp/config/web.xml @@ -124,10 +124,6 @@ edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneSetup - - - edu.cornell.mannlib.vitro.webapp.auth.policy.setup.VivoPolicySetup - - - + diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityMergedPropertyListController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityMergedPropertyListController.java index a75b152b9..0f6c2e402 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityMergedPropertyListController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityMergedPropertyListController.java @@ -15,6 +15,7 @@ import java.util.List; import java.util.Map; import javax.servlet.RequestDispatcher; +import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; @@ -77,7 +78,8 @@ public class EntityMergedPropertyListController extends VitroHttpServlet { if( obj == null || !(obj instanceof Individual)) throw new HelpException("EntityMergedPropertyListController requires request.attribute 'entity' to be of" +" type " + Individual.class.getName() ); - Individual subject =(Individual)obj; + Individual subject =(Individual)obj; + subject = filterFromContext( subject ); // determine whether are just displaying populated properties or also interleaving unpopulated ones boolean editMode = false; @@ -113,11 +115,14 @@ public class EntityMergedPropertyListController extends VitroHttpServlet { List mergedPropertyList = new ArrayList(); // now first get the properties this entity actually has, presumably populated with statements - List objectPropertyList = subject.getObjectPropertyList(); + List objectPropertyList = subject.getObjectPropertyList(); + for (ObjectProperty op : objectPropertyList) { if (!SUPPRESSED_OBJECT_PROPERTIES.contains(op)) { op.setEditLabel(op.getDomainPublic()); mergedPropertyList.add(op); + }else{ + log.debug("suppressed " + op.getURI()); } } @@ -233,9 +238,11 @@ public class EntityMergedPropertyListController extends VitroHttpServlet { UnaryFunctor,List> entityPropertyListFilter = PropertyMaskingSetup.getEntityPropertyListFilter(getServletContext()); if (entityPropertyListFilter != null) { mergedPropertyList = entityPropertyListFilter.fn(mergedPropertyList); - } + } + req.setAttribute("mergedList",mergedPropertyList); - } + } + req.setAttribute("entity",subject); RequestDispatcher rd = req.getRequestDispatcher(groupedMode ? Controllers.ENTITY_MERGED_PROP_LIST_GROUPED_JSP : Controllers.ENTITY_MERGED_PROP_LIST_UNGROUPED_JSP); @@ -251,6 +258,8 @@ public class EntityMergedPropertyListController extends VitroHttpServlet { } } + + public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException { doGet(request, response); @@ -538,5 +547,35 @@ public class EntityMergedPropertyListController extends VitroHttpServlet { } return directClasses; } - + + /** + * Look for filter in servlet context and filter properties with it if there is one. + * + * This allows a vitro instance to have specialized filtering for display. It was originally + * created to deal with problems caused by custom short views. + * * + * @param objectPropertyList + * @param wdf + * @return + */ + private Individual filterFromContext(Individual ind ) { + try{ + UnaryFunctor filter = getMergedPropertyListFilter(getServletContext()); + if( filter == null ) + return ind; + else + return filter.fn(ind); + }catch(Throwable t){ + log.error(t,t); + } + return ind; + } + + public static void setMergedPropertyListFilter( UnaryFunctorfn, ServletContext sc){ + sc.setAttribute("EntityMergedPropertyListController.toFilteringIndividual", fn); + } + + public static UnaryFunctor getMergedPropertyListFilter( ServletContext sc){ + return(UnaryFunctor)sc.getAttribute("EntityMergedPropertyListController.toFilteringIndividual"); + } }