Comment

Avatar

Level 4

07-09-2021

Hi @abinayaSirius 

One way to know whether a page is a blueprint or not can be by knowing whether it have  livecopy or not.

You can use below code to know whether it has a livecopy or not:

Resource resource = req.getResourceResolver().getResource("<path of the page you wanted to check for blueprint>");

LiveRelationshipManager liveRelationshipManager = req.getResourceResolver().adaptTo(LiveRelationshipManager.class);
RangeIterator rangeIterator = liveRelationshipManager.getLiveRelationships(resource,"",null);

 

if rangeIterator is null that means it doesn't have any live copy hence is not a blueprint.

You can use the same code to get all the live copies if the path provided is a blueprint.