@Test(expected = CommitFailedException.class) public void testChildNodeChangedWithChanges() throws CommitFailedException { NodeBuilder nb = EmptyNodeState.EMPTY_NODE.builder(); nb.setProperty(JCR_PRIMARYTYPE, NT_REP_PRIVILEGE, Type.NAME); NodeState privilegeDefinition = nb.getNodeState(); assertTrue(NT_REP_PRIVILEGE.equals(NodeStateUtils.getPrimaryTypeName(privilegeDefinition))); PrivilegeValidator pv = new PrivilegeValidator(root, root, getTreeProvider()); try { pv.childNodeChanged("test", privilegeDefinition, EmptyNodeState.EMPTY_NODE); } catch (CommitFailedException e) { throw assertCommitFailed(e, 41); } }
@Override public Validator childNodeChanged(String name, NodeState before, NodeState after) throws CommitFailedException { if (isPrivilegeDefinition(before) && !before.equals(after)) { throw new CommitFailedException(CONSTRAINT, 41, "Attempt to modify existing privilege definition " + name); } else { return null; } }
PrivilegeValidator extends DefaultValidator implements PrivilegeConstants { @Override public Validator childNodeChanged(String name, NodeState before, NodeState after) throws CommitFailedException { if (isPrivilegeDefinition(before) && !before.equals(after)) { throw new CommitFailedException(CONSTRAINT, 41, "Attempt to modify existing privilege definition " + name); } else { return null; } } }
PrivilegeValidator extends DefaultValidator implements PrivilegeConstants { @Override public Validator childNodeChanged(String name, NodeState before, NodeState after) throws CommitFailedException { if (isPrivilegeDefinition(before) && !before.equals(after)) { throw new CommitFailedException(CONSTRAINT, 41, "Attempt to modify existing privilege definition " + name); } else { return null; } } PrivilegeValidator(@NotNull Root before, @NotNull Root after, @NotNull TreeProvider treeProvider); }
PrivilegeValidator extends DefaultValidator implements PrivilegeConstants { @Override public Validator childNodeChanged(String name, NodeState before, NodeState after) throws CommitFailedException { if (isPrivilegeDefinition(before) && !before.equals(after)) { throw new CommitFailedException(CONSTRAINT, 41, "Attempt to modify existing privilege definition " + name); } else { return null; } } PrivilegeValidator(@NotNull Root before, @NotNull Root after, @NotNull TreeProvider treeProvider); @Override void propertyAdded(PropertyState after); @Override void propertyChanged(PropertyState before, PropertyState after); @Override void propertyDeleted(PropertyState before); @Override Validator childNodeAdded(String name, NodeState after); @Override Validator childNodeChanged(String name, NodeState before, NodeState after); @Override Validator childNodeDeleted(String name, NodeState before); }
PrivilegeValidator extends DefaultValidator implements PrivilegeConstants { @Override public Validator childNodeChanged(String name, NodeState before, NodeState after) throws CommitFailedException { if (isPrivilegeDefinition(before) && !before.equals(after)) { throw new CommitFailedException(CONSTRAINT, 41, "Attempt to modify existing privilege definition " + name); } else { return null; } } PrivilegeValidator(@NotNull Root before, @NotNull Root after, @NotNull TreeProvider treeProvider); @Override void propertyAdded(PropertyState after); @Override void propertyChanged(PropertyState before, PropertyState after); @Override void propertyDeleted(PropertyState before); @Override Validator childNodeAdded(String name, NodeState after); @Override Validator childNodeChanged(String name, NodeState before, NodeState after); @Override Validator childNodeDeleted(String name, NodeState before);  }