You know what? You're right. My description below was wrong. What I should have said is that I created a simple _JavaScript_ database API that can be used to implement business objects in JavaScript. This really has nothing to do with the "flow" layer per se, which is about controlling page flow. Instead, it aims to satisfy the niche that Sylvain identified and allow non-Java, non-O/R experts, a rapid development tool to also program business objects that can used by the Cocoon flow and presentation layers.

For example, if I were writing a "Petstore" application I could program both the business layer, and flow layer in JavaScript. For the business layer I might define a business object like this:

    function PetStore(poolId) {
        this.poolId = poolId;
    }

PetStore.prototype.getProductListByCategory = function(key,
skipResults, maxResults) {
var conn = cocoon.getConnection(this.poolId);
var result = conn.query("select * from PRODUCT where CATEGORY = " + key,
skipResults, maxResults);
conn.close();
return result;
}


// etc...


And for the flow layer I might write code like this:


var petStore = new Petstore(...);


function viewCategory() { var categoryId = cocoon.request.get("categoryId"); var skipResults = 0; var maxResults = 10; do { var productList = petStore.getProductListByCategory(categoryId, skipResults, maxResults); skipResults += productList.rowCount; sendPageAndWait("view/Category.xml", {productList: productList}); } while (productList.limitedByMaxRows); }

// etc ...


I believe if used properly this can still provide the correct SOC. What do you think?


Regards,

Chris

Gianugo Rabellino wrote:
Christopher Oliver wrote:

I've just committed [experimental] changes that provide a simple database API for the Cocoon flow layer modeled after JSTL


[...]


Let me know what you think.



OK, first of all I must confess that I have little or no experience with the flow, so probably I should just shut up and let you guys proceed with your impressive work, eagerly waiting to have some time to catch up and join the party.


This said, I just wanted to share a couple of "belly thoughts", since the recent additions to the flow are ringing a bell in my head, and I start getting a bit puzzled. One of the first concerns we had when we started talking about flow was about people abusing it and how to stop them. The answer has always been that the flow would have played the role of "pure glue", providing, well, flow control and little more: in particular it was take for granted that the business objects would have been outside of the flow scope.




Reply via email to