Class SailPointObjectDateSorter

  • All Implemented Interfaces:
    Comparator<sailpoint.object.SailPointObject>

    public final class SailPointObjectDateSorter
    extends Object
    implements Comparator<sailpoint.object.SailPointObject>
    A Comparator to sort SailPointObjects 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 Detail

      • 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 date
        includeModified - 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