[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-3120) SeamCollectionModel in Seam-Trinidad example is not handling the sorting in the most efficient way

Alex Savitsky (JIRA) jira-events at lists.jboss.org
Mon Jun 16 15:27:33 EDT 2008


     [ http://jira.jboss.com/jira/browse/JBSEAM-3120?page=all ]

Alex Savitsky updated JBSEAM-3120:
----------------------------------

    Attachment: patch.txt

This patch addresses the following:

1. In setSortCriteria, it forces the criteria to be built from the QL, before it is compared to the new criteria, so that query is not refreshed unless really necessary. Also, it removes the redundant refresh() call (implicitly called via setOrder), and stores the resulting criteria for future comparisons

2. Makes asCriteria and asQl methods static, somewhat improving the performance.

3. Rewrites asQl to use StringBuffer,rather than String addition (performance improvement)

4. Rewrites asCriteria to use statically-initialized Pattern.split instead of StringTokenizer. This allows the QL order clauses to use any amount of whitespace (even tabs and/or newlines), instead of being constrained to a single space between property name and direction. The leading and trailing whitespace aroud the order clause is now disregarded as well.

> SeamCollectionModel in Seam-Trinidad example is not handling the sorting in the most efficient way
> --------------------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-3120
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-3120
>             Project: Seam
>          Issue Type: Bug
>          Components: Examples
>    Affects Versions: 2.0.3.CR1
>            Reporter: Alex Savitsky
>            Priority: Optional
>         Attachments: patch.txt
>
>
> The way the sorting is handled in SeamCollectionModel, is not anywhere near optimal. I undernstand that this is only an example, but since people often just paste this into the real apps, it might as well be a little more polished. The way the setSortCriteria is coded up, a new query will be issued every time this method is called, as Query.setOrder triggers an automatic refresh(), which wipes out the data model in the process - thus forcing the creation of a new one, which won't have the criteria property set.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list