本文整理了Java中org.apache.jackrabbit.oak.api.Tree.hasProperty()
方法的一些代码示例,展示了Tree.hasProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.hasProperty()
方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.api.Tree
类名称:Tree
方法名:hasProperty
[英]Determine if a property state exists and is accessible.
[中]
代码示例来源:origin: apache/jackrabbit-oak
/**
* Remove the property
*/
@Override
public boolean remove() {
if (parent.hasProperty(name)) {
parent.removeProperty(name);
return true;
} else {
return false;
}
}
代码示例来源:origin: apache/jackrabbit-oak
private static boolean hasRestrictionProperty(Tree aceTree, String name) {
if (aceTree.hasProperty(name)) {
return true;
}
Tree restrictionTree = aceTree.getChild(AccessControlConstants.REP_RESTRICTIONS);
return restrictionTree.exists() && restrictionTree.hasProperty(name);
}
代码示例来源:origin: apache/jackrabbit-oak
boolean hasAny() {
if (hasAny == null) {
Tree rootTree = root.getTree(PathUtils.ROOT_PATH);
hasAny = rootTree.hasProperty(HIDDEN_TOP_CUG_CNT) || CugUtil.hasCug(rootTree);
}
return hasAny;
}
代码示例来源:origin: apache/jackrabbit-oak
private void loadExisting(Tree aggregate) {
for (Tree tree : aggregate.getChildren()){
if (tree.hasProperty(FulltextIndexConstants.AGG_PATH)) {
Include include = new Include(this, tree);
includes.put(include.getPath(), include);
}
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
public boolean matches(@NotNull Tree tree, @Nullable PropertyState property) {
boolean match = false;
// configured property name found on underlying jcr:content node has precedence
if (tree.hasChild(JcrConstants.JCR_CONTENT)) {
match = tree.getChild(JcrConstants.JCR_CONTENT).hasProperty(propertyName);
}
if (!match) {
match = tree.hasProperty(propertyName);
}
return negate ? !match : match;
}
代码示例来源:origin: org.apache.jackrabbit/oak-core
PrivilegeDefinitionWriter(@NotNull Root root) {
this.root = root;
this.bitsMgr = new PrivilegeBitsProvider(root);
Tree privilegesTree = bitsMgr.getPrivilegesTree();
if (privilegesTree.exists() && privilegesTree.hasProperty(REP_NEXT)) {
next = PrivilegeBits.getInstance(privilegesTree);
} else {
next = PrivilegeBits.NEXT_AFTER_BUILT_INS;
}
}
代码示例来源:origin: apache/jackrabbit-oak
PrivilegeDefinitionWriter(@NotNull Root root) {
this.root = root;
this.bitsMgr = new PrivilegeBitsProvider(root);
Tree privilegesTree = bitsMgr.getPrivilegesTree();
if (privilegesTree.exists() && privilegesTree.hasProperty(REP_NEXT)) {
next = PrivilegeBits.getInstance(privilegesTree);
} else {
next = PrivilegeBits.NEXT_AFTER_BUILT_INS;
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Nullable
private String getPrimaryTypeName(@NotNull Tree tree) {
String primaryTypeName = null;
if (tree.hasProperty(JcrConstants.JCR_PRIMARYTYPE)) {
primaryTypeName = TreeUtil.getPrimaryTypeName(tree);
} else if (tree.getStatus() != Status.NEW) {
// OAK-2441: for backwards compatibility with Jackrabbit 2.x try to
// read the primary type from the underlying node state.
primaryTypeName = TreeUtil.getPrimaryTypeName(RootFactory.createReadOnlyRoot(sessionDelegate.getRoot()).getTree(tree.getPath()));
}
return primaryTypeName;
}
代码示例来源:origin: apache/jackrabbit-oak
@Before
public void before() {
existingTree = Mockito.mock(Tree.class);
when(existingTree.exists()).thenReturn(true);
when(existingTree.getName()).thenReturn(PathUtils.ROOT_NAME);
when(existingTree.getPath()).thenReturn(PathUtils.ROOT_PATH);
when(existingTree.hasProperty(JcrConstants.JCR_PRIMARYTYPE)).thenReturn(true);
when(existingTree.getProperty(JcrConstants.JCR_PRIMARYTYPE)).thenReturn(PropertyStates.createProperty(JcrConstants.JCR_PRIMARYTYPE, "rep:root"));
}
代码示例来源:origin: apache/jackrabbit-oak
@NotNull
@Override
public RestrictionPattern getPattern(@Nullable String oakPath, @NotNull Tree tree) {
boolean hasRestriction = false;
for (RestrictionDefinition rd : getSupportedRestrictions(oakPath)) {
if (tree.hasProperty(rd.getName())) {
hasRestriction = true;
break;
}
}
return (hasRestriction) ? new MatchingPattern() : RestrictionPattern.EMPTY;
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testHasProperty() {
Tree a = root.getTree("/a");
for (String propName : hiddenProps) {
assertFalse(a.hasProperty(propName));
}
}
代码示例来源:origin: apache/jackrabbit-oak
private void enableIndexDefinitionIndex() throws CommitFailedException {
Tree nodetype = root.getTree("/oak:index/nodetype");
assertTrue(nodetype.exists());
List<String> nodetypes = Lists.newArrayList();
if (nodetype.hasProperty(DECLARING_NODE_TYPES)){
nodetypes = Lists.newArrayList(nodetype.getProperty(DECLARING_NODE_TYPES).getValue(Type.STRINGS));
}
nodetypes.add(INDEX_DEFINITIONS_NODE_TYPE);
nodetype.setProperty(DECLARING_NODE_TYPES, nodetypes, Type.NAMES);
nodetype.setProperty(IndexConstants.REINDEX_PROPERTY_NAME, true);
root.commit();
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testKnownMemberThresholdReached() throws Exception {
List<String> memberIds = new ArrayList();
for (int i = 0; i <= MembershipWriter.DEFAULT_MEMBERSHIP_THRESHOLD; i++) {
memberIds.add(userProvider.getContentID("m"+i));
}
groupTree.setProperty(REP_MEMBERS, memberIds, Type.STRINGS);
importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, knownMemberContentId)));
importer.processReferences();
assertEquals(1, memberRefList.getChildrenCount(100));
assertTrue(memberRefList.getChildren().iterator().next().hasProperty(REP_MEMBERS));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testKnownMemberThresholdNotReached() throws Exception {
importer.startChildInfo(createNodeInfo("memberRef", NT_REP_MEMBER_REFERENCES), ImmutableList.of(createPropInfo(REP_MEMBERS, knownMemberContentId)));
importer.processReferences();
assertTrue(groupTree.hasProperty(REP_MEMBERS));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testPropertiesCompletedIdMissing() throws Exception {
init();
Tree userTree = createUserTree();
importer.propertiesCompleted(userTree);
assertTrue(userTree.hasProperty(REP_AUTHORIZABLE_ID));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testHasNoPassword() throws Exception {
User user = createUser(null);
Tree userTree = root.getTree(user.getPath());
assertFalse(userTree.hasProperty(UserConstants.REP_PASSWORD));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testHasProperty() throws Exception {
setupPermission("/a", testPrincipal, false, PrivilegeConstants.REP_READ_PROPERTIES);
testRoot.refresh();
Tree a = testRoot.getTree("/a");
assertFalse(a.hasProperty("aProp"));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testSystemUserTree() throws Exception {
Tree t = root.getTree(createUser(null).getPath());
assertFalse(t.hasProperty(UserConstants.REP_PASSWORD));
assertEquals(UserConstants.NT_REP_SYSTEM_USER, TreeUtil.getPrimaryTypeName(t));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testCreateTokenWithExpirationParam() throws Exception {
SimpleCredentials sc = new SimpleCredentials(userId, new char[0]);
sc.setAttribute(TokenProvider.PARAM_TOKEN_EXPIRATION, 100000);
TokenInfo info = tokenProvider.createToken(sc);
assertTokenInfo(info, userId);
Tree tokenTree = getTokenTree(info);
assertNotNull(tokenTree);
assertTrue(tokenTree.exists());
assertTrue(tokenTree.hasProperty(TokenProvider.PARAM_TOKEN_EXPIRATION));
assertEquals(100000, tokenTree.getProperty(TokenProvider.PARAM_TOKEN_EXPIRATION).getValue(Type.LONG).longValue());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testSyncUserByIdUpdate() throws Exception {
ExternalIdentity externalId = idp.listUsers().next();
Authorizable a = userManager.createUser(externalId.getId(), null);
a.setProperty(DefaultSyncContext.REP_EXTERNAL_ID, valueFactory.createValue(externalId.getExternalId().getString()));
syncContext.setForceUserSync(true);
SyncResult result = syncContext.sync(externalId.getId());
assertEquals(SyncResult.Status.UPDATE, result.getStatus());
Tree t = r.getTree(a.getPath());
assertTrue(t.hasProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES));
}
内容来源于网络,如有侵权,请联系作者删除!