jcr:mixinTypes property | Community
Skip to main content
Singaiah_Chintalapudi
Level 7
May 19, 2016
Solved

jcr:mixinTypes property

  • May 19, 2016
  • 6 replies
  • 10144 views

Hi,

I want to add the below property programatically:

Name: jcr:mixinTypes
Type: Name[]
Value: cq:LiveRelationship, cq:LiveSync, cq:LiveSyncCancelled

I am using JCR API but when I create this property, it is adding this property type as string[] not Name[]. Can anyone help me to resolve this issue?

Thanks.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Singaiah_Chintalapudi

We have to add this mixinType before saving (session.save()).

6 replies

Singaiah_Chintalapudi
Level 7
May 20, 2016

noksc wrote...

Hi,

I want to add the below property programatically:

Name: jcr:mixinTypes
Type: Name[]
Value: cq:LiveRelationship, cq:LiveSync, cq:LiveSyncCancelled

I am using JCR API but when I create this property, it is adding this property type as string[] not Name[]. Can anyone help me to resolve this issue?

Thanks.

 

Can someone help me to solve this issue?

Level 2
March 25, 2021

Did you try node.addMixin(" mix:lockable")', that should work.

Deepikaa_Nagesh
Level 3
May 23, 2016

Hi,

hope you are using Node.addMixin method?

If not how exactly you are adding mixins to node?

 

Thanks,

Deepikaa

Singaiah_Chintalapudi
Level 7
May 23, 2016

Deepikaa Nagesh wrote...

Hi,

hope you are using Node.addMixin method?

If not how exactly you are adding mixins to node?

 

Thanks,

Deepikaa

 

 

Yes. I have tried to use the same method. 

http://www.day.com/specs/jsr170/javadocs/jcr-2.0/javax/jcr/Node.html#addMixin(java.lang.String)

But it is throwing exceptions. 

Singaiah_Chintalapudi
Singaiah_ChintalapudiAuthorAccepted solution
Level 7
May 23, 2016

We have to add this mixinType before saving (session.save()).

kautuk_sahni
Community Manager
Community Manager
March 26, 2021
@singaiah_chintalapudi, good to see you back and thank you for sharing the solution with AEM community. Looking forward for your more contribution in the community. Good to have SMEs like you.
Kautuk Sahni
May 23, 2016

String []  array = new String[]{"cq:LiveRelationship", "cq:LiveSync", "cq:LiveSyncCancelled"};

Then set the property like below

   node.setProperty(" jcr:mixinTypes",array);

  node.getSesssion().Save();

 

Hope this would you are expecting.

 

Reply if you are not getting.

kpawan
Level 2
May 2, 2022

I faced similar problem while cancelling the inheritance of a component for multiple nodes and following code snippet worked for me -

Node node = getNode(String nodepath)
node.addMixin("cq:LiveSyncCancelled")
node.setProperty("cq:isCancelledForChildren","true",PropertyType.BOOLEAN)
session.save();

 

Note: I executed this on groovyconsole.