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.
This commit is contained in:
mbarbier 2011-03-31 16:07:14 +00:00
parent 09af317822
commit defae26bf1
4 changed files with 20 additions and 0 deletions

View file

@ -165,4 +165,6 @@ public interface Individual extends ResourceBean, VitroTimeWindowedResource, Com
Float getSearchBoost(); Float getSearchBoost();
void setSearchBoost( Float boost ); void setSearchBoost( Float boost );
Individual getBaseIndividual();
} }

View file

@ -505,4 +505,9 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
public boolean hasThumb() { public boolean hasThumb() {
return getThumbUrl() != null && ! getThumbUrl().isEmpty(); return getThumbUrl() != null && ! getThumbUrl().isEmpty();
} }
@Override
public Individual getBaseIndividual() {
return this;
}
} }

View file

@ -652,4 +652,10 @@ public class IndividualFiltering implements Individual {
public boolean hasThumb() { public boolean hasThumb() {
return _innerIndividual.hasThumb(); return _innerIndividual.hasThumb();
} }
@Override
public Individual getBaseIndividual() {
return _innerIndividual.getBaseIndividual();
}
} }

View file

@ -29,6 +29,7 @@ public abstract class BaseIndividualTemplateModel extends BaseTemplateModel {
protected VitroRequest vreq; protected VitroRequest vreq;
protected UrlBuilder urlBuilder; protected UrlBuilder urlBuilder;
protected GroupedPropertyList propertyList = null; protected GroupedPropertyList propertyList = null;
protected GroupedPropertyList fullPropertyList = null;
protected LoginStatusBean loginStatusBean = null; protected LoginStatusBean loginStatusBean = null;
private EditingPolicyHelper policyHelper = null; private EditingPolicyHelper policyHelper = null;
@ -113,6 +114,12 @@ public abstract class BaseIndividualTemplateModel extends BaseTemplateModel {
} }
return propertyList; return propertyList;
} }
public GroupedPropertyList getFullPropertyList() {
if (fullPropertyList == null) {
fullPropertyList = new GroupedPropertyList(individual.getBaseIndividual(), vreq, policyHelper); //get individual without filtering
}
return fullPropertyList;
}
public boolean isEditable() { public boolean isEditable() {
// RY This will be improved later. What is important is not whether the user is a self-editor, // RY This will be improved later. What is important is not whether the user is a self-editor,