Java JCR:父子节点版本对应关系
我正在使用 Jackrabbit,我有以下问题:
我有一个父节点 P 和一个子节点 C。P 和 C 都是可版本化的。在我的代码中的某个时刻,我需要从 P 的先前版本 V 获取数据,因此我使用 getVersionHistory().getVersion(V).getNode("jcr:frozennode") 为了获得我需要的版本。然而在这个版本中,节点 P 的子节点不再是节点 C 而是对 C 版本历史的引用,因此我不知道当 P 的版本是 V 时 C 所处的确切状态。所以问题是,有没有办法确定哪些 C 版本对应于已检索的 PI 版本(“对应”是指同时处于活动状态)。我知道,由于 P 和 C 都是可版本化的,因此可以独立签出/签入,因此可能没有与 P 版本相对应的单个 C 版本,因此我希望获得 C 的子集版本历史记录包含 P 处于版本 V 时经历的版本 C。
谢谢你,
克里斯蒂娜
I am using Jackrabbit and I have the following question:
I have a parent node P and a child node C. Both P and C are versionable. At some point in my code I need to get data from a previous version V of P, so I use getVersionHistory().getVersion(V).getNode("jcr:frozennode")
in order to get the version I need. In this version however, the child of node P is no longer node C but a reference to C's version history, therefore I don't know the exact state C was in while P's version was V. So the question is, is there a way to determine which versions of C correspond to the version of P I have retrieved (by "correspond" I mean were active at the same time). I understand that since both P and C are versionable and therefore can be checked-out/checked-in independently there might not be a single version of C corresponding to a version of P, so I would expect to get a sub-set of C's version history which contains the versions C went through while P was in version V.
Thank you,
Christina
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用添加到所有节点的时间戳来确定在给定时间关联的版本。
编辑:“正确”的方法可能是按版本签出完整的子树。
另请检查以下链接:
http://www.day.com/specs /jcr/2.0/3_Repository_Model.html#VersionableState
或者本教程:
http://jtoee.com/jsr-170/the_jcr_primer/5/
CND文档:
http://jackrabbit.apache.org/node-type-notation.html
You could use timestamps added to all nodes to determine which versions where assosciated at a given time.
EDIT: The "proper" way is probably to checkout a complete subtree by version.
Check also these links:
http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#VersionableState
Or this tutorial:
http://jtoee.com/jsr-170/the_jcr_primer/5/
CND docs:
http://jackrabbit.apache.org/node-type-notation.html