From 28a834d6d07d9d7ac32d043cda0a9ea3e9c5b7f1 Mon Sep 17 00:00:00 2001 From: Graham Triggs Date: Wed, 25 May 2016 20:59:47 +0100 Subject: [PATCH] [VIVO-1245] Cleanup IndividualJsonWrapper --- .../individuallist/IndividualJsonWrapper.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualJsonWrapper.java b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualJsonWrapper.java index 1fda3985a..0fa24e252 100644 --- a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualJsonWrapper.java +++ b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualJsonWrapper.java @@ -20,6 +20,12 @@ import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; * This will be overridden in VIVO so we can have more info in the display. */ public class IndividualJsonWrapper { + private static AddJSONFields addJSONFields = null; + + public static void setAddJSONFields(AddJSONFields add) { + addJSONFields = add; + } + static JSONObject packageIndividualAsJson(VitroRequest vreq, Individual ind) throws JSONException { // need an unfiltered dao to get firstnames and lastnames @@ -33,6 +39,9 @@ public class IndividualJsonWrapper { jo.put("imageUrl", ind.getImageUrl()); jo.put("profileUrl", UrlBuilder.getIndividualProfileUrl(ind, vreq)); jo.put("mostSpecificTypes", getMostSpecificTypes(ind, fullWdf)); + if (addJSONFields != null) { + addJSONFields.add(jo, vreq, ind); + } return jo; } @@ -45,4 +54,7 @@ public class IndividualJsonWrapper { return mostSpecificTypes.values(); } + public interface AddJSONFields { + public void add(JSONObject jo, VitroRequest vreq, Individual ind) throws JSONException; + } }