/** {@inheritDoc} */ public boolean canRemoveProperty(String propertyName) { return type.canRemoveProperty(propertyName); }
@Override public void checkRemoveProperty(PropertyState property) throws RepositoryException { PropertyDefinition definition = getDefinition(property); if (definition.isProtected()) { return; } if (!definition.getDeclaringNodeType().canRemoveProperty(property.getName())) { throw new ConstraintViolationException("Cannot remove property '" + property.getName() + '\''); } }
@Override public void checkRemoveProperty(PropertyState property) throws RepositoryException { PropertyDefinition definition = getDefinition(property); if (definition.isProtected()) { return; } if (!definition.getDeclaringNodeType().canRemoveProperty(property.getName())) { throw new ConstraintViolationException("Cannot remove property '" + property.getName() + '\''); } }
@Override public void checkRemoveProperty(PropertyState property) throws RepositoryException { PropertyDefinition definition = getDefinition(property); if (definition.isProtected()) { return; } if (!definition.getDeclaringNodeType().canRemoveProperty(property.getName())) { throw new ConstraintViolationException("Cannot remove property '" + property.getName() + '\''); } }
/** * Tests if {@link NodeType#canRemoveItem(String)} and * {@link NodeType#canRemoveProperty(String)} return false * if the specified property is a protected property. */ public void testProtectedProperty() throws NotExecutableException, RepositoryException { PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, true, false); if (propDef == null) { throw new NotExecutableException("No protected property def found."); } NodeType type = propDef.getDeclaringNodeType(); assertFalse("NodeType.canRemoveItem(String itemName) must return false " + "if itemName is a protected property def.", type.canRemoveItem(propDef.getName())); assertFalse("NodeType.canRemoveProperty(String propertyName) must return false " + "if propertyName is a protected property def.", type.canRemoveProperty(propDef.getName())); }
/** * Tests if {@link NodeType#canRemoveItem(String)} and * {@link NodeType#canRemoveProperty(String)} return false * if the specified property is a mandatory property. */ public void testMandatoryProperty() throws NotExecutableException, RepositoryException { PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, false, true); if (propDef == null) { throw new NotExecutableException("No mandatory property def found."); } NodeType type = propDef.getDeclaringNodeType(); assertFalse("NodeType.canRemoveItem(String itemName) must return false " + "if itemName is a mandatory property def.", type.canRemoveItem(propDef.getName())); assertFalse("NodeType.canRemoveProperty(String propertyName) must return false " + "if propertyName is a mandatory property def.", type.canRemoveProperty(propDef.getName())); }
/** * Tests that {@link NodeType#canRemoveItem(String)} and * {@link NodeType#canRemoveProperty(String)} return true * if the specified property is not a protected nor a mandatory * property. */ public void testRemovableProperty() throws NotExecutableException, RepositoryException { PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, false, false); if (propDef == null) { throw new NotExecutableException("No mandatory property def found."); } NodeType type = propDef.getDeclaringNodeType(); assertTrue("NodeType.canRemoveItem(String itemName) must return true " + "if itemName is not a protected nor a mandatory property def.", type.canRemoveItem(propDef.getName())); assertTrue("NodeType.canRemoveProperty(String propertyName) must return true " + "if propertyName is not a protected nor a mandatory property def.", type.canRemoveProperty(propDef.getName())); }