@Override @Nullable public Status getStatus() { return parent.getPropertyStatus(name); }
@Override @Nullable public Status getStatus() { return parent.getPropertyStatus(name); }
@Override @CheckForNull public Status getStatus() { return parent.getPropertyStatus(name); }
/** * Utility to determine if a given group has any members. * * @param groupTree The tree of the target group. * @return {@code true} if the group has any members i.e. if it has a rep:members * property or a rep:membersList child node. */ private static boolean hasMembers(@NotNull Tree groupTree) { return groupTree.getPropertyStatus(REP_MEMBERS) != null || groupTree.hasChild(REP_MEMBERS_LIST); }
/** * Utility to determine if a given group has any members. * * @param groupTree The tree of the target group. * @return {@code true} if the group has any members i.e. if it has a rep:members * property or a rep:membersList child node. */ private static boolean hasMembers(@NotNull Tree groupTree) { return groupTree.getPropertyStatus(REP_MEMBERS) != null || groupTree.hasChild(REP_MEMBERS_LIST); }
/** * Utility to determine if a given group has any members. * * @param groupTree The tree of the target group. * @return {@code true} if the group has any members i.e. if it has a rep:members * property or a rep:membersList child node. */ private static boolean hasMembers(@Nonnull Tree groupTree) { return groupTree.getPropertyStatus(REP_MEMBERS) != null || groupTree.hasChild(REP_MEMBERS_LIST); }
/** * Determine if the group has (potentially) been modified in which case the * query can't be used: * - rep:members property has been modified * - any potential modification in the member-ref-list subtree, which is not * easy to detect => relying on pending changes on the root object * * @param groupTree The tree of the target group. * @return {@code true} if the specified group tree has an unmodified rep:members * property or if the root has pending changes. */ private boolean pendingChanges(@NotNull Tree groupTree) { Tree.Status memberPropStatus = groupTree.getPropertyStatus(REP_MEMBERS); // rep:members is new or has been modified or root has pending changes return Tree.Status.UNCHANGED != memberPropStatus || root.hasPendingChanges(); }
/** * Determine if the group has (potentially) been modified in which case the * query can't be used: * - rep:members property has been modified * - any potential modification in the member-ref-list subtree, which is not * easy to detect => relying on pending changes on the root object * * @param groupTree The tree of the target group. * @return {@code true} if the specified group tree has an unmodified rep:members * property or if the root has pending changes. */ private boolean pendingChanges(@NotNull Tree groupTree) { Tree.Status memberPropStatus = groupTree.getPropertyStatus(REP_MEMBERS); // rep:members is new or has been modified or root has pending changes return Tree.Status.UNCHANGED != memberPropStatus || root.hasPendingChanges(); }
/** * Determine if the group has (potentially) been modified in which case the * query can't be used: * - rep:members property has been modified * - any potential modification in the member-ref-list subtree, which is not * easy to detect => relying on pending changes on the root object * * @param groupTree The tree of the target group. * @return {@code true} if the specified group tree has an unmodified rep:members * property or if the root has pending changes. */ private boolean pendingChanges(@Nonnull Tree groupTree) { Tree.Status memberPropStatus = groupTree.getPropertyStatus(REP_MEMBERS); // rep:members is new or has been modified or root has pending changes return Tree.Status.UNCHANGED != memberPropStatus || root.hasPendingChanges(); }
@Test public void testGetPropertyStatus() { Tree a = root.getTree("/a"); for (String propName : hiddenProps) { assertNull(a.getPropertyStatus(propName)); } }
@Test public void testGetPropertyStatus() { Tree a = root.getTree("/a"); assertNull(a.getPropertyStatus(TreeConstants.OAK_CHILD_ORDER)); }
@Test public void propertyStatus() throws CommitFailedException { Tree tree = root.getTree("/"); tree.setProperty("new", "value1"); assertEquals(Tree.Status.NEW, tree.getPropertyStatus("new")); root.commit(); assertEquals(Tree.Status.UNCHANGED, tree.getPropertyStatus("new")); tree.setProperty("new", "value2"); assertEquals(Tree.Status.MODIFIED, tree.getPropertyStatus("new")); root.commit(); assertEquals(Tree.Status.UNCHANGED, tree.getPropertyStatus("new")); tree.removeProperty("new"); assertNull(tree.getPropertyStatus("new")); root.commit(); assertNull(tree.getPropertyStatus("new")); Tree x = root.getTree("/x"); x.setProperty("y", "value1"); x.remove(); }
@Test public void testDisconnectAfterRefresh() { Tree x = root.getTree("/x"); x.setProperty("p", "any"); Tree xx = x.addChild("xx"); xx.setProperty("q", "any"); assertEquals(Status.MODIFIED, x.getStatus()); assertEquals(Status.NEW, x.getPropertyStatus("p")); assertEquals(Status.NEW, xx.getStatus()); assertEquals(Status.NEW, xx.getPropertyStatus("q")); root.refresh(); assertEquals(Status.UNCHANGED, x.getStatus()); assertNull(x.getPropertyStatus("p")); assertFalse(xx.exists()); }
@Test public void testGetPropertyStatus() throws Exception { setupPermission("/a", testPrincipal, false, PrivilegeConstants.REP_READ_NODES); testRoot.refresh(); Tree a = testRoot.getTree("/a"); assertFalse(a.exists()); PropertyState p = a.getProperty(JcrConstants.JCR_PRIMARYTYPE); assertNotNull(p); assertEquals(Tree.Status.UNCHANGED, a.getPropertyStatus(JcrConstants.JCR_PRIMARYTYPE)); }
@Test public void testDisconnectAfterRemove() { Tree x = root.getTree("/x"); x.setProperty("p", "any"); Tree xx = x.addChild("xx"); xx.setProperty("q", "any"); assertEquals(Status.MODIFIED, x.getStatus()); assertEquals(Status.NEW, x.getPropertyStatus("p")); assertEquals(Status.NEW, xx.getStatus()); assertEquals(Status.NEW, xx.getPropertyStatus("q")); root.getTree("/x").remove(); assertFalse(x.exists()); assertFalse(xx.exists()); }