Hello, I am trying to process documents fields before feeding the results to page model api. For example, let’s say I have a class NewsDocument for which I have the getters and setters
1. class NewsDocument extends BaseDocument{
2. private String title;
3. public String getTitle(){
4. if(title !=null{
5. return title;
6. }
7. return getProperty(“mynamespace:title”);
8. }
** public void setTitle(String value){**
9. title = value;
10. }
11. }
and in my component I get an object of that document and try to process data
1. NewsDocument document = …
2. String newTitle = document.getTitle().replaceAll(“foo”,“bar”);
3. document.setTitle(newTitle)…
The ideal case would be to actually return the title, but I am always getting null . The only way of getting documents fields so far is by creating in my component class a HippoBean object on which I am fetching a child HippoBean with the relative path:
HippoBean bean1 = request.getRequestContext().getSiteContentBaseBean().getBean(articleHeader.getArticleHeaderDocument());
Then, using bean1.getProperties() I am able to retrieve the entire properties for that particular document used.
My question is, what can I do to retrieve those properties using the first way ? Am I missing a step ?
Thank you