Expand my Community achievements bar.

SOLVED

jcr:mixinTypes property

Avatar

Community Advisor

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

10 Replies

Avatar

Community Advisor

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?

Hi @Singaiah_Chintalapudi,

Did you get a solution to this issue? Could you let me know any info on this?

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

This works -> pageContentNode.addMixin("mix:lockable")'.

Avatar

Level 3

Hi,

hope you are using Node.addMixin method?

If not how exactly you are adding mixins to node?

 

Thanks,

Deepikaa

Avatar

Community Advisor

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. 

Avatar

Correct answer by
Community Advisor

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

Avatar

Administrator
@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

Avatar

Former Community Member

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.

Avatar

Level 2

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.