Package com.identityworksllc.iiq.common
Class SailPointObjectDateSorter
- java.lang.Object
-
- com.identityworksllc.iiq.common.SailPointObjectDateSorter
-
- All Implemented Interfaces:
Comparator<sailpoint.object.SailPointObject>
public final class SailPointObjectDateSorter extends Object implements Comparator<sailpoint.object.SailPointObject>
AComparator
to sortSailPointObject
s in a reliable way: first by date, and if the dates are identical, by ID.SPOs may have a null modified date, in which case the created date is checked.
IMPORTANT: Before a new SPO is saved, the values of both ‘created’ and ‘id’ will be null. Take care that this class is not used in that context.
-
-
Constructor Summary
Constructors Constructor Description SailPointObjectDateSorter()
SPO date sorter defaulting to checking modified datesSailPointObjectDateSorter(boolean includeModified)
SPO date sorter allowing you to specify whether you want to include modified dates
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(sailpoint.object.SailPointObject o1, sailpoint.object.SailPointObject o2)
static Date
latestDate(sailpoint.object.SailPointObject sailPointObject, boolean includeModified)
Returns the latest date for the given SPO, including modified if the flag is set to true.static void
sort(List<? extends sailpoint.object.SailPointObject> list)
Sorts the given list of SPOs using this comparator-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Constructor Detail
-
SailPointObjectDateSorter
public SailPointObjectDateSorter()
SPO date sorter defaulting to checking modified dates
-
SailPointObjectDateSorter
public SailPointObjectDateSorter(boolean includeModified)
SPO date sorter allowing you to specify whether you want to include modified dates- Parameters:
includeModified
- If true, use the modified date if it is set; if false, use create only
-
-
Method Detail
-
latestDate
public static Date latestDate(sailpoint.object.SailPointObject sailPointObject, boolean includeModified)
Returns the latest date for the given SPO, including modified if the flag is set to true.If the object has no created or modified date (which will happen if it’s not yet saved), returns null.
- Parameters:
sailPointObject
- The SPO to get the dateincludeModified
- If true, use the modified date if it is set; if false, use create only- Returns:
- The modified or created date, or null if none
-
sort
public static void sort(List<? extends sailpoint.object.SailPointObject> list)
Sorts the given list of SPOs using this comparator- Parameters:
list
- The list to sort
-
compare
public int compare(sailpoint.object.SailPointObject o1, sailpoint.object.SailPointObject o2)
- Specified by:
compare
in interfaceComparator<sailpoint.object.SailPointObject>
- See Also:
Comparator.compare(Object, Object)
-
-