org.rometools.feed.module.sle
Class SleUtility

java.lang.Object
  extended by org.rometools.feed.module.sle.SleUtility

public class SleUtility
extends Object

This is a utiltiy class for grouping and sorting lists of entries based on the SLE.

Note, this class can ONLY be used on parsed feeds, unless you manually add the appropriate SleEntry objects on the items.

Author:
Robert "kebernet" Cooper
See Also:
SleEntry

Method Summary
static List group(List values, Group[] groups)
          Groups values by the groups from the SLE.
static void initializeForSorting(com.sun.syndication.feed.synd.SyndFeed feed)
          This method will take a SyndFeed object with a SimpleListExtension on it and populate the entries with current SleEntry values for sorting and grouping.
static List sort(List values, Sort sort, boolean ascending)
          Sorts a list of values based on a given sort field using a selection sort.
static List sortAndGroup(List values, Group[] groups, Sort sort, boolean ascending)
          Sorts and groups a set of entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

group

public static List group(List values,
                         Group[] groups)
Groups values by the groups from the SLE.

Parameters:
values - List of Extendable implementations to group.
groups - Group fields (from the SimpleListExtension module)
Returns:
Grouped list of entries.

sort

public static List sort(List values,
                        Sort sort,
                        boolean ascending)
Sorts a list of values based on a given sort field using a selection sort.

Parameters:
values - List of values (implements Extendable) to sort.
sort - The sort field to sort on.
ascending - Sort ascending/descending.
Returns:
Sorted list of values

sortAndGroup

public static List sortAndGroup(List values,
                                Group[] groups,
                                Sort sort,
                                boolean ascending)
Sorts and groups a set of entries.

Parameters:
values - List of Extendable implementations.
groups - Group items to group by.
sort - Field to sort on.
ascending - Sort ascending/descending
Returns:
Grouped and sorted list of entries.

initializeForSorting

public static void initializeForSorting(com.sun.syndication.feed.synd.SyndFeed feed)
                                 throws com.sun.syndication.io.FeedException
This method will take a SyndFeed object with a SimpleListExtension on it and populate the entries with current SleEntry values for sorting and grouping. NB: This basically does this by re-generating the XML for all the entries then re-parsing them into the SLE data structures. It is a very heavy operation and should not be called frequently!

Throws:
com.sun.syndication.io.FeedException


Copyright © 2013 ROME Project. All Rights Reserved.