[
https://issues.apache.org/jira/browse/JSPWIKI-528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12707873#action_12707873
]
Andrew Jaquith commented on JSPWIKI-528:
----------------------------------------
I reviewed and partially applied the remainder of Greg's patches. The changes
to ComtentManager, WikiEngine and several plugins I made go further than those
specified in the patches. For example, AbstractFilteredPlugin.filterCollection
now completely eliminates the need to create new wrapper collections for
containing filtered items.
Notable changes compared to Greg's patches include using Lists for return types
instead of SortedSets. For those methods that need sorted LIsts (for example,
various plugins), I have the callers use Collections.sort() instead.
Also, I chose a different idiom for the method signatures that indicate when
Lists should be sorted. Instead of creating a method
ContentManager.getAllPagesSorted( String space ) as suggested in the patch, I
created an alternate method getAllPages(String,Comparator<WikiPage>) that makes
the sort request explicit (via the Comparator) and is also customizable. In
addition, to allowed returned Lists to be sorted simply using
Collections,sort(), WikiPage now extends Comparable<WikiPage>, as does
JCRWikiPage. While these changes aren't exactly what Greg specified, they
accomplish the same goal.
Greg, thanks for putting these patches together. They were well-researched and
high quality. If the alternative fixes I've implemented don't give you exactly
what you need, let me know and we can adjust further.
> Rationalise the use of Collections, particularly with regard to pages
> ---------------------------------------------------------------------
>
> Key: JSPWIKI-528
> URL: https://issues.apache.org/jira/browse/JSPWIKI-528
> Project: JSPWiki
> Issue Type: Improvement
> Reporter: Greg Kable
> Assignee: Andrew Jaquith
> Priority: Minor
> Fix For: 3.0
>
> Attachments: jspwiki-528-AbstractFilteredPlugin.patch,
> jspwiki-528-AttachmentHandler.patch, jspwiki-528-ContentManager.patch,
> jspwiki-528-LinkCollector.patch, jspwiki-528-SearchProviders.patch,
> jspwiki-528-Weblog.patch, jspwiki-528-WikiEngine-771034.patch,
> jspwiki-528-WikiEngine.patch, jspwiki-528-WikiPage.patch,
> jspwiki-528-workflow.Step.patch
>
>
> Most of the APIs return Collection rather than a finer interface and in many
> cases these collections are repeatedly repacked and resorted unnecessarily. I
> will go through all APIs that return collections of pages and make them
> return a finer interface - probably List for unordered collections and
> SortedSet for ordered collections. This will make the use of these
> collections much clearer for further development and give us some opportunity
> for future optimisations.
> This is likely to be a very wide set of changes across lots of different
> classes so I'll submit separate patches for each class.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.