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
Solved! Go to Solution.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
W.r.t live copy requirement it should maintain order. Which version of CQ & are you losings order within child page of live copy.
Views
Replies
Total Likes
Did you read this document: http://www.day.com/specs/jcr/2.0/22_Same-Name_Siblings.html ?
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
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
.....DTherefore 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
Views
Replies
Total Likes
Views
Likes
Replies