info.magnolia.module.templatingkit.util
Class STKDateContentUtil

java.lang.Object
  extended by info.magnolia.module.templatingkit.util.STKDateContentUtil

public class STKDateContentUtil
extends Object

Date Utility. Allows to sort content list based to theirs. node 'date'.

Version:
$Id$
Author:
cringele

Field Summary
static String ASCENDING
           
static String DESCENDING
           
static Object INSTANCE
           
 
Constructor Summary
STKDateContentUtil()
           
 
Method Summary
static void filterDateContentList(List<javax.jcr.Node> itemsList, Calendar minDate, Calendar maxDate)
           
static void filterDateContentList(List<javax.jcr.Node> itemsList, Calendar minDate, Calendar maxDate, String datePropertyName)
           
static void filterDateContentList(List<javax.jcr.Node> itemsList, Calendar minDate, Calendar maxDate, String datePropertyName, boolean useCreationDate)
          Filters out items (nodes) which do not meet this condition: minDate <= itemDate && itemDate < maxDate.
static void sortDateContentList(List<javax.jcr.Node> itemsList, String sortDirection)
           
static void sortDateContentList(List<javax.jcr.Node> itemsList, String sortDirection, String datePropertyName)
           
static void sortDateContentList(List<javax.jcr.Node> itemsList, String sortDirection, String datePropertyName, boolean useCreationDate, Calendar defaultDate)
          Sorts list of nodes by date.
static void sortDateContentList(List<javax.jcr.Node> itemsList, String sortDirection, String datePropertyName, Calendar defaultDate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final Object INSTANCE

ASCENDING

public static final String ASCENDING
See Also:
Constant Field Values

DESCENDING

public static final String DESCENDING
See Also:
Constant Field Values
Constructor Detail

STKDateContentUtil

public STKDateContentUtil()
Method Detail

filterDateContentList

public static void filterDateContentList(List<javax.jcr.Node> itemsList,
                                         Calendar minDate,
                                         Calendar maxDate)

filterDateContentList

public static void filterDateContentList(List<javax.jcr.Node> itemsList,
                                         Calendar minDate,
                                         Calendar maxDate,
                                         String datePropertyName)

filterDateContentList

public static void filterDateContentList(List<javax.jcr.Node> itemsList,
                                         Calendar minDate,
                                         Calendar maxDate,
                                         String datePropertyName,
                                         boolean useCreationDate)
Filters out items (nodes) which do not meet this condition: minDate <= itemDate && itemDate < maxDate.

Parameters:
itemsList - List of nodes.
minDate - Minimal date of the interval.
maxDate - Maximal date of the interval.
datePropertyName - Name of property in which is date stored.
useCreationDate - If true, then will look to MetaData for creation date and if exists, will use it as a date if no date found in property datePropertyName.

sortDateContentList

public static void sortDateContentList(List<javax.jcr.Node> itemsList,
                                       String sortDirection)

sortDateContentList

public static void sortDateContentList(List<javax.jcr.Node> itemsList,
                                       String sortDirection,
                                       String datePropertyName)

sortDateContentList

public static void sortDateContentList(List<javax.jcr.Node> itemsList,
                                       String sortDirection,
                                       String datePropertyName,
                                       Calendar defaultDate)

sortDateContentList

public static void sortDateContentList(List<javax.jcr.Node> itemsList,
                                       String sortDirection,
                                       String datePropertyName,
                                       boolean useCreationDate,
                                       Calendar defaultDate)
Sorts list of nodes by date.

Parameters:
itemsList - List of nodes.
sortDirection - Sort direction (asc, desc).
datePropertyName - Name of property in which is date stored.
useCreationDate - If true, then will look to MetaData for creation date and if exists, will use it as a date if no date found in property datePropertyName.
defaultDate - Default date used if no date in node found.


Copyright © 2008-2013 Magnolia International Ltd.. All Rights Reserved.