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

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

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

Version.hasNode介绍

暂无

代码示例

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

/**
 * Tests if <code>Version.hasNode(String)</code> returns the right
 * <code>boolean</code> value
 */
public void testHasNode() throws Exception {
  assertTrue("Version.hasNode(String) did not return true", version.hasNode(jcrFrozenNode));
}

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

@Override
  public Node getJCRNode() {
    // we seem to build content version from 2 different types of nodes - from Version and from jcr:frozenNode
    try {
      if (versionedNode.hasNode("jcr:frozenNode")) {
        return versionedNode.getFrozenNode();
      }
    } catch (RepositoryException e) {
      log.error("Failed to retrieve frozen node from version {}", versionedNode, e);
    }

    return versionedNode;
  }
}

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

@Test
public void checkVersionCreatedBeforeRestore() throws Exception {
  // GIVEN
  versionManager.addVersion(node);
  // change test node before restore
  node.setProperty("mgnl:template", "section");
  node.getNode("areaSubNode").remove();
  node.getSession().save();
  assertEquals(2, versionManager.getAllVersions(node).getSize());
  MockRestoreVersionAction restoreVersionAction = new MockRestoreVersionAction(definition, null, null, uiContext, formDialogPresenter, new JcrNodeAdapter(node), i18n, versionManager, eventBus, versionConfig, contentConnector);
  restoreVersionAction.execute();
  // WHEN
  restoreVersionAction.getEditorCallback().onSuccess("");
  // THEN
  assertEquals(3, versionManager.getAllVersions(node).getSize());
  Version version = versionManager.getVersion(node, "1.1");
  assertEquals(CREATED_VERSION_BEFORE_RESTORE, NodeTypes.Versionable.getComment(version));
  assertEquals("section", version.getProperty("mgnl:template").getString());
  assertFalse(version.hasNode("areaSubNode"));
}

相关文章