Expand my Community achievements bar.

Join us in celebrating the outstanding achievement of our AEM Community Member of the Year!
SOLVED

Not able to add mixin "mix:versionable" in page nodes

Avatar

Level 4

I faced an issue where jcr:uuid is not generated if we publish a page using manage publication, but not if we publish using quick publish. Upon investigation, we discovered that when we publish using quick publish, "mix:versionable" is added to the jcr:mixinTypes property. As a solution, I am trying to add a replication event handler that will add this "mix:versionable" mixin to the jcr:content node of the page if the property is not present. I am unable to add the mixin as I get an exception "org.apache.jackrabbit.oak.api.CommitFailedException: OakAccess0000: Access denied".

 

Is there any to add this mix:versionable mixin to the node? If there is no way to add the mixin, I will add a custom ID upon page creation but that will require a lot of changes as we have already referenced jcr:uuid for our previous solutions. So, if anyone is aware of how to add this mixin, please provide some insights.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Ankan_Ghosh 

The mix:versionable  is added to page with quick publish because of new version of page is created, if you can also create a version.

 

Otherwise the way you are trying might work but check the permission.

Permissions : jcr:modifyProperties, jcr:nodeTypeManagement, jcr:write 

 

Node node = session.getNode("/path/to/your/node");
if (!node.isNodeType("mix:versionable")) {
    node.addMixin("mix:versionable");
    session.save();
}

 

 

 



Arun Patidar

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hi @Ankan_Ghosh 

The mix:versionable  is added to page with quick publish because of new version of page is created, if you can also create a version.

 

Otherwise the way you are trying might work but check the permission.

Permissions : jcr:modifyProperties, jcr:nodeTypeManagement, jcr:write 

 

Node node = session.getNode("/path/to/your/node");
if (!node.isNodeType("mix:versionable")) {
    node.addMixin("mix:versionable");
    session.save();
}

 

 

 



Arun Patidar

Avatar

Level 4

The problem was with the permission. After giving all the required permissions, I was able to add the mixin. Thanks! 

Avatar

Level 4

Hi @Ankan_Ghosh , @arunpatidar 

By default AEM replication agents creates a version of page when you replicate the content. During version, AEM puts the node in checked in state so that no other operation will be done on that node. You can try checkin and checkout methods present in below API reference.

 

https://developer.adobe.com/experience-manager/reference-materials/spec/jsr170/javadocs/jcr-2.0/java... 

Uppari_Ramesh_0-1736842068921.png

 

Avatar

Level 5
o resolve the issue with adding mix:versionable:

Check Permissions: Ensure the user has the required permissions to modify the node and add mixins.
Use System User: If permissions are restricted, use a system user with appropriate rights.
JCR API: Use the JCR API to add the mixin:

Node pageNode = session.getNode("/content/myPage/jcr:content");
if (!pageNode.isNodeType("mix:versionable")) {
pageNode.addMixin("mix:versionable");
pageNode.save();
}

Check Node Restrictions: Ensure the node is eligible to have the mixin.
Custom ID: If adding the mixin isn't feasible, consider using a custom ID, though it requires more changes.