Mario Ivankovits wrote:
Mike Kienenberger wrote:
On 11/28/05, Simon Kitching <[EMAIL PROTECTED]> wrote:
The issue is that DataPage is something that the business tier needs to
deal with. And business tier code (eg EJBs) really should not be
returning objects descended from a JSF implementation.

In my opinion, a sub list model doesn't have use-cases outside of a
presentation framework.  I see such a class as more of an adaptor than
as something you'd have in your business layer.
I think you are right.
The chances to have a DataModel like structure in your business logic is more likely than to have a "paging" DataModel.

(No, I dont use DataModel in my bussiness logic, I just wanted to express how thin the layer between e.g. ListDataModel and java.util.List is)

I don't quite follow either of you. Probably we're all saying the same thing, just using different terminology. However just to clarify:

In order to implement "paging" at the presentation level without loading the entire dataset in memory, the business tier must also support "paging" in some manner, ie must provide methods that take first/numrows parameters and return the specified subset of available data plus information about the number of available rows.

And because Java only allows one return value from a method (unlike, for example, Perl which can return tuples) the business method needs to return some object that has both listOfData and dataSetSize fields. That's exactly what the DataPage class already encapsulates, so it makes sense for the business tier to return actual instances of DataPage. But that can't happen if DataPage is org.apache.myfaces.something.DataPage, because having a compiletime dependency between a business object and a class from a UI library is a bad idea.

However if DataPage or an equivalent was part of a non-ui library like commons-collections then this might be acceptable.

A DataModel is definitely not a Business tier concept IMHO because it deals with "current index" which is purely a UI concept.

Regards,

Simon

Reply via email to