Checking if the page is a live copy
You can use LiveRelationshipManager
, adaptable from resource resolver:
resourceResolver.adaptTo(LiveRelationshipManager.class)
It has method hasLiveRelationship
which will return true
if passed resource is a live copy of something other. You can invoke this method passing current component resource.
Parent and siblings
Use PageManager
and Page
methods:
// resource - current component resource
ResourceResolver resolver = resource.getResourceResolver();
PageManager pageManager = resolver.adaptTo(PageManager.class);
Page currentPage = pageManager.getContainingPage(resource);
Page parentPage = currentPage.getParent();
Iterator<Page> siblings = parentPage.listChildren();