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

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

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

Version.getName介绍

暂无

代码示例

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

/**
 * Return the name of the version represented by this object.
 *
 * @return the versions name
 */
public String getVersionLabel() throws RepositoryException {
  return this.state.getName();
}

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

@Override
public String getVersionName() {
  try {
    return version.getName();
  } catch (RepositoryException e) {
    log.warn("Could not determine version name");
  }
  return "null";
}

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

/**
 * Test if restoring a node restores the correct property
 *
 * @throws RepositoryException
 */
public void testRestoreCorrectPropertyJcr2_3() throws RepositoryException {
  versionManager.restore(versionableNode.getPath(), version.getName(), true);
  String value = versionableNode.getProperty(propertyName1).getString();
  assertEquals("Restoring a node must set the correct property.", propertyValue1, value);
}

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

/**
 * Test if restoring a node works on checked-in node.
 *
 * @throws RepositoryException
 */
public void testRestoreOnCheckedInNodeJcr2_3() throws RepositoryException {
  versionManager.checkin(versionableNode.getPath());
  versionManager.restore(versionableNode.getPath(), version.getName(), true);
}

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

public static Serializable getBaseVersionId( final Session session, final Serializable fileId )
 throws RepositoryException {
 Node node = session.getNodeByIdentifier( fileId.toString() );
 return session.getWorkspace().getVersionManager().getBaseVersion( node.getPath() ).getName();
}

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

/**
 * Restoring a node set the jcr:isCheckedOut property to false.
 *
 * @throws RepositoryException
 */
public void testRestoreSetsIsCheckedOutToFalseJcr3() throws RepositoryException {
  versionManager.restore(versionableNode.getPath(), version.getName(), true);
  assertFalse("Restoring a node sets the jcr:isCheckedOut property to false", versionManager.isCheckedOut(versionableNode.getPath()));
}

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

/**
 * Restoring a node set the jcr:isCheckedOut property to false.
 *
 * @throws RepositoryException
 */
public void testRestoreSetsIsCheckedOutToFalseJcr3() throws RepositoryException {
  versionManager.restore(versionableNode.getPath(), version.getName(), true);
  assertFalse("Restoring a node sets the jcr:isCheckedOut property to false", versionManager.isCheckedOut(versionableNode.getPath()));
}

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

/**
 * Test the restore of a versionable node using a label.
 * @throws RepositoryException
 */
public void testRestoreLabelJcr2() throws RepositoryException {
  // mark V1 with label test1
  versionManager.getVersionHistory(versionableNode.getPath()).addVersionLabel(version.getName(), "test", true);
  // restore V1 via label.
  versionManager.restoreByLabel(versionableNode.getPath(), "test", true);
  String value = versionableNode.getProperty(propertyName1).getString();
  assertEquals("Node.restore('test') not correctly restored", propertyValue1, value);
}

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

private static void preventLostUpdate( final Session session, final PentahoJcrConstants pentahoJcrConstants,
  final RepositoryFile file ) throws RepositoryException {
 Node fileNode = session.getNodeByIdentifier( file.getId().toString() );
 // guard against using a file retrieved from a more lenient session inside a more strict session
 Assert.notNull( fileNode );
 if ( isVersioned( session, pentahoJcrConstants, fileNode ) ) {
  Assert.notNull( file.getVersionId(), "updating a versioned file requires a non-null version id" ); //$NON-NLS-1$
  Assert.state( session.getWorkspace().getVersionManager().getBaseVersion( fileNode.getPath() ).getName().equals(
    file.getVersionId().toString() ), "update to this file has occurred since its last read" ); //$NON-NLS-1$
 }
}

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

/**
 * Test if VersionHistory.hasVersionLabel(Version, String) returns true, if the label
 * has beed successfully added before to the specified version.
 *
 * @throws RepositoryException
 * @see VersionHistory#hasVersionLabel(javax.jcr.version.Version, String)
 */
public void testHasVersionLabelForVersion() throws RepositoryException {
  vHistory.addVersionLabel(version.getName(), versionLabel, false);
  assertTrue("VersionHistory.hasVersionLabel(Version, String) must return true if the label has been sucessfully added.", vHistory.hasVersionLabel(version, versionLabel));
}

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

public static String getVersionId( final Session session, final PentahoJcrConstants pentahoJcrConstants,
  final Node node ) throws RepositoryException {
 if ( node.isNodeType( pentahoJcrConstants.getNT_FROZENNODE() ) ) {
  return JcrStringHelper.fileNameDecode( node.getParent().getName() );
 }
 Version version = getBaseVersion( session, node );
 return version != null ? JcrStringHelper.fileNameDecode( version.getName() ) : null;
}

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

@Test
public void testVersionId_Success() throws Exception {
 Version version = mock( Version.class );
 when( version.getName() ).thenReturn( VERSION_NAME_TEST );
 when( vmanagerMock.getBaseVersion( anyString() ) ).thenReturn( version );
 try {
  String versionId = JcrRepositoryFileUtils.getVersionId( sessionMock, pJcrConstMock, nodeMock );
  assertTrue( VERSION_NAME_TEST.equals( versionId ) );
 } catch ( Exception e ) {
  fail( "No exception shold be here but it is: " + e );
 }
}

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

public NodeIterator execute() throws Exception {
    Node n = getNode();
    Version v = getRandomVersion(true);
    if (v != null) {
      log.info(n.getPath() + ":" + v.getName());
      n.getVersionHistory().removeVersion(v.getName());
    }
    return wrapWithIterator(n);
  }
}

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

public void testMoveLabel3() throws RepositoryException {
  versionableNode.checkout();
  Version v = versionableNode.checkin();
  vHistory.addVersionLabel(version.getName(), versionLabel, false);
  vHistory.addVersionLabel(v.getName(), versionLabel, true);
  List<String> labels = Arrays.asList(vHistory.getVersionLabels(version));
  assertFalse(labels.contains(versionLabel));
}

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

public void testRemovedLabel3() throws RepositoryException {
  vHistory.addVersionLabel(version.getName(), versionLabel, false);
  vHistory.removeVersionLabel(versionLabel);
  List<String> labels = Arrays.asList(vHistory.getVersionLabels(version));
  assertFalse("VersionHistory.getVersionLabels(Version) must not return a removed label.",labels.contains(versionLabel));
}

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

/**
 * @see VersionHistory#removeVersionLabel(String)
 */
public void removeVersionLabel(String label) throws VersionException, RepositoryException {
  checkStatus();
  Name qLabel = getQLabel(label);
  Version version = getVersionByLabel(qLabel);
  NodeState vState = getVersionState(version.getName());
  // delegate to version manager that operates on workspace directly
  session.getVersionStateManager().removeVersionLabel((NodeState) getItemState(), vState, qLabel);
}

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

/**
   * Returns the versionable node.
   */ 
  public NodeIterator execute() throws Exception {
    Node n = getNode();
    if (!n.isCheckedOut()) {
      log.info(n.getPath() + ":" + n.getBaseVersion().getName());
      n.checkout();
    }
    return wrapWithIterator(n);
  }
}

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

@Test
public void testGetVersionHistoryList() throws RepositoryException {
  // GIVEN
  Version version = versionManager.addVersion(node);
  // WHEN
  List<VersionInfo> versionList = VersionUtil.getVersionInfoList(node);
  // THEN
  assertEquals(1, versionList.size());
  assertEquals(version.getName(), versionList.get(0).getVersionName());
}

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

/**
   * Returns the versionable node.
   */ 
  public NodeIterator execute() throws Exception {
    Node n = getNode();
    String name = n.getBaseVersion().getName();
    String label = getRandomText(3);
    log.info(n.getPath() + ":" + name + " -> " + label);
    n.getVersionHistory().addVersionLabel(name, label, true);
    return wrapWithIterator(n);
  }
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework-compatibility

@Test
public void testExecute() throws Exception {
  // GIVEN
  VersionManager versionMan = VersionManager.getInstance();
  versionMan.addVersion(node);
  AbstractJcrNodeAdapter item = new JcrNodeAdapter(node);
  RestorePreviousVersionAction action = new RestorePreviousVersionAction(definition, item, versionMan, subAppContext, eventBus, i18n);
  // WHEN
  action.execute();
  // THEN
  assertEquals(versionMan.getBaseVersion(node).getName(), "1.0");
}

相关文章