From 71ed7330d5d5eaaadd63f64f287209345c516c68 Mon Sep 17 00:00:00 2001 From: bdc34 Date: Tue, 4 Jan 2011 20:23:48 +0000 Subject: [PATCH] Adding thumbnail and profileURL to data returned by JSONServlet.java NIHVIVO-1598 NIHVIVO-1606 --- .../vitro/webapp/controller/JSONServlet.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONServlet.java index 73cbd0ac1..ea7ce7f0d 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONServlet.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONServlet.java @@ -8,6 +8,7 @@ import java.io.Writer; import java.net.HttpURLConnection; import java.net.URLEncoder; import java.util.ArrayList; +import java.util.Enumeration; import java.util.Iterator; import java.util.List; import java.util.ListIterator; @@ -32,6 +33,7 @@ import com.hp.hpl.jena.ontology.OntModel; import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.VClass; import edu.cornell.mannlib.vitro.webapp.controller.TabEntitiesController.PageRecord; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.SelectListGenerator; @@ -82,6 +84,17 @@ public class JSONServlet extends VitroHttpServlet { VClass vclass=null; JSONObject rObj = new JSONObject(); + if( log.isDebugEnabled() ){ + Enumeration e = vreq.getParameterNames(); + while(e.hasMoreElements()){ + String name = (String)e.nextElement(); + log.debug("parameter: " + name); + for( String value : vreq.getParameterValues(name) ){ + log.debug("value for " + name + ": '" + value + "'"); + } + } + } + try { String vitroClassIdStr = vreq.getParameter("vclassId"); if ( vitroClassIdStr != null && !vitroClassIdStr.isEmpty()){ @@ -113,7 +126,7 @@ public class JSONServlet extends VitroHttpServlet { rObj.put("totalCount", map.get("totalCount")); rObj.put("alpha", map.get("alpha")); - + List inds = (List)map.get("entities"); List indsTm = new ArrayList(); JSONArray jInds = new JSONArray(); @@ -121,7 +134,11 @@ public class JSONServlet extends VitroHttpServlet { JSONObject jo = new JSONObject(); jo.put("URI", ind.getURI()); jo.put("label",ind.getRdfsLabel()); - jo.put("name",ind.getName()); + jo.put("name",ind.getName()); + jo.put("thumbUrl", ind.getThumbUrl()); + jo.put("imageUrl", ind.getImageUrl()); + jo.put("profileUrl", UrlBuilder.getIndividualProfileUrl(ind, vreq.getWebappDaoFactory())); + jInds.put(jo); } rObj.put("individuals", jInds);