You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Derek Hohls <dh...@csir.co.za> on 2005/10/07 08:17:33 UTC
CForms / Flow + database actions?
Is it possible to combine the CForms / Flow combination
with the "old style" database actions; or is the only way to
interact with a database, with this combination, via custom
written beans and data access layers (all of which *have* to
be in Java - e.g. see an earlier post where I asked about the
option of using Groovy to create code for Cocoon).
Any examples of solutions to prove me wrong would be
welcome!
Thanks
Derek
--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
HelpDesk@csir.co.za.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForms / Flow + database actions?
Posted by Sylvain Wallez <sy...@apache.org>.
Bertrand Delacretaz wrote:
> Le 7 oct. 05, à 15:31, Upayavira a écrit :
>
>> ...I believe there are some new ways being played with for database
>> access in cforms. Using jdbi (I believe). Hopefully we'll hear more
>> soon...
>
>
> I believe I've seen it, actually...so yes, we hope to hear more soon ;-)
Yup. This is something I'm working on for my current project and which
should land this week in the SVN.
Basically, JDBI allows to access JDBC using List and Map rather than
ResultSet, and I added List and Map implementations that wrap a CForms
repeater and container, respectively.
This allows to write things like:
var form = new Form("myform.xml");
// Get a Map view on the form
var formMap = form.asMap();
// Load a Map representing a customer from the database
var customer = jdbi.query("select * from customer where id = :id", { id:
cocoon.request.getParameter("id") });
// Fill the form
formMap.putAll(customer);
form.showForm("viewform");
if (form.isValid) {
// Update customer
jdbi.update("update customer set name = :name, email = :email where
id = :id", formMap);
}
Et voilà: for simple CRUD needs, direct mapping from database table to
form without complex O/R mapping tools.
Sylvain
--
Sylvain Wallez Anyware Technologies
http://people.apache.org/~sylvain http://www.anyware-tech.com
Apache Software Foundation Member Research & Technology Director
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForms / Flow + database actions?
Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 7 oct. 05, à 15:31, Upayavira a écrit :
> ...I believe there are some new ways being played with for database
> access in cforms. Using jdbi (I believe). Hopefully we'll hear more
> soon...
I believe I've seen it, actually...so yes, we hope to hear more soon ;-)
-Bertrand
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForms / Flow + database actions?
Posted by Upayavira <uv...@odoko.co.uk>.
Jason Johnston wrote:
> Derek Hohls wrote:
>
>> Is it possible to combine the CForms / Flow combination
>> with the "old style" database actions; or is the only way to
>> interact with a database, with this combination, via custom
>> written beans and data access layers (all of which *have* to
>> be in Java - e.g. see an earlier post where I asked about the
>> option of using Groovy to create code for Cocoon).
>
>
> If you *really* want to do it, you should be able to write your data
> access layer in JavaScript. I'm sure Groovy makes some things
> (overloaded methods, creating arrays, etc.) easier, but AFAIK there
> isn't anything that *can't* be scripted in JS.
>
> In terms of the database actions... you'd have to call into a pipeline
> to execute the action, right? But I assume you don't want to have to do
> that in a sendPage() call, i.e. you want to be able to just call the
> action and continue your flow. You might be able to do that with
> processPipelineTo().
I believe there are some new ways being played with for database access
in cforms. Using jdbi (I believe). Hopefully we'll hear more soon...
Regards, Upayavira
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForms / Flow + database actions?
Posted by Jason Johnston <co...@lojjic.net>.
Derek Hohls wrote:
> Is it possible to combine the CForms / Flow combination
> with the "old style" database actions; or is the only way to
> interact with a database, with this combination, via custom
> written beans and data access layers (all of which *have* to
> be in Java - e.g. see an earlier post where I asked about the
> option of using Groovy to create code for Cocoon).
If you *really* want to do it, you should be able to write your data
access layer in JavaScript. I'm sure Groovy makes some things
(overloaded methods, creating arrays, etc.) easier, but AFAIK there
isn't anything that *can't* be scripted in JS.
In terms of the database actions... you'd have to call into a pipeline
to execute the action, right? But I assume you don't want to have to do
that in a sendPage() call, i.e. you want to be able to just call the
action and continue your flow. You might be able to do that with
processPipelineTo().
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org