cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Evans <jon.ev...@misgl.com>
Subject Re: CachingURICoplet and Flowscript / CForms
Date Fri, 26 Mar 2004 12:27:38 GMT
Hi Carsten,

On 26 Mar 2004, at 09:23, Carsten Ziegeler wrote:

> This requires a little bit of code, have a look at the
>  AbstractCopletTransformer,
> there you'll find the getCopletInstanceData(String) method. If you 
> pass in
>  null as the id into this method, you get the current coplet instance 
> data
> (= this.coplet). So you simply have to copy that code to your flow 
> script.

Not being overly familiar with the internal workings of cocoon, I'm 
having a severe case of can't-get-there-from-here.

AbstractCopletTransformer. getCopletInstanceData() starts off with:

final Map context = 
(Map)objectModel.get(ObjectModelHelper.PARENT_CONTEXT);

So, I need the objectModel in my flowscript.

FOM_Cocoon does have a getObjectModel() method, but it's not available 
from flow.  I added a jsGet version of it:

     public Map jsGet_objectmodel() {
         return getObjectModel();
     }

So now in my flowscript I can call 
cocoon.objectmodel.get(ObjectModelHelper.PARENT_CONTEXT);

However that just returns null.

The code in AbstractCopletTransformer catches the case where the Map is 
null, and looks for the coplet id as a parameter.  But I wanted to 
avoid hard-coding the coplet id because I wanted some generic flow code 
that would work whatever the current coplet happens to be.

I started writing a subclass of FOM_Cocoon that would also have a 
coplet method returning the CopletInstanceData for the current coplet, 
but it wasn't clear to me how to do it.  I can't extend the internal 
class CallContext, so I can't add anything in there.

So again I am out of ideas. :-(

Thanks for your help so far,

Jon


Mime
View raw message