javax.jcr.Node.doneMerge()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(204)

本文整理了Java中javax.jcr.Node.doneMerge()方法的一些代码示例,展示了Node.doneMerge()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.doneMerge()方法的具体详情如下:
包路径:javax.jcr.Node
类名称:Node
方法名:doneMerge

Node.doneMerge介绍

[英]Support for this method is only required under full versioning.

Completes the merge process with respect to this node and the specified version.

When the #merge method is called on a node, every versionable node in that subgraph is compared with its corresponding node in the indicated other workspace and a "merge test result" is determined indicating one of the following:

  1. This node will be updated to the state of its correspondee (if the base version of the correspondee is more recent in terms of version history).
  2. This node will be left alone (if this node's base version is more recent in terms of version history).
  3. This node will be marked as having failed the merge test (if this node's base version is on a different branch of the version history from the base version of its corresponding node in the other workspace, thus preventing an automatic determination of which is more recent).
    (See #merge for more details)

In the last case the merging of the subgraph of the versionable node in question must be done by the application (for example, by providing a merge tool for the user).

Additionally, once the subgraphs of the nodes has been merged, their version graph branches must also be merged. The JCR versioning system provides for this by keeping a record, for each versionable node that fails the merge test, of the base version of the corresponding node that caused the merge failure. This record is kept in the jcr:mergeFailed property of this node. After a merge, this property will contain one or more (if multiple merges have been performed) REFERENCEs that point to the "failed versions".

To complete the merge process, the client calls doneMerge(Version v) passing the version object referred to be the jcr:mergeFailed property that the client wishes to connect to this node in the version graph. This has the effect of moving the reference to the indicated version from the jcr:mergeFailed property of this node to the jcr:predecessors.

If the client chooses not to connect this node to a particular version referenced in the jcr:mergeFailed property, he calls #cancelMerge(Version version). This has the effect of removing the reference to the specified version from jcr:mergeFailedwithout adding it to jcr:predecessors.

Once the last reference in jcr:mergeFailed has been either moved to jcr:predecessors (with doneMerge) or just removed from jcr:mergeFailed (with cancelMerge) the jcr:mergeFailed property is automatically removed, thus enabling this node to be checked-in, creating a new version (note that before the jcr:mergeFailed is removed, its OnParentVersion setting of ABORT prevents checkin). This new version will have a predecessor connection to each version for which doneMerge was called, thus joining those branches of the version graph.

If successful, these changes are persisted immediately, there is no need to call save.
[中]只有在完全版本控制下才需要支持此方法。
完成有关此节点和指定version的合并过程。
在节点上调用#merge方法时,该子图中的每个可版本化节点都将与其在指定的其他工作区中的对应节点进行比较,并确定“merge test result”(合并测试结果),指示以下情况之一:
1.此节点将被更新为其对应方的状态(如果对应方的基本版本在版本历史中是最新的)。
1.此节点将不受影响(如果此节点的基本版本在版本历史记录方面较新)。
1.此节点将被标记为未通过合并测试(如果此节点的基本版本位于版本历史记录的另一个分支上,与另一个工作区中其对应节点的基本版本不同,从而阻止自动确定哪个是最新版本)。
(有关更多详细信息,请参见#合并)
在最后一种情况下,所讨论的可版本化节点的子图的合并必须由应用程序完成(例如,通过为用户提供合并工具)。
此外,一旦合并了节点的子图,它们的版本图分支也必须合并。JCR版本控制系统通过为每个未能通过合并测试的可版本化节点记录导致合并失败的相应节点的基本版本来实现这一点。此记录保存在此节点的jcr:mergeFailed属性中。在merge之后,此属性将包含一个或多个(如果已执行多个合并)REFERENCE指向“失败版本”。
要完成合并过程,客户端调用doneMerge(Version v),传递版本对象,该版本对象是客户端希望连接到版本图中this节点的jcr:mergeFailed属性。这会将对指定版本的引用从this节点的jcr:mergeFailed属性移动到jcr:predecessors
如果客户端选择不将此节点连接到jcr:mergeFailed属性中引用的特定版本,则会调用#cancelMerge(version version)。这样做的效果是从jcr:mergeFailed中删除对指定version的引用,而不将其添加到jcr:predecessors
jcr:mergeFailed中的最后一个引用被移动到jcr:predecessors(使用doneMerge)或刚从jcr:mergeFailed(使用cancelMerge)中删除后,jcr:mergeFailed属性将自动删除,从而允许签入this节点,创建一个新版本(请注意,在删除jcr:mergeFailed之前,OnParentVersion设置为ABORT会阻止签入)。此新版本将有一个到调用doneMerge的每个版本的前置连接,从而连接到版本图的这些分支。
如果成功,这些更改将立即持久化,无需调用save

代码示例

代码示例来源:origin: net.adamcin.commons/net.adamcin.commons.jcr

  1. public void doneMerge(Version version) throws RepositoryException {
  2. this.item.doneMerge(version);
  3. }

代码示例来源:origin: org.onehippo.cms7/hippo-repository-connector

  1. /**
  2. * @inheritDoc
  3. */
  4. public void doneMerge(Version version) throws VersionException, InvalidItemStateException,
  5. UnsupportedRepositoryOperationException, RepositoryException {
  6. node.doneMerge(VersionDecorator.unwrap(version));
  7. }

代码示例来源:origin: nl.vpro/jcr-criteria

  1. @Override
  2. @Deprecated
  3. public void doneMerge(Version version) throws RepositoryException {
  4. getNode().doneMerge(version);
  5. }

代码示例来源:origin: apache/jackrabbit

  1. /** {@inheritDoc} */
  2. public void doneMerge(String versionUUID)
  3. throws RepositoryException, RemoteException {
  4. try {
  5. node.doneMerge(getVersionByUUID(versionUUID));
  6. } catch (RepositoryException ex) {
  7. throw getRepositoryException(ex);
  8. }
  9. }

代码示例来源:origin: brix-cms/brix-cms

  1. public void execute() throws Exception {
  2. getDelegate().doneMerge(unwrap(version));
  3. }
  4. });

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr2spi

  1. /**
  2. * @see javax.jcr.version.VersionManager#doneMerge(String, Version)
  3. */
  4. public void doneMerge(String absPath, Version version) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException {
  5. session.checkIsAlive();
  6. Node n = itemManager.getNode(resolver.getQPath(absPath));
  7. n.doneMerge(version);
  8. }

代码示例来源:origin: apache/jackrabbit

  1. /**
  2. * @see javax.jcr.version.VersionManager#doneMerge(String, Version)
  3. */
  4. public void doneMerge(String absPath, Version version) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException {
  5. session.checkIsAlive();
  6. Node n = itemManager.getNode(resolver.getQPath(absPath));
  7. n.doneMerge(version);
  8. }

代码示例来源:origin: apache/jackrabbit

  1. public Object run() throws RepositoryException {
  2. Node node = getNode(nodeId, sInfo);
  3. Version version = null;
  4. boolean cancel;
  5. NamePathResolver resolver = sInfo.getNamePathResolver();
  6. List<NodeId> l = Arrays.asList(mergeFailedIds);
  7. Property mergeFailed = node.getProperty(resolver.getJCRName(NameConstants.JCR_MERGEFAILED));
  8. for (Value value : mergeFailed.getValues()) {
  9. String uuid = value.getString();
  10. if (!l.contains(idFactory.createNodeId(uuid))) {
  11. version = (Version) sInfo.getSession().getNodeByIdentifier(uuid);
  12. break;
  13. }
  14. }
  15. l = new ArrayList<NodeId>(predecessorIds.length);
  16. l.addAll(Arrays.asList(predecessorIds));
  17. Property predecessors = node.getProperty(resolver.getJCRName(NameConstants.JCR_PREDECESSORS));
  18. for (Value value : predecessors.getValues()) {
  19. NodeId vId = idFactory.createNodeId(value.getString());
  20. l.remove(vId);
  21. }
  22. cancel = l.isEmpty();
  23. if (cancel) {
  24. node.cancelMerge(version);
  25. } else {
  26. node.doneMerge(version);
  27. }
  28. return null;
  29. }
  30. }, sInfo);

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-spi2jcr

  1. public Object run() throws RepositoryException {
  2. Node node = getNode(nodeId, sInfo);
  3. Version version = null;
  4. boolean cancel;
  5. NamePathResolver resolver = sInfo.getNamePathResolver();
  6. List<NodeId> l = Arrays.asList(mergeFailedIds);
  7. Property mergeFailed = node.getProperty(resolver.getJCRName(NameConstants.JCR_MERGEFAILED));
  8. for (Value value : mergeFailed.getValues()) {
  9. String uuid = value.getString();
  10. if (!l.contains(idFactory.createNodeId(uuid))) {
  11. version = (Version) sInfo.getSession().getNodeByIdentifier(uuid);
  12. break;
  13. }
  14. }
  15. l = new ArrayList<NodeId>(predecessorIds.length);
  16. l.addAll(Arrays.asList(predecessorIds));
  17. Property predecessors = node.getProperty(resolver.getJCRName(NameConstants.JCR_PREDECESSORS));
  18. for (Value value : predecessors.getValues()) {
  19. NodeId vId = idFactory.createNodeId(value.getString());
  20. l.remove(vId);
  21. }
  22. cancel = l.isEmpty();
  23. if (cancel) {
  24. node.cancelMerge(version);
  25. } else {
  26. node.doneMerge(version);
  27. }
  28. return null;
  29. }
  30. }, sInfo);

代码示例来源:origin: brix-cms/brix-cms

  1. /**
  2. * @deprecated
  3. */
  4. @Deprecated
  5. public void doneMerge(Version version) throws RepositoryException {
  6. getActionHandler().beforeNodeDoneMerge(this, version);
  7. getDelegate().doneMerge(unwrap(version));
  8. getActionHandler().afterNodeDoneMerge(this, version);
  9. }

代码示例来源:origin: apache/jackrabbit

  1. nodeToMerge.doneMerge((Version) superuser.getNodeByUUID(uuid));

代码示例来源:origin: apache/jackrabbit

  1. n1.checkout();
  2. n1.merge(n2.getSession().getWorkspace().getName(), true);
  3. n1.doneMerge(v122);
  4. Version v17 = n1.checkin();

相关文章