Solved
No text available
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Hi @bkkothari2255, you can try to reuse below code, this is not a full solution but it shows how msm api can be used programmatically - the result will be canceled inheritance (suspend) for given page resource.
In general LiveRelationshipManager allows you to full manage relationships (including, cancel inheritance, detach etc) - here you can find link to java docs - [1]
import com.day.cq.wcm.msm.api.LiveRelationshipManager;
import com.day.cq.wcm.msm.api.LiveRelationship;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.osgi.service.component.annotations.Reference;
// place for your class definition
@Reference
private LiveRelationshipManager liveRelationshipManager;
// place for other code
public void cancelPageInheritance(Resource pageResource, ResourceResolver resourceResolver) {
if (liveRelationshipManager.hasLiveRelationship(pageResource)) {
LiveRelationship liveRelationship = liveRelationshipManager.getLiveRelationship(pageResource, true);
if (liveRelationship != null) {
liveRelationshipManager.cancelRelationship(resourceResolver, liveRelationship, false, true);
}
}
}Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.