Hi Bertrand,

2010/7/13 Bertrand Delacretaz <[email protected]>

> Hi,
>
> On Tue, Jul 13, 2010 at 10:30 AM, Federico Paparoni
> <[email protected]> wrote:
> > ...I thought that after saving the article with the related tag I can
> call a
> > new operation (defined extending SlingPostOperation) to create the node.
> But
> > I have some questions:
> >
> > 1) Is this way the "Sling way" to implement it? What are the
> alternatives?...
>
> If you need to maintain related nodes B after saving a node A, the
> recommended way with JCR is to use observation: you'll get a callback
> when A is modified, and you setup B at this point, asynchronously.
>
> There's an example of this in the samples/espblog's ThumbnailGenerator
> [1] - that component listens for modifications of nt:file nodes, and
> created thumbnails when images are saved.
>
> > 2) How can I have the UUID of the created node? I thought that it's
> possible
> > to have UUID sending the article URL to the new SlingPostOperation but I
> > don't really like this way....
>
> The JCR event handler lets you access to the modified nodes, so you
> can get their UUIDs there.
>
> -Bertrand
>
> [1]
> samples/espblog/src/main/java/org/apache/sling/samples/espblog/internal/ThumbnailGenerator.java
>

Thanks for the suggestion, I didn't think about JCR events (so there is one
less HTTP call to save the tag).
I started the implementation using SlingPostOperation, so I haven't so much
work to handle the JCR event and do the same thing.
Thanks a lot


-- 
Federico

Reply via email to