public static Boolean isPublished(Resource resource) {
Boolean activated;
ReplicationStatus status = null;
activated = false;
if (resource != null) {
try {
Page page = resource.adaptTo(Page.class);
status = page.adaptTo(ReplicationStatus.class);
} catch (Exception e) {
LOG.debug(e.getMessage(), e);
}
if (status != null) {
activated = status.isActivated();
}
}
return activated;
}
Resource: https://cqwemblog.wordpress.com/2015/10/22/how-to-check-if-the-page-is-published-cq5aem/
No comments:
Post a Comment
If you have any doubts or questions, please let us know.