Merging r5308, r5320, r5322 from http://svn.mannlib.cornell.edu/svn/vitro/branches/nihvivo-rel-1.1-maint
This commit is contained in:
parent
ddae9bb311
commit
a5f60a9f7f
5 changed files with 60 additions and 55 deletions
|
@ -80,51 +80,55 @@ public class MiscWebUtils {
|
||||||
return (String) contentObj;
|
return (String) contentObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get custom short view from either the object's class or one of its
|
|
||||||
// superclasses.
|
|
||||||
// This is needed because the inference update happens asynchronously, so
|
|
||||||
// when a new
|
|
||||||
// property has been added and the page is reloaded, the custom short view
|
|
||||||
// from a
|
|
||||||
// superclass may not have been inferred yet.
|
|
||||||
public static String getCustomShortView(HttpServletRequest request) {
|
public static String getCustomShortView(HttpServletRequest request) {
|
||||||
VitroRequest vreq = new VitroRequest(request);
|
|
||||||
VClassDao vcDao = vreq.getWebappDaoFactory().getVClassDao();
|
|
||||||
|
|
||||||
String customShortView = null;
|
|
||||||
Individual object = ((ObjectPropertyStatement) request
|
Individual object = ((ObjectPropertyStatement) request
|
||||||
.getAttribute("opStmt")).getObject();
|
.getAttribute("opStmt")).getObject();
|
||||||
List<VClass> vclasses = object.getVClasses(true); // get directly
|
return getCustomShortView(object, request);
|
||||||
// asserted vclasses
|
}
|
||||||
Set<String> superClasses = new HashSet<String>();
|
|
||||||
|
|
||||||
// First try directly asserted classes, there is no useful decision
|
// Get custom short view from either the object's class or one of its
|
||||||
// mechanism for
|
// superclasses. This is needed because the inference update happens asynchronously,
|
||||||
// the case where two directly asserted classes have a custom short
|
// so when a new property has been added and the page is reloaded, the custom short view
|
||||||
// view.
|
// from a superclass may not have been inferred yet.
|
||||||
for (VClass vclass : vclasses) {
|
|
||||||
// Use this class's custom short view, if there is one
|
|
||||||
customShortView = vclass.getCustomShortView();
|
|
||||||
if (customShortView != null) {
|
|
||||||
return customShortView;
|
|
||||||
}
|
|
||||||
// Otherwise, add superclass to list of vclasses to check for custom
|
|
||||||
// short views
|
|
||||||
String vclassUri = vclass.getURI();
|
|
||||||
superClasses.addAll(vcDao.getAllSuperClassURIs(vclassUri));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Next try super classes. There is no useful decision mechanism for
|
public static String getCustomShortView(Individual individual, HttpServletRequest request) {
|
||||||
// the case where two super classes have a custom short view.
|
VitroRequest vreq = new VitroRequest(request);
|
||||||
for (String superClassUri : superClasses) {
|
VClassDao vcDao = vreq.getWebappDaoFactory().getVClassDao();
|
||||||
VClass vc = vcDao.getVClassByURI(superClassUri);
|
|
||||||
customShortView = vc.getCustomShortView();
|
String customShortView = null;
|
||||||
if (customShortView != null) {
|
List<VClass> vclasses = individual.getVClasses(true); // get directly
|
||||||
return customShortView;
|
// asserted vclasses
|
||||||
}
|
Set<String> superClasses = new HashSet<String>();
|
||||||
}
|
|
||||||
|
// First try directly asserted classes, there is no useful decision
|
||||||
|
// mechanism for the case where two directly asserted classes
|
||||||
|
// have a custom short view.
|
||||||
|
// RY If we're getting the custom short view with reference to an object property.
|
||||||
|
// should we use the property's getRangeVClass() method instead?
|
||||||
|
for (VClass vclass : vclasses) {
|
||||||
|
// Use this class's custom short view, if there is one
|
||||||
|
customShortView = vclass.getCustomShortView();
|
||||||
|
if (customShortView != null) {
|
||||||
|
return customShortView;
|
||||||
|
}
|
||||||
|
// Otherwise, add superclass to list of vclasses to check for custom
|
||||||
|
// short views
|
||||||
|
String vclassUri = vclass.getURI();
|
||||||
|
superClasses.addAll(vcDao.getAllSuperClassURIs(vclassUri));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Next try super classes. There is no useful decision mechanism for
|
||||||
|
// the case where two super classes have a custom short view.
|
||||||
|
for (String superClassUri : superClasses) {
|
||||||
|
VClass vc = vcDao.getVClassByURI(superClassUri);
|
||||||
|
customShortView = vc.getCustomShortView();
|
||||||
|
if (customShortView != null) {
|
||||||
|
return customShortView;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -432,6 +432,12 @@ public class InputElementFormattingTag extends TagSupport {
|
||||||
out.print("<input "+classStr+" "+sizeStr+" type=\"text\" id=\""+getId()+"\" name=\""+getName()+"\" value=\""+valueStr+"\" />");
|
out.print("<input "+classStr+" "+sizeStr+" type=\"text\" id=\""+getId()+"\" name=\""+getName()+"\" value=\""+valueStr+"\" />");
|
||||||
if (definitionTags) { out.print("</dd>"); }
|
if (definitionTags) { out.print("</dd>"); }
|
||||||
out.println();
|
out.println();
|
||||||
|
} else if( getType().equalsIgnoreCase("hidden")) {
|
||||||
|
String valueStr = doValue(editConfig, editSub);
|
||||||
|
if (definitionTags) { out.print("<dd>"); }
|
||||||
|
out.print("<input "+classStr+ "type=\"hidden\" id=\""+getId()+"\" name=\""+getName()+"\" value=\""+valueStr+"\" />");
|
||||||
|
if (definitionTags) { out.print("</dd>"); }
|
||||||
|
out.println();
|
||||||
} else if (getType().equalsIgnoreCase("textarea")) {
|
} else if (getType().equalsIgnoreCase("textarea")) {
|
||||||
String valueStr = doValue(editConfig, editSub);
|
String valueStr = doValue(editConfig, editSub);
|
||||||
String rowStr = doRows();
|
String rowStr = doRows();
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils" %>
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils" %>
|
||||||
<%@ page import="com.hp.hpl.jena.rdf.model.Model" %>
|
<%@ page import="com.hp.hpl.jena.rdf.model.Model" %>
|
||||||
|
<%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%>
|
||||||
|
|
||||||
<%@ page import="java.util.List" %>
|
<%@ page import="java.util.List" %>
|
||||||
|
|
||||||
|
@ -104,25 +105,18 @@ public WebappDaoFactory getUnfilteredDaoFactory() {
|
||||||
if( object == null ) {
|
if( object == null ) {
|
||||||
//log.warn("Could not find object individual "+objectUri+" via wdf.getIndividualDao().getIndividualByURI(objectUri)");
|
//log.warn("Could not find object individual "+objectUri+" via wdf.getIndividualDao().getIndividualByURI(objectUri)");
|
||||||
request.setAttribute("objectName","(name unspecified)");
|
request.setAttribute("objectName","(name unspecified)");
|
||||||
} else if (FrontEndEditingUtils.isVitroNsObjProp(predicateUri)) {
|
} else if (FrontEndEditingUtils.isVitroNsObjProp(predicateUri)) {
|
||||||
Model model = (Model)application.getAttribute("jenaOntModel");
|
Model model = (Model)application.getAttribute("jenaOntModel");
|
||||||
request.setAttribute("individual", object);
|
request.setAttribute("individual", object);
|
||||||
request.setAttribute("objectName", FrontEndEditingUtils.getVitroNsObjDisplayName(predicateUri, object, model));
|
request.setAttribute("objectName", FrontEndEditingUtils.getVitroNsObjDisplayName(predicateUri, object, model));
|
||||||
log.debug("setting object name " + (String)request.getAttribute("objectName") + " for vitro namespace object property " + predicateUri);
|
log.debug("setting object name " + (String)request.getAttribute("objectName") + " for vitro namespace object property " + predicateUri);
|
||||||
} else {
|
} else {
|
||||||
for (VClass clas : object.getVClasses()) {
|
customShortView = MiscWebUtils.getCustomShortView(object, request);
|
||||||
request.setAttribute("rangeClassName", clas.getName());
|
if (customShortView != null) {
|
||||||
foundClass = true;
|
foundClass = true;
|
||||||
customShortView = clas.getCustomShortView();
|
log.debug("setting object name from VClass custom short view");
|
||||||
|
request.setAttribute("customShortView",shortViewPrefix + customShortView.trim());
|
||||||
if (customShortView != null && customShortView.trim().length()>0) {
|
request.setAttribute("individual",object);
|
||||||
log.debug("setting object name from VClass custom short view");
|
|
||||||
request.setAttribute("customShortView",shortViewPrefix + customShortView.trim());
|
|
||||||
request.setAttribute("individual",object);
|
|
||||||
} else {
|
|
||||||
log.debug("No custom short view for class, so setting object name from object individual name");
|
|
||||||
request.setAttribute("objectName",object.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!foundClass) {
|
if (!foundClass) {
|
||||||
VClass clas = prop.getRangeVClass();
|
VClass clas = prop.getRangeVClass();
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %>
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %>
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator" %>
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator" %>
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %>
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %>
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmissionPreprocessor" %>
|
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field" %>
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field" %>
|
||||||
<%@ page import="java.io.StringReader" %>
|
<%@ page import="java.io.StringReader" %>
|
||||||
<%@ page import="java.util.*" %>
|
<%@ page import="java.util.*" %>
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %>
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %>
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
|
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
|
||||||
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %>
|
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %>
|
||||||
|
<%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%>
|
||||||
|
|
||||||
<%@ page import="java.util.Collection" %>
|
<%@ page import="java.util.Collection" %>
|
||||||
<%@ page import="java.util.Collections" %>
|
<%@ page import="java.util.Collections" %>
|
||||||
|
@ -34,13 +35,14 @@
|
||||||
<%@ page import="java.util.ArrayList" %>
|
<%@ page import="java.util.ArrayList" %>
|
||||||
<%@ page import="java.util.Iterator" %>
|
<%@ page import="java.util.Iterator" %>
|
||||||
<%@ page import="java.util.HashSet" %>
|
<%@ page import="java.util.HashSet" %>
|
||||||
|
<%@page import="java.util.LinkedList"%>
|
||||||
|
<%@page import="java.util.Set"%>
|
||||||
|
|
||||||
<%@ page import="org.apache.commons.logging.Log" %>
|
<%@ page import="org.apache.commons.logging.Log" %>
|
||||||
<%@ page import="org.apache.commons.logging.LogFactory" %>
|
<%@ page import="org.apache.commons.logging.LogFactory" %>
|
||||||
|
|
||||||
<%@page import="java.util.LinkedList"%>
|
|
||||||
<%@page import="java.util.Set"%>
|
<jsp:useBean id="loginHandler" class="edu.cornell.mannlib.vedit.beans.LoginFormBean" scope="session" />
|
||||||
<%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%><jsp:useBean id="loginHandler" class="edu.cornell.mannlib.vedit.beans.LoginFormBean" scope="session" />
|
|
||||||
<%!
|
<%!
|
||||||
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.templates.entity.entityMergedPropsList.jsp");
|
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.templates.entity.entityMergedPropsList.jsp");
|
||||||
%>
|
%>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue