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

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

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

Version.getSuccessors介绍

[英]Returns the successor versions of this version. This corresponds to returning all the nt:version nodes referenced by the jcr:successors multi-value property in the nt:version node that represents this version.

In a simple versioning repository this method
[中]返回此版本的后续版本。这相当于返回表示此版本的nt:version节点中jcr:successors多值属性引用的所有nt:version节点。
在一个简单的版本控制存储库中,这个方法

代码示例

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

@Override
public boolean isCurrent() {
  try {
    Version[] successors = version.getSuccessors();
    if (successors == null || successors.length == 0) {
      return true;
    }
  } catch (RepositoryException e) {
    // no-op
  }
  return false;
}

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

@Override
public boolean isCurrent() {
  try {
    Version[] successors = version.getSuccessors();
    if (successors == null || successors.length == 0) {
      return true;
    }
  } catch (RepositoryException e) {
  }
  return false;
}

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

@Override
public boolean isCurrent() {
  try {
    Version[] successors = version.getSuccessors();
    if (successors == null || successors.length == 0) {
      return true;
    }
  } catch (RepositoryException e) {
  }
  return false;
}

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

@Override
public boolean isCurrent() {
  try {
    Version[] successors = version.getSuccessors();
    if (successors == null || successors.length == 0) {
      return true;
    }
  } catch (RepositoryException e) {
    // no-op
  }
  return false;
}

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

/**
 * @return the first successor or null if no next version exists.
 */
public static Version getNextVersion(Version version) throws RepositoryException {
  if (version == null) {
    return null;
  }
  Version[] successors = version.getSuccessors();
  if (successors.length > 0) {
    return successors[0];
  }
  return null;
}

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

@Override
public Version[] getSuccessors() throws RepositoryException {
  return version.getSuccessors();
}

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

@Override
public Version[] getSuccessors() throws RepositoryException {
  Version[] internalVersions = delegate.getSuccessors();
  if (internalVersions == null) {
    return null;
  }
  for (int i = 0; i < internalVersions.length; i++) {
    internalVersions[i] = new VersionFacade<>(internalVersions[i], session);
  }
  return internalVersions;
}

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

/**
 * @inheritDoc
 */
public Version[] getSuccessors() throws RepositoryException {
  Version[] successors = version.getSuccessors();
  for (int i = 0; i < successors.length; i++) {
    successors[i] = factory.getVersionDecorator(session, successors[i]);
  }
  return successors;
}

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

/** {@inheritDoc} */
public RemoteVersion[] getSuccessors() throws RepositoryException, RemoteException {
  try {
    return getRemoteVersionArray(version.getSuccessors());
  } catch (RepositoryException ex) {
    throw getRepositoryException(ex);
  }
}

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

@Override
public Version[] getSuccessors() throws RepositoryException {
  return wrapVersions(getWrappedVersion().getSuccessors()) ;
}

代码示例来源:origin: pentaho/pentaho-platform

public static Object getVersionSummaries( final Session session, final PentahoJcrConstants pentahoJcrConstants,
  final Serializable fileId, final boolean includeAclOnlyChanges ) throws RepositoryException {
 Node fileNode = session.getNodeByIdentifier( fileId.toString() );
 VersionHistory versionHistory = session.getWorkspace().getVersionManager().getVersionHistory( fileNode.getPath() );
 // get root version but don't include it in version summaries; from JSR-170 specification section 8.2.5:
 // [root version] is a dummy version that serves as the starting point of the version graph. Like all version
 // nodes,
 // it has a subnode called jcr:frozenNode. But, in this case that frozen node does not contain any state
 // information
 // about N
 Version version = versionHistory.getRootVersion();
 Version[] successors = version.getSuccessors();
 List<VersionSummary> versionSummaries = new ArrayList<VersionSummary>();
 while ( successors != null && successors.length > 0 ) {
  version = successors[0]; // branching not supported
  VersionSummary sum = toVersionSummary( pentahoJcrConstants, versionHistory, version );
  if ( !sum.isAclOnlyChange() || ( includeAclOnlyChanges && sum.isAclOnlyChange() ) ) {
   versionSummaries.add( sum );
  }
  successors = version.getSuccessors();
 }
 return versionSummaries;
}

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

public JcrVersion[] execute() throws Exception {
    return JcrVersion.Wrapper.wrap(getDelegate().getSuccessors(), getJcrSession());
  }
});

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

public Version[] getSuccessors() throws RepositoryException {
  return wrap(getDelegate().getSuccessors(), getSessionWrapper());
}

代码示例来源:origin: org.apache.sling/org.apache.sling.servlets.get

private JsonObject getJsonObject(Resource resource, VersionManager vm) throws RepositoryException {
  final JsonObjectBuilder result = Json.createObjectBuilder();
  final Node node = resource.adaptTo(Node.class);
  if (node == null || !node.isNodeType(JcrConstants.MIX_VERSIONABLE)) {
    return result.build();
  }
  final String absPath = resource.getPath();
  final VersionHistory history = vm.getVersionHistory(absPath);
  final Version baseVersion = vm.getBaseVersion(absPath);
  
  for (final VersionIterator it = history.getAllVersions(); it.hasNext();) {
    final Version v = it.nextVersion();
    final JsonObjectBuilder obj = Json.createObjectBuilder();
    obj.add("created", createdDate(v));
    obj.add("successors", getArrayBuilder(getNames(v.getSuccessors())));
    obj.add("predecessors", getArrayBuilder(getNames(v.getPredecessors())));
    
    obj.add("labels", getArrayBuilder(history.getVersionLabels(v)));
    obj.add("baseVersion", baseVersion.isSame(v));
    result.add(v.getName(), obj);
  }
  return Json.createObjectBuilder().add("versions", result).build();
}

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

/**
 * Test if the successors of the removed version are made successors of
 * all predecessors of the the removed version.
 *
 * @throws RepositoryException
 */
public void testRemoveVersionAdjustSucessorSet() throws RepositoryException {
  // retrieve predecessors to test and remove the version
  Version[] predec = version.getPredecessors();
  vHistory.removeVersion(version.getName());
  for (int i = 0; i < predec.length; i++) {
    boolean isContained = false;
    Version[] succ = predec[i].getSuccessors();
    for (int j = 0; j < succ.length; j++) {
      isContained |= succ[j].isSame(version2);
    }
    if (!isContained) {
      fail("Removing a version must make all it's successor version to successors of the removed version's predecessors.");
    }
  }
}

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

private void assertSuccessors(String expected, Version version)
    throws Exception {
  Set successors = new HashSet();
  if (expected.length() > 0) {
    successors.addAll(Arrays.asList(expected.split(" ")));
  }
  Version[] versions = version.getSuccessors();
  for (int i = 0; i < versions.length; i++) {
    if (!successors.remove(versions[i].getName())) {
      fail("Version " + version.getName()
          + " has an unexpected successor "
          + versions[i].getName());
    }
  }
  if (!successors.isEmpty()) {
    fail("Version " + version.getName()
        + " does not have all expected successors");
  }
}

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

private static void assertSuccessors(VersionHistory history, Set<String> expectedSuccessors, String versionName) throws RepositoryException {
  assertEquals(expectedSuccessors, getNames(history.getVersion(versionName).getSuccessors()));
}

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

while (v.getSuccessors().length > 0) {
  v = v.getSuccessors()[0];

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

/**
 * helper method for {@link #testXAVersionsThoroughly()}
 */
private void check(Version v, String phase, String name, int numSucc) {
  String vName;
  int vSucc = -1;
  try {
    vName = v.getName();
    //vSucc = v.getProperty("jcr:successors").getValues().length;
    vSucc = v.getSuccessors().length;
  } catch (RepositoryException e) {
    // node is invalid after remove
    vName = name;
  }
  assertEquals(phase + " Version Name", name, vName);
  assertEquals(phase + " Num Successors", numSucc, vSucc);
}

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

@Test
public void testSuccessorsAreWrapped() 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[] versions = createdVersion_1.getSuccessors();
  // THEN
  assertTrue(versions[0] instanceof ContentDecoratorVersionWrapper);
  assertTrue(versions[0].isSame(createdVersion_2));
}

相关文章