Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Siblings

Avatar

Level 3

How to get siblings? For example somethig like node.getNextSibling() or node.getPreviousSiblings()? I cannot find in API

Why I need it. After the live copy creation the node order is wrong in the live copy. I mean the node order is different in the live copy and in the blueprint. There is an orderChildren sync action in the default rollout configuration. But... Unfortunately orderChildren does not help

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

The JCR API does not support getSibiling(). That would be a good method for the API to have included.

A workaround is to write a custom algorithm that calls  getParent() and then get all the children of that parent. Then you can figure out the nodes under that parent thereby determining the siblings. 

A
 ....B
.....C
.....D

Therefore if you wanted to find out the siblings of Node C - you can call getParent() and then that will return Node A. Then you can call     getNodes() which will return Nodes B,C, and D. That is the only way that you can find out which siblings Node C has.  

HTH

View solution in original post

7 Replies

Avatar

Level 10

W.r.t live copy requirement it should maintain order. Which version of CQ & are you losings order within child page of live copy.

Avatar

Level 3

smacdonald2008 wrote...

Did you read this document: http://www.day.com/specs/jcr/2.0/22_Same-Name_Siblings.html ? 

 


Yes, I saw this document. Although my question is not related with SNS because there are no siblings with the same name.

For example there are nodes:
- A

- B

- C

How to get the position of B? That the next sibling of B is C and the previous sibling is A

Avatar

Level 3

Sham HC wrote...

W.r.t live copy requirement it should maintain order. Which version of CQ & are you losings order within child page of live copy.

 


It maintains the order, for example, for geometrix. In my case I have a site with 4000 pages and after live copy creation, the order of the pages in the live copy is wrong.
 
I use 5.5 and the package cq-update-pkg-5.5.10.zip is installed.
 
That is correct, the order within child pages of the live copy is different comparing to the blueprint.

Avatar

Correct answer by
Level 10

The JCR API does not support getSibiling(). That would be a good method for the API to have included.

A workaround is to write a custom algorithm that calls  getParent() and then get all the children of that parent. Then you can figure out the nodes under that parent thereby determining the siblings. 

A
 ....B
.....C
.....D

Therefore if you wanted to find out the siblings of Node C - you can call getParent() and then that will return Node A. Then you can call     getNodes() which will return Nodes B,C, and D. That is the only way that you can find out which siblings Node C has.  

HTH

Avatar

Level 10

You need to install sp3 + hotfix  to get correct order of child pages in live copy.  Please file daycare & will help you further to resolve it.

Avatar

Level 3

smacdonald2008 wrote...

The JCR API does not support getSibiling(). That would be a good method for the API to have included.

A workaround is to write a custom algorithm that calls  getParent() and then get all the children of that parent. Then you can figure out the nodes under that parent thereby determining the siblings. 

A
 ....B
.....C
.....D

Therefore if you wanted to find out the siblings of Node C - you can call getParent() and then that will return Node A. Then you can call     getNodes() which will return Nodes B,C, and D. That is the only way that you can find out which siblings Node C has.  

HTH

 

 


I thought about the same solution but still hoped that there is a right way, not workaround. Thank you