Class ModificationDate


  • @ProviderType
    public final class ModificationDate
    extends java.lang.Object
    Contains static utility methods to find the last modification date of one or multiple resources
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static @Nullable java.util.Date get​(@Nullable com.day.cq.wcm.api.Page page)
      Get modification date of page
      static @Nullable java.util.Date get​(@Nullable org.apache.sling.api.resource.Resource resource)
      Looks for either jcr:lastModified or cq:lastModified property in the given resource, which can be either the jcr:content-ode of a cq-page, or a rendition node
      static @Nullable java.util.Date mostRecent​(@NotNull ModificationDateProvider @NotNull ... dateProviders)
      Finds the most recent modification date from a ModificationDateProvider and multiple additional resources
      static @Nullable java.util.Date mostRecent​(@Nullable com.day.cq.wcm.api.Page @NotNull ... pages)
      Finds the most recent modification date of all specified pages
      static @Nullable java.util.Date mostRecent​(@Nullable org.apache.sling.api.resource.Resource @NotNull ... resources)
      Finds the most recent modification date of all specified resources
      static @Nullable java.util.Date mostRecent​(java.util.Date @NotNull ... dates)
      Returns the most recent of the specified dates
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • get

        @Nullable
        public static @Nullable java.util.Date get​(@Nullable
                                                   @Nullable com.day.cq.wcm.api.Page page)
        Get modification date of page
        Parameters:
        page - CQ page
        Returns:
        Modification date or null if none set
      • get

        @Nullable
        public static @Nullable java.util.Date get​(@Nullable
                                                   @Nullable org.apache.sling.api.resource.Resource resource)
        Looks for either jcr:lastModified or cq:lastModified property in the given resource, which can be either the jcr:content-ode of a cq-page, or a rendition node
        Parameters:
        resource - a resource with a cq:lastModified property *and/or* a file/jcr:content subnode with a jcr:lastModified property
        Returns:
        the date or null if last modified property could not be found
      • mostRecent

        @Nullable
        public static @Nullable java.util.Date mostRecent​(@Nullable
                                                          @Nullable org.apache.sling.api.resource.Resource @NotNull ... resources)
        Finds the most recent modification date of all specified resources
        Parameters:
        resources - multiple resources (typically jcr:content nodes of cq-pages or rendition resources)
        Returns:
        the most recent date (or null if none of the resources has a modification date)
      • mostRecent

        @Nullable
        public static @Nullable java.util.Date mostRecent​(@Nullable
                                                          @Nullable com.day.cq.wcm.api.Page @NotNull ... pages)
        Finds the most recent modification date of all specified pages
        Parameters:
        pages - multiple cq pages
        Returns:
        the most recent date (or null if none of the pages has a modification date)
      • mostRecent

        @Nullable
        public static @Nullable java.util.Date mostRecent​(@NotNull
                                                          @NotNull ModificationDateProvider @NotNull ... dateProviders)
        Finds the most recent modification date from a ModificationDateProvider and multiple additional resources
        Parameters:
        dateProviders - Multiple modification date providers
        Returns:
        the most recent modification date (or null if none of the objects has a modification date)
      • mostRecent

        @Nullable
        public static @Nullable java.util.Date mostRecent​(java.util.Date @NotNull ... dates)
        Returns the most recent of the specified dates
        Parameters:
        dates - Dates
        Returns:
        the most recent (or null if all dates were null)