Hi ALL!

I've been working and testing cocoon for about 3 weeks ... after some simple
examples i started some more complex stuff ..

Right now i´m trying to understand the proper way to work with modular
actions ..

so imagine this ...

One table, SIGLAS, is the main information table, it consists of 5 columns
ID, SIGLA, DOM_REF, DESC_REF, QUEM_REF. There are also 3 tables,
SIGLAS_DOMINIOS, SIGLAS_DESCRICOES, SIGLAS_QUEM, with the following columns
ID, NAME. The columns DOM_REF, DESC_REF, QUEM_REF hold a foreign key to the
3 tables mentioned before (to the column ID of course).

So my descriptor file is something like ..

<sigla>
<connection>personnel</connection>
<table name="SIGLAS_DOMINIOS">
<keys>
<key name="ID" type="int" autoincrement="true">
<mode name="auto" type="autoincr"/>
</key>
</keys>
<values>
<value name="NOME" type="string"/>
</values>
</table>
<table name="SIGLAS_DESCRICOES">
<keys>
<key name="ID" type="int" autoincrement="true">
<mode name="auto" type="autoincr"/>
</key>
</keys>
<values>
<value name="DESCRICAO" type="string"/>
</values>
</table>
<table name="SIGLAS_QUEM">
<keys>
<key name="ID" type="int" autoincrement="true">
<mode name="auto" type="autoincr"/>
</key>
</keys>
<values>
<value name="NOME" type="string"/>
</values>
</table>
<table name="SIGLAS">
<keys>
<key name="ID" type="int" autoincrement="true">
<mode name="auto" type="autoincr"/>
</key>
</keys>
<values>
<value name="NOME" type="string"/>
<value name="DOM_REF" type="int">
<mode name="request" parameter="SIGLAS_DOMINIOS.ID" type="request"/>
<mode name="attribute"
parameter="org.apache.cocoon.components.modules.output.OutputModule:SIGLAS_D
OMINIOS.ID[0]" type="attrib"/>
</value>
<value name="DESC_REF" type="int">
<mode name="request" parameter="SIGLAS_DESCRICOES.ID" type="request"/>
<mode name="attribute"
parameter="org.apache.cocoon.components.modules.output.OutputModule:SIGLAS_D
ESCRICOES.ID[0]" type="attrib"/>
</value>
<value name="QUEM_REF" type="int">
<mode name="request" parameter="SIGLAS_QUEM.ID" type="request"/>
<mode name="attribute"
parameter="org.apache.cocoon.components.modules.output.OutputModule:SIGLAS_Q
UEM.ID[0]" type="attrib"/>
</value>
</values>
</table>
<table-set name="all-dominios">
<table name="SIGLAS_DOMINIOS"/>
</table-set>
<table-set name="all-descricoes">
<table name="SIGLAS_DESCRICOES"/>
</table-set>
<table-set name="all-quem">
<table name="SIGLAS_QUEM"/>
</table-set>
<table-set name="add-siglas">
<table name="SIGLAS" others-mode="attrib"/>
</table-set>

And my problem is something like this .. i've got a ADD_PAGE in which you
can add stuff on the main table, but you can also add of refer stuff from
the other tables (through a SELECT field) SIGLAS_DOMINIOS,
SIGLAS_DESCRICOES, SIGLAS_QUEM.

I've got only one action on the page and my execution should be something
like this ..

- if its a new SIGLAS_DOMINIO value then add it ..
- if its a new SIGLAS_DESCRICOES value then add it ..
- if its a new SIGLAS_QUEM value then add it ..
- at last add to the SIGLAS table considering the new or existing ID's from
the other tables.

Ok, so i'm trying to do it all in a action set .. like this ..

(Only a part of sitemap )
--- sitemap ---

<map:action-sets>
    <map:action-set name="addSigla">
        <map:act type="req-params">
                <map:parameter name="parameters" value="add-sigla
SIGLAS_DOMINIOS.NOME"/>
                <map:act type="siglaAdd">
                    <map:parameter name="table-set" value="all-dominios"/>
                </map:act>
        </map:act>

        <map:act type="req-params">
            <map:parameter name="parameters" value="add-sigla
SIGLAS_DESCRICOES.DESCRICAO"/>
            <map:act type="siglaAdd">
                <map:parameter name="table-set" value="all-descricoes"/>
            </map:act>
         </map:act>

    <map:act type="req-params">
        <map:parameter name="parameters" value="add-sigla
SIGLAS_QUEM.NOME"/>
        <map:act type="siglaAdd">
            <map:parameter name="table-set" value="all-quem"/>
        </map:act>
    </map:act>

    <map:act type="siglaAdd">
        <map:parameter name="table-set" value="add-siglas"/>
    </map:act>

    </map:action-set>
</map:action-sets>

<map:pipelines>
<map:pipeline>
<map:match pattern="processa-siglas">
<map:act set="addSigla">
<map:generate src="documents/list-siglas.xsp" type="serverpages"/>
<map:transform src="stylesheets/simple.xsl"/>
<map:serialize/>
</map:act>
</map:match>
--- sitemap ---

So my BIG problem is how to do this?

Must i declare a table-set for each operation combination ? (like DOM as
foreign key but DESC has not, and so on ..)

If i use a mode like "attrib", i'm using it for all the foreign keys .. i
want to get the ID by a request attribute only on from the tables i inserted
before. The ones i selected (not added) are just on the request parameter !

How can i do this in ONE request ?

Is there any "ConvertAllRequestParametersToRequestAttributes" action ?

I've come to the conclusion it is faster to write some logic on a couple of
XSP's than to use the actions this way.

Thanks in advance to any help !

(Hit me if i'm saying something really stupid :) .. and sorry about the
typos .. )

[--] Rui Pedro Leal
[--] [EMAIL PROTECTED]
[--] [EMAIL PROTECTED]
[--] ICQ: 318173


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to