Dave, didn't work.
I add the method exactly as you told in the PageModel.java
Didn't worked.
Just for testing purposes I've changed it to:
public WeblogEntryDataWrapper getWeblogEntry(String anchor) {
WeblogEntryData entry = null;
try {
WeblogManager wmgr =
RollerFactory.getRoller().getWeblogManager();
entry = wmgr.getWeblogEntryByAnchor(weblog, anchor);
} catch (RollerException e) {
this.log.error("ERROR: getting entry by anchor");
}
return WeblogEntryDataWrapper.wrap(entry);
}
to be similar as getWeblogEntry() that already exists and change the Weblog
template adding the new method together with the original:
...
#if ($model.permalink)
#showWeblogEntryComments($model.weblogEntry)
<hr>
<h1>Isso chama a nova funcao</h1>
#showWeblogEntryComments($model.weblogEntry("teste"))
<hr>
#showWeblogEntryCommentForm($model.weblogEntry)
#end
...
The result is that the getWeblogEntry() was called instead
of getWeblogEntry(String anchor). I debug it and getWeblogEntry(String
anchor) is never called.
The rendered page shows the list of coments twice, so
#showWeblogEntryComments($model.weblogEntry("teste")) worked the same as
#showWeblogEntryComments($model.weblogEntry)
On 9/4/07, Dave <[EMAIL PROTECTED]> wrote:
>
> On 9/4/07, Wladimir Boton <[EMAIL PROTECTED]> wrote:
> > Thank you Richard,
> > but I didn't undestand why is this different from creating a getEntry
> method
> > as Dave suggested?
>
> Get entry is definitely not the only way to do it and Richard's
> technique may work perfectly for you.
>
> If you want to finish what I suggested and if you're OK with making a
> code change, you can add the getWeblogEntry() to the PageModel class
> yourself:
>
> /**
> * Get weblog entry specified by anchor or null if no such entry
> exists.
> * @param anchor Weblog entry anchor
> * @return Weblog entry specified by anchor
> * @roller.wrapPojoMethod type="simple"
> */
> public WeblogEntryData getWeblogEntry(String anchor) {
> WeblogEntryData entry = null;
> try {
> Roller roller = RollerFactory.getRoller();
> WeblogManager wmgr = roller.getWeblogManager();
> entry = wmgr.getWeblogEntryByAnchor(this, anchor);
> } catch (RollerException e) {
> this.log.error("ERROR: getting entry by anchor");
> }
> return entry;
> }
>
> Then you'll want to do a full rebuild to regenerate the POJO wrappers
> 'ant rebuild'
>
> - Dave
>
--
Wladimir Boton
http://www.wboton.com