org.apache.jackrabbit.oak.api.Tree.removeProperty()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(108)

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

Tree.removeProperty介绍

[英]Remove the property with the given name. This method has no effect if a property of the given name does not exist.
[中]删除具有给定名称的属性。如果给定名称的属性不存在,则此方法无效。

代码示例

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
  public boolean remove() {
    parent.removeProperty(name);
    return true;
  }
}

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

public IndexDefinitionBuilder async(String ... asyncVals){
  tree.removeProperty("async");
  tree.setProperty("async", asList(asyncVals), STRINGS);
  return this;
}

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

/**
 * Remove the property
 */
@Override
public boolean remove() {
  if (parent.hasProperty(name)) {
    parent.removeProperty(name);
    return true;
  } else {
    return false;
  }
}

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

private void updateImpersonatorNames(@NotNull Tree userTree, @NotNull Set<String> principalNames) {
  if (principalNames.isEmpty()) {
    userTree.removeProperty(REP_IMPERSONATORS);
  } else {
    userTree.setProperty(REP_IMPERSONATORS, principalNames, Type.STRINGS);
  }
}

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

public IndexDefinitionBuilder async(String ... asyncVals){
  tree.removeProperty("async");
  tree.setProperty("async", asList(asyncVals), STRINGS);
  return this;
}

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

@Override
public void apply(Root root) throws RemoteCommitException {
  logger.debug("performing 'unset' operation on path={}, name={}", path, name);
  Tree tree = root.getTree(path);
  if (!tree.exists()) {
    throw new RemoteCommitException("tree does not exists");
  }
  if (!tree.hasProperty(name)) {
    throw new RemoteCommitException("property does not exist");
  }
  tree.removeProperty(name);
}

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

@Test(expected = RepositoryException.class)
public void testGetPrincipalNamePropertyMissing() throws Exception {
  Tree t = root.getTree(authorizable.getPath());
  t.removeProperty(UserConstants.REP_PRINCIPAL_NAME);
  // getPrincipalName must throw
  authorizable.getPrincipalName();
}}

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

@Test
public void testDeleteDeletedProperty() throws CommitFailedException {
  theirRoot.getTree("/").removeProperty("a");
  ourRoot.getTree("/").removeProperty("a");
  theirRoot.commit();
  ourRoot.commit();
  PropertyState p = ourRoot.getTree("/").getProperty("a");
  assertNull(p);
}

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

@Test
  public void testManualModification() throws Exception {
    // EXERCISE: fix the test case such that it passes.

    Tree jcrAllTree = PrivilegeUtil.getPrivilegesTree(root).getChild(PrivilegeConstants.JCR_ALL);

    jcrAllTree.removeProperty(PrivilegeConstants.REP_AGGREGATES);
    root.commit();
  }
}

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

@Test
public void testStartAclTreeMissingMixin() throws Exception {
  init();
  accessControlledTree.removeProperty(JcrConstants.JCR_MIXINTYPES);
  assertFalse(importer.start(aclTree));
}

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

@Test
public void testDeleteDeletedProperty() throws CommitFailedException {
  theirRoot.getTree("/").removeProperty("a");
  ourRoot.getTree("/").removeProperty("a");
  theirRoot.commit();
  ourRoot.commit();
  PropertyState p = ourRoot.getTree("/").getProperty("a");
  assertNull(p);
}

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

private void wipeGroup(Root r) throws Exception {
    UserManager um = getUserManager(r);
    Group g = (Group) um.getAuthorizable(GROUP_ID);
    r.getTree(g.getPath()).removeProperty(UserConstants.REP_MEMBERS);
    r.commit();
  }
}

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

@Override
  public void testRemoveRepExternalIdWithoutPrincipalNames() throws Exception {
    root.getTree(testUserPath).setProperty(ExternalIdentityConstants.REP_EXTERNAL_ID, "id");
    root.commit();

    root.getTree(testUserPath).removeProperty(ExternalIdentityConstants.REP_EXTERNAL_ID);
    root.commit();
  }
}

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

@Test
public void testGetVersionableMissingPathProperty() throws Exception {
  Tree versionHistory = checkNotNull(versionManager.getVersionHistory(root.getTree("/a")));
  versionHistory.removeProperty(workspaceName);
  assertNull(versionManager.getVersionable(versionHistory, workspaceName));
  assertNull(versionManager.getVersionable(versionHistory.getChild(JcrConstants.JCR_ROOTVERSION), workspaceName));
}

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

@Test
public void testRemoveRepExternalIdWithoutPrincipalNamesAsSystem() throws Exception {
  Root systemRoot = getSystemRoot();
  systemRoot.getTree(testUserPath).setProperty(ExternalIdentityConstants.REP_EXTERNAL_ID, "id");
  systemRoot.commit();
  systemRoot.getTree(testUserPath).removeProperty(ExternalIdentityConstants.REP_EXTERNAL_ID);
  systemRoot.commit();
}

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

@Test
public void testGetNumEntriesMissingPropertyThreshold() throws Exception {
  try {
    Tree everyoneTree = getPermissionRoot(EveryonePrincipal.NAME);
    everyoneTree.removeProperty(REP_NUM_PERMISSIONS);
    long max = 1;
    assertEquals(NumEntries.valueOf(everyoneTree.getChildrenCount(max), false), permissionStore.getNumEntries(EveryonePrincipal.NAME, max));
  } finally {
    root.refresh();
  }
}

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

@Test
public void testRemoveRepExternalId() {
  try {
    root.getTree(externalUserPath).removeProperty(ExternalIdentityConstants.REP_EXTERNAL_ID);
    root.commit();
    fail("Removal of rep:externalId must be detected in the default setup.");
  } catch (CommitFailedException e) {
    // success: verify nature of the exception
    assertTrue(e.isConstraintViolation());
    assertEquals(73, e.getCode());
  }
}

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

@Test
public void testChangeDeletedProperty() throws CommitFailedException {
  theirRoot.getTree("/").removeProperty("a");
  ourRoot.getTree("/").setProperty("a", OUR_VALUE);
  theirRoot.commit();
  ourRoot.commit();
  PropertyState p = ourRoot.getTree("/").getProperty("a");
  assertNull(p);
}

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

@Test
public void testChangeDeletedProperty() throws CommitFailedException {
  theirRoot.getTree("/").removeProperty("a");
  ourRoot.getTree("/").setProperty("a", OUR_VALUE);
  theirRoot.commit();
  ourRoot.commit();
  PropertyState p = ourRoot.getTree("/").getProperty("a");
  assertNotNull(p);
  assertEquals(OUR_VALUE, p.getValue(STRING));
}

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

@Test
public void testDeleteChangedProperty() throws CommitFailedException {
  theirRoot.getTree("/").setProperty("a", THEIR_VALUE);
  ourRoot.getTree("/").removeProperty("a");
  theirRoot.commit();
  ourRoot.commit();
  PropertyState p = ourRoot.getTree("/").getProperty("a");
  assertNotNull(p);
  assertEquals(THEIR_VALUE, p.getValue(STRING));
}

相关文章