From e97d3ef637b74922695640fa3f3d73ae107717b6 Mon Sep 17 00:00:00 2001 From: rjy7 Date: Wed, 31 Mar 2010 19:49:11 +0000 Subject: [PATCH] NIHVIVO-271 Find any custom short view attached to an object's class or superclass, before the inference engine has updated, so that a new position entry will display on the individual page immediately on form submission using the custom short view for position. This could should probably be moved into an instance method of the appropriate class, however. --- .../entity/entityMergedPropsListUngrouped.jsp | 37 +++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/webapp/web/templates/entity/entityMergedPropsListUngrouped.jsp b/webapp/web/templates/entity/entityMergedPropsListUngrouped.jsp index e94a14619..2abbe5d51 100644 --- a/webapp/web/templates/entity/entityMergedPropsListUngrouped.jsp +++ b/webapp/web/templates/entity/entityMergedPropsListUngrouped.jsp @@ -4,6 +4,7 @@ <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <%@ taglib uri="http://vitro.mannlib.cornell.edu/vitro/tags/StringProcessorTag" prefix="p" %> <%@ taglib uri="http://vitro.mannlib.cornell.edu/vitro/tags/PropertyEditLink" prefix="edLnk" %> + <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Portal" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> @@ -21,6 +22,11 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VClassDao" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> +<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %> + <%@ page import="java.util.Collection" %> <%@ page import="java.util.Collections" %> <%@ page import="java.util.Comparator" %> @@ -28,10 +34,10 @@ <%@ page import="java.util.ArrayList" %> <%@ page import="java.util.Iterator" %> <%@ page import="java.util.HashSet" %> + <%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.LogFactory" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> -<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %> + <%! public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.templates.entity.entityMergedPropsList.jsp"); @@ -65,6 +71,8 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp. WebappDaoFactory wdf = vreq.getWebappDaoFactory(); PropertyGroupDao pgDao = wdf.getPropertyGroupDao(); + VClassDao vcDao = wdf.getVClassDao(); + ArrayList propsList = (ArrayList) request.getAttribute("mergedList"); for (Property p : propsList) {%> @@ -182,12 +190,27 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp. + + <% + // Make this a method of some object: Individual or ...? + String customShortView = null; + Individual object = ((ObjectPropertyStatement)request.getAttribute("opStmt")).getObject(); + List vclasses = object.getVClasses(); + + vclassLoop: for (VClass vclass : vclasses) { + String vclassUri = vclass.getURI(); + List superClassUris = vcDao.getAllSuperClassURIs(vclassUri); + for (String superClassUri : superClassUris) { + VClass cl = vcDao.getVClassByURI(superClassUri); + customShortView = cl.getCustomShortView(); + if (customShortView != null) { + break vclassLoop; + } + } + } + %> - - - - - +