Re: Export data from Lenya
Andreas Hartmann <[email protected]>
| Newsgroups | gmane.comp.cms.lenya.user |
|---|---|
| Message-ID | <[email protected]> |
Andrey Volkov schrieb:
> O, thank you, I see. I did some progress, but I have one more question.
> How should parameters be passed to csv generator?
> I describe the whole picture below.
>
> I defined a new component-instance. It ties the usecase with the pipeline.
> <component-instance logger="lenya.admin"
> name="admin.logs.export" class="ksa.usecases.Logs">
> <view uri="cocoon://modules/administration/auditlogs.csv"/>
> </component-instance>
>
> The pipeline in sitemap.xmap:
> <map:pipeline pattern="auditlogs.csv">
> <map:generate type="auditlogs" src="auditlogs"/>
> <map:serialize type="text"/>
> </map:pipeline>
>
> So, it calls 'auditlogs' generator that is defined in root's sitemap.xmap:
> <map:generator name="auditlogs" label="content,data"
> logger="sitemap.generator.auditlogs" pool-grow="2" pool-max="16"
> pool-min="2" src="ksa.generators.AuditLogsGenerator"/>
>
> So, the question is how to pass parameters from web page to the
> generator? Could someone give a piece of advice?
The easiest way is to access the request parameters directly in the
generator:
Request request = ObjectModelHelper.getRequest(objectModel);
String foo = request.getParameter("foo");
If you want to decouple the generator from the HTTP processing (SoC),
you can pass the parameters from the sitemap:
<map:generate type="auditlogs" src="auditlogs">
<map:parameter name="foo" value="{request-param:foo}"/>
</map:generate>
String fooValue = parameters.getParameter("foo");
BTW, this is rather a Cocoon-related subject than a Lenya-related one.
HTH,
-- Andreas
> Maybe there can be another way. I would be glad to hear about it.
>
> On Tue, Sep 15, 2009 at 4:03 PM, Andreas Hartmann <[email protected]
> <mailto:[email protected]>> wrote:
>
> Andrey Volkov schrieb:
>
> Could you describe in more details where I should define
> serializer and how to redirect output from a usecase to it?
>
>
> http://lenya.apache.org/docu20/reference/usecase-framework/usecase-framework-overview.html#N101BC
>
> "If you don't want to display a form, but output arbitrary XML,
> text, an SVG-generated image or something like that, you can use a
> uri attribute instead of the template attribute."
>
> In your case that would be a cocoon:// URI which calls a pipeline in
> your module that ends with the text serializer.
>
> HTH,
>
> -- Andreas
>
--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01