On Monday, Feb 3, 2003, at 14:28 Europe/London, Ugo Cei wrote:

It goes something like this (this is a flowscript fragment for retrieving a business entity, having "id" as it's POID [1], into a bean, associating it with a form, posting it to the user, awaiting submission, validating and storing):

session = sessionFactory.openSession();
var entity = new BusinessEntity();
session.load(entity, id);
session.close();
var form = getForm("entity-form", entity, "context://flows/workflow-schema.xml");
while (true) {
form.save(cocoon.environment.getObjectModel(), "request");
sendPageAndWait("entity-form", {});
form.populate(cocoon.environment.getObjectModel());
form.validate("phase");
if (form.getViolations() != null && form.getViolations().size() > 0) {
continue;
}
break;
}
session = sessionFactory.openSession();
session.saveOrUpdate(entity);
session.flush();
session.close();

Dear Ugo,

I have been writing the text below to try explain to a colleague how your sample FlowScript works, while we try to work out which technique to use for our own editing issues.

Would you mind having a look over it to see if I understand properly?
Incidentally, is getForm() your own method? I cannot find it ....


XForm + Flow:
* your URL requesting to edit some data in an SQLDB, is mapped by the Cocoon's Sitemap to call your 'edit' FlowScript method, providing it with the 'id' of the data you want to edit, the 'class' of JavaBean to hold it and the 'src' of the Validation Schema to use.
* 'edit' instantiates a new Bean of 'class' filling it with the data you want to edit, from the 'Object Persistence' layer, using the 'id'.
* This 'Object Persistence' layer (something like 'Hibernate', 'Apache OJB', 'Sun's JDO' etc.), uses an XML file that maps Bean Properties to SQL Tables and Columns. (???? how is this set up ????)
* 'edit' instantiates a new Form Object using the Bean as the Model and the 'src' as the Schema.
* [start-loop] 'edit' puts this Form into the Request, then calls a Pipeline in the Sitemap to send a Response back to the user using this Request, meanwhile waiting for the HTML Form to be posted back in a new Request. This is a Continuation.
* the Pipeline that is called, while 'edit' is waiting, generates an XForm, which represents the editing interface for the user.
* the XForm is transformed by the XFormTransformer, which fills the XForm, using XPath expressions in the XForm fields, with the data from the Bean in Form in the Request.
* the XForm is transformed by XSLT into HTML and sent to the user.
* the user edits the data in the HTML Form and submits it back to the Continuation (your waiting 'edit' FlowScript).
* the Sitemap tells 'edit' to continue where it left off with the new Request of modified form data.
* 'edit' updates the Bean with the Request data, using the RequestParameter names as XPaths. Then Validates the Bean.
* if the Validation failed, 'edit' goes back to [start-loop] above.
* if the Validation succeeded, the Bean is Persisted back to the SQL DB by the 'Object Persistence' layer.


Have I got it?
Or even anywhere close? ;)

many thanks

regards Jeremy





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



Reply via email to