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

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

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

Version.getProperty介绍

暂无

代码示例

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

/**
 * Tests if <code>Version.getProperty(String)</code> returns the right
 * property
 */
public void testGetProperty() throws Exception {
  assertTrue("Version.getProperty(String) does not return property jcr:created", version.getProperty(jcrCreated).getName().equals(jcrCreated));
}

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

/**
 * Test if the nodes jcr:predecessors property is copied to the new version
 * on checkin.
 *
 * @throws RepositoryException
 */
public void testPredecessorIsCopiedToNewVersionJcr2() throws RepositoryException {
  Value[] nPredecessorsValue = versionableNode.getProperty(jcrPredecessors).getValues();
  VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
  String path = versionableNode.getPath();
  Version v = versionManager.checkin(path);
  Value[] vPredecessorsValue = v.getProperty(jcrPredecessors).getValues();
  assertEquals("The versionable checked-out node's jcr:predecessors property is copied to the new version on checkin.", Arrays.asList(nPredecessorsValue), Arrays.asList(vPredecessorsValue));
}

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

/**
 * Test if the nodes jcr:predecessors property is copied to the new version
 * on Node.checkin().
 *
 * @throws RepositoryException
 */
@SuppressWarnings("deprecation")
public void testPredecessorIsCopiedToNewVersion() throws RepositoryException {
  Value[] nPredecessorsValue = versionableNode.getProperty(jcrPredecessors).getValues();
  Version v = versionableNode.checkin();
  Value[] vPredecessorsValue = v.getProperty(jcrPredecessors).getValues();
  assertEquals("The versionable checked-out node's jcr:predecessors property is copied to the new version on checkin.", Arrays.asList(nPredecessorsValue), Arrays.asList(vPredecessorsValue));
}

代码示例来源:origin: openl-tablets/openl-tablets

public JcrVersion(Version version) throws RepositoryException {
  // storing node's properties into variables to reduce 'throws' for
  // getters
  Node frozen = version.getNode(JcrNT.FROZEN_NODE);
  initVersion(frozen);
  lastModified = version.getProperty("jcr:created").getDate().getTime();
}

代码示例来源:origin: org.openl.rules/org.openl.rules.repository.jcr

public JcrVersion(Version version) throws RepositoryException {
  // storing node's properties into variables to reduce 'throws' for
  // getters
  Node frozen = version.getNode(JcrNT.FROZEN_NODE);
  initVersion(frozen);
  lastModified = version.getProperty("jcr:created").getDate().getTime();
}

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

/**
 * Tests if <code>Version.getUUID()</code> returns the right UUID
 */
public void testGetUUID() throws Exception {
  List<Value> successorValues = Arrays.asList(versionableNode.getVersionHistory().getRootVersion().getProperty(jcrSuccessors).getValues());
  assertTrue("Version.getUUID() did not return the right UUID", successorValues.contains(superuser.getValueFactory().createValue(version)));
}

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

/**
 * Returns the date this version was created. This corresponds to the value
 * of the jcr:created property in the nt:version node that represents this
 * version.
 */
public void testGetCreatedCheckAgainstProperty() throws RepositoryException {
  // create version
  versionableNode.checkout();
  Version version = versionableNode.checkin();
  Calendar calGetCreated = version.getCreated();
  Calendar calCreatedProp = version.getProperty(jcrCreated).getValue().getDate();
  assertEquals("Method getCreated() should return value of the jcr:created property.", calGetCreated, calCreatedProp);
}

代码示例来源:origin: ModeShape/modeshape

