Package io.wcm.wcm.commons.caching
Class ModificationDate
java.lang.Object
io.wcm.wcm.commons.caching.ModificationDate
Contains static utility methods to find the last modification date of one or multiple resources
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable Dateget(@Nullable com.day.cq.wcm.api.Page page) Get modification date of pagestatic @Nullable Dateget(@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 nodestatic @Nullable DatemostRecent(@Nullable com.day.cq.wcm.api.Page @NotNull ... pages) Finds the most recent modification date of all specified pagesstatic @Nullable DatemostRecent(@NotNull ModificationDateProvider @NotNull ... dateProviders) Finds the most recent modification date from aModificationDateProviderand multiple additional resourcesstatic @Nullable DatemostRecent(Date @NotNull ... dates) Returns the most recent of the specified datesstatic @Nullable DatemostRecent(@Nullable org.apache.sling.api.resource.Resource @NotNull ... resources) Finds the most recent modification date of all specified resources
-
Method Details
-
get
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 aModificationDateProviderand 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
Returns the most recent of the specified dates- Parameters:
dates- Dates- Returns:
- the most recent (or null if all dates were null)
-