Class ModificationDate

java.lang.Object
io.wcm.wcm.commons.caching.ModificationDate

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

    Modifier and Type
    Method
    Description
    static @Nullable Date
    get(@Nullable com.day.cq.wcm.api.Page page)
    Get modification date of page
    static @Nullable 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 Date
    mostRecent(@Nullable com.day.cq.wcm.api.Page @NotNull ... pages)
    Finds the most recent modification date of all specified pages
    static @Nullable Date
    mostRecent(@NotNull ModificationDateProvider @NotNull ... dateProviders)
    Finds the most recent modification date from a ModificationDateProvider and multiple additional resources
    static @Nullable Date
    mostRecent(Date @NotNull ... dates)
    Returns the most recent of the specified dates
    static @Nullable Date
    mostRecent(@Nullable org.apache.sling.api.resource.Resource @NotNull ... resources)
    Finds the most recent modification date of all specified resources

    Methods inherited from class java.lang.Object

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

    • get

      @Nullable public static @Nullable 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 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 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 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 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 Date mostRecent(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)