javax.jcr.version.Version.getLinearSuccessor()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(99)

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

Version.getLinearSuccessor介绍

[英]Assuming that this Version object was acquired through a Workspace``W and is within the VersionHistory``H, this method returns the successor of this version along the same line of descent as is returned by H.getAllLinearVersions() where H was also acquired through W.

Note that under simple versioning the behavior of this method is equivalent to getting the unique successor (if any) of this version.
[中]假设这个Version对象是通过Workspace``W获取的,并且在VersionHistory``H范围内,这个方法会沿着H.getAllLinearVersions()返回的相同下降线返回这个版本的后续对象,其中H也是通过[$7$]获取的。
请注意,在简单版本控制下,此方法的行为相当于获取此版本的唯一后续版本(如果有)。

代码示例

代码示例来源:origin: info.magnolia/magnolia-core

@Override
public Version getLinearSuccessor() throws RepositoryException {
  return version.getLinearSuccessor();
}

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

public Version getLinearSuccessor() throws RepositoryException {
  return version.getLinearSuccessor();
}

代码示例来源:origin: net.adamcin.oakpal/oakpal-core

@Override
public Version getLinearSuccessor() throws RepositoryException {
  Version internalVersion = delegate.getLinearSuccessor();
  return new VersionFacade<>(internalVersion, session);
}

代码示例来源:origin: info.magnolia/magnolia-core

@Override
public Version getLinearSuccessor() throws RepositoryException {
  Version linearSuccessor = getWrappedVersion().getLinearSuccessor();
  return linearSuccessor != null ? wrapVersion(linearSuccessor) : null;
}

代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle

@Override
public boolean isWillBeRemoved() {
  try {
    if (isCurrent()) {
      return false;
    }
    if (isResource()) {
      Node node = version.getLinearSuccessor().getFrozenNode().getNode(relativePath);
      return node == null;
    } else {
      Property prop = version.getLinearSuccessor().getFrozenNode().getProperty(relativePath);
      return prop == null;
    }
  } catch (Exception e) {
  }
  return true;
}

代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons

@Override
public boolean isWillBeRemoved() {
  try {
    if (isCurrent()) {
      return false;
    }
    if (isResource()) {
      Node node = version.getLinearSuccessor().getFrozenNode().getNode(relativePath);
      return node == null;
    } else {
      Property prop = version.getLinearSuccessor().getFrozenNode().getProperty(relativePath);
      return prop == null;
    }
  } catch (Exception e) {
    // no-op
  }
  return true;
}

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

public JcrVersion execute() throws Exception {
    return JcrVersion.Wrapper.wrap(getDelegate().getLinearSuccessor(), getSession());
  }
});

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

/** {@inheritDoc} */
public RemoteVersion getLinearSuccessor() throws RepositoryException,
    RemoteException {
  try {
    Version linearSuccessor = version.getLinearSuccessor();
    if (linearSuccessor == null) {
      return null;
    } else {
      return getFactory().getRemoteVersion(linearSuccessor);
    }
  } catch (RepositoryException ex) {
    throw getRepositoryException(ex);
  }
}

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

public Version getLinearSuccessor() throws RepositoryException {
  return VersionWrapper.wrap(getDelegate().getLinearSuccessor(), getSessionWrapper());
}

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

/**
 * Checks obtaining the linear predecessor.
 * @since JCR 2.0
 */
public void testGetLinearPredecessorSuccessor() throws RepositoryException {
  String path = versionableNode.getPath();
  VersionManager vm = versionableNode.getSession().getWorkspace().getVersionManager();
  // get the previous version
  Version pred = vm.getBaseVersion(path);
  // shouldn't have a predecessor
  assertNull(pred.getLinearPredecessor());
  // shouldn't have a successor yet
  assertNull(pred.getLinearSuccessor());
  // check root version
  Version root = vm.getVersionHistory(path).getRootVersion();
  assertNull(root.getLinearSuccessor());
  // create a new version
  vm.checkout(path);
  Version version = vm.checkin(path);
  // refresh the predecessor
  pred = (Version)versionableNode.getSession().getNode(pred.getPath());
  assertTrue("linear predecessor of new version should be previous version",
      version.getLinearPredecessor().isSame(pred));
  assertTrue("linear successor of previous version should be new version",
      pred.getLinearSuccessor().isSame(version));
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
public void testLinearSuccessorIsWrapped() throws Exception {
  // GIVEN
  Session session = MgnlContext.getJCRSession(RepositoryConstants.WEBSITE);
  VersionManager versionMan = Components.getComponent(VersionManager.class);
  Node node = session.getRootNode().addNode( "page", NodeTypes.Page.NAME);
  session.save();
  Version createdVersion_1 = versionMan.addVersion(node);
  Version createdVersion_2 = versionMan.addVersion(node);
  // WHEN
  Version version = createdVersion_1.getLinearSuccessor();
  // THEN
  assertTrue(version instanceof ContentDecoratorVersionWrapper);
  assertTrue(version.isSame(createdVersion_2));
}

相关文章