From defae26bf1dbc846fe6e2e9a48d22983f9307fa2 Mon Sep 17 00:00:00 2001 From: mbarbier Date: Thu, 31 Mar 2011 16:07:14 +0000 Subject: [PATCH] Provide access to the complete set of properties in FreeMarker templates, by putting a fullPropertyList in BaseIndividualTemplateModel. This is done by bypassing filtering. Individual.java: proved getBaseIndividual() method. --- .../edu/cornell/mannlib/vitro/webapp/beans/Individual.java | 2 ++ .../cornell/mannlib/vitro/webapp/beans/IndividualImpl.java | 5 +++++ .../vitro/webapp/dao/filtering/IndividualFiltering.java | 6 ++++++ .../individual/BaseIndividualTemplateModel.java | 7 +++++++ 4 files changed, 20 insertions(+) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/Individual.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/Individual.java index 7fd075d3e..27479f323 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/Individual.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/Individual.java @@ -165,4 +165,6 @@ public interface Individual extends ResourceBean, VitroTimeWindowedResource, Com Float getSearchBoost(); void setSearchBoost( Float boost ); + + Individual getBaseIndividual(); } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/IndividualImpl.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/IndividualImpl.java index c6fd97c76..f5ee0534e 100755 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/IndividualImpl.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/IndividualImpl.java @@ -505,4 +505,9 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp public boolean hasThumb() { return getThumbUrl() != null && ! getThumbUrl().isEmpty(); } + + @Override + public Individual getBaseIndividual() { + return this; + } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/IndividualFiltering.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/IndividualFiltering.java index f7129554f..c6c63a7fd 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/IndividualFiltering.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/IndividualFiltering.java @@ -652,4 +652,10 @@ public class IndividualFiltering implements Individual { public boolean hasThumb() { return _innerIndividual.hasThumb(); } + + + @Override + public Individual getBaseIndividual() { + return _innerIndividual.getBaseIndividual(); + } } \ No newline at end of file diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/BaseIndividualTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/BaseIndividualTemplateModel.java index f12736ddd..0a3552f40 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/BaseIndividualTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/BaseIndividualTemplateModel.java @@ -29,6 +29,7 @@ public abstract class BaseIndividualTemplateModel extends BaseTemplateModel { protected VitroRequest vreq; protected UrlBuilder urlBuilder; protected GroupedPropertyList propertyList = null; + protected GroupedPropertyList fullPropertyList = null; protected LoginStatusBean loginStatusBean = null; private EditingPolicyHelper policyHelper = null; @@ -113,6 +114,12 @@ public abstract class BaseIndividualTemplateModel extends BaseTemplateModel { } return propertyList; } + public GroupedPropertyList getFullPropertyList() { + if (fullPropertyList == null) { + fullPropertyList = new GroupedPropertyList(individual.getBaseIndividual(), vreq, policyHelper); //get individual without filtering + } + return fullPropertyList; + } public boolean isEditable() { // RY This will be improved later. What is important is not whether the user is a self-editor,