Derek Hohls wrote:

<!-- delete one user -->
<map:act type="req-params">
  <map:parameter name="parameters" value="del-user user.uid"/>
  <map:act type="mod-db-del">
    <map:parameter name="table-set" value="user"/>
  </map:act>
</map:act>

This approach means that for each new table or table group you need to create a new set of entries in the sitemap. I was
wondering if it is possible to set up a handling mechanism where the number of tables (and their various keys) are NOT
known in advance. Perhaps something that looks like:



<map:match pattern="add/*"> <map:act type="mod-db-add"> <map:parameter name="table-set" value="{1}"/> </map:act> </map:match>

where * would be the name of the table-set involved,
BUT - I am not sure how and where to define what request parameters need to get handled - if any?

Derek, the sample does not do validation. The only thing it does is to check whether some required parameters are present. To make it very simple and not distract from demonstrating the database actions, I have chosen to just check the presence using the above action.

A very similar result could have been achieved by using a constraint-set
with the same name as the table-set and just check for not-null of the
parameters. Please note that the form validation action has very limited
support to refer to another parameter definition.

Please note as well, that it is possible to merge validation descriptor
and datbase descriptor in one file.

To make it even more comfortable, one could think about creating the
validation descriptor automatically by applying an XSLT to the database
descriptor and setting not-null for all keys and checks based on the
datatype for all attributes.

Given that, you could do

<map:match pattern="add/*">
<map:act type="formval">
<map:parameter name="constraint-set" value="{1}"/>
<map:parameter name="descriptor" value="cocoon:/form-descriptor/{1}"/>
<map:act type="mod-db-add">
<map:parameter name="table-set" value="{../1}"/>
<map:parameter name="descriptor" value="cocoon:/db-descriptor/{../1}"/>
</map:act>
</map:act>
</map:match>



<map:match pattern="form-descriptor/*"> <map:generate src="cocoon:/db-descriptor/{1}"/> <map:transform src="database2formval.xsl"/> <!-- to be written --> <map:serialize type="xml"/> </map:match>


<map:match pattern="db-descriptor/*"> <map:generate src="{1}.xml"/> <map:serialize type="xml"/> </map:match>

In addition, you might want to look into eg Druid IIRC
http://druid.sf.net to generate the database descriptor from JDBC
metadata.

HTH
        Chris.

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



Reply via email to