public void testShouldCreateProperHistoryForVersionableChildOfNodeWithVersionSemantics() throws Exception {
  session = getHelper().getReadWriteSession();
  Node node = getTestRoot(session).addNode("checkInTest", "modetest:versionTest");
  session.save();
  /*
  * Create /checkinTest/versionNode/copyNode with versionNode and copyNode being versionable. This should
  * create a child of type nt:childVersionedNode under the frozen node.
  */
  Node versionNode = node.addNode("versionNode", "modetest:versionTest");
  versionNode.addMixin("mix:versionable");
  Node copyNode = versionNode.addNode("copyNode", "modetest:versionTest");
  copyNode.addMixin("mix:versionable");
  copyNode.setProperty("ignoreProp", "ignorePropValue");
  copyNode.setProperty("copyProp", "copyPropValue");
  session.save();
  Version version = checkin(versionNode);
  assertThat(version.getProperty("jcr:frozenNode/copyNode/jcr:primaryType").getString(), is("nt:frozenNode"));
  assertThat(version.getProperty("jcr:frozenNode/copyNode/jcr:frozenPrimaryType").getString(), is("modetest:versionTest"));
  try {
    version.getProperty("jcr:frozenNode/copyNode/copyProp");
  } catch (PathNotFoundException pnfe) {
    fail("Property should be copied to versionable child of versioned node, because copyNode was copied (see Section 3.13.9 Item 5 of JSR-283)");
  }
  try {
    version.getProperty("jcr:frozenNode/copyNode/ignoreProp");
  } catch (PathNotFoundException pnfe) {
    fail("Ignored property should be copied to versionable child of versioned node when in a COPY subgraph");
  }
}

代码示例来源:origin: ModeShape/modeshape

Version version2 = checkin(versionNode);
assertThat(version.getProperty("jcr:frozenNode/versionNode/jcr:primaryType").getString(), is("nt:versionedChild"));
assertThat(version.getProperty("jcr:frozenNode/copyNode/abortNode/copyProp").getString(), is("copyPropValue"));
try {
  version.getProperty("jcr:frozenNode/abortNode/ignoreProp");
  fail("Property with OnParentVersionAction of IGNORE should not have been copied");
} catch (PathNotFoundException pnfe) {
assertThat(version2.getProperty("jcr:frozenNode/jcr:primaryType").getString(), is("nt:frozenNode"));
assertThat(version2.getProperty("jcr:frozenNode/jcr:frozenPrimaryType").getString(), is("modetest:versionTest"));
assertThat(version2.getProperty("jcr:frozenNode/jcr:frozenUuid").getString(), is(versionNode.getIdentifier()));

代码示例来源:origin: org.onehippo.cms7/hippo-cms-api

Calendar nodeCreated = version.getProperty("jcr:created").getDate();
if (!node.hasProperty(HippoNodeType.HIPPO_PATHS)) {
  throw new ItemNotFoundException("No hippo:paths property present");

代码示例来源:origin: ModeShape/modeshape

@SuppressWarnings( "deprecation" )
@Test
@FixFor( "MODE-1775" )
public void shouldFindVersionNodeByIdentifierAndByUuid() throws Exception {
  registerNodeTypes(session, "cnd/versioning.cnd");
  // Set up parent node and check it in ...
  Node parent = session.getRootNode().addNode("versionableNode", "ver:versionable");
  parent.setProperty("versionProp", "v");
  parent.setProperty("copyProp", "c");
  parent.setProperty("ignoreProp", "i");
  session.save();
  Version version = versionManager.checkin(parent.getPath());
  // Now look for the version node by identifier, using the different ways to get an identifier ...
  assertThat(session.getNodeByIdentifier(version.getIdentifier()), is((Node)version));
  assertThat(session.getNodeByIdentifier(version.getProperty("jcr:uuid").getString()), is((Node)version));
  assertThat(session.getNodeByUUID(version.getProperty("jcr:uuid").getString()), is((Node)version));
}

代码示例来源:origin: ModeShape/modeshape

assertThat(version.getProperty("jcr:frozenNode/copyProp").getString(), is("copyPropValue"));
assertThat(version.getProperty("jcr:frozenNode/versionProp").getString(), is("versionPropValue"));
  version.getProperty("jcr:frozenNode/ignoreProp");
  fail("Frozen version should not record a property that has an OnParentVersionAction of IGNORE");
} catch (PathNotFoundException pnfe) {
assertThat(version.getProperty("jcr:frozenNode/copyProp").getString(), is("copyPropValue"));
assertThat(version.getProperty("jcr:frozenNode/versionProp").getString(), is("versionPropValue"));
  version.getProperty("ignoreProp");
  fail("Frozen version should not record a property that has an OnParentVersionAction of IGNORE");
} catch (PathNotFoundException pnfe) {

代码示例来源: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"));
}

相关文章