@SuppressWarnings("null")
  public static @Nullable Date get(@Nullable Resource resource) {
    if (resource == null) {
      return null;
    }
    ValueMap resourceProperties = resource.getValueMap();

    // get the cq:lastModified property from the resource (used in jcr:content nodes of cq pages)
    Date cqModified = resourceProperties != null ? resourceProperties.get(NameConstants.PN_PAGE_LAST_MOD, Date.class) : null;

    // try to find a jcr:lastModified property that is used for binary uploads or cq paragraphs
    Date resourceModified = getResourceMetadataModificationTime(resource);

    // get the most recent date of both
    return mostRecent(cqModified, resourceModified);
  }
@ SuppressWarnings ( "null" ) public static @ Nullable Date get ( @ Nullable Resource resource ) { if ( resource == null ) { return null ; } ValueMap resourceProperties = resource . getValueMap ( ) ; Date cqModified = resourceProperties != null ? resourceProperties . get ( NameConstants . PN_PAGE_LAST_MOD , Date . class ) : null ; Date resourceModified = getResourceMetadataModificationTime ( resource ) ; return mostRecent ( cqModified , resourceModified ) ; }
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
@param resource a resource with a cq:lastModified property *and/or* a file/jcr:content subnode with a jcr:lastModified property
@return the date or null if last modified property could not be found