private static boolean meetsValueConstraints(Value[] values, String[] constraints) { if (constraints == null || constraints.length == 0) { return true; } // Constraints must be met by all values for (Value value : values) { if (!meetsValueConstraints(value, constraints)) { return false; } } return true; }
private static boolean meetsValueConstraints(Value[] values, String[] constraints) { if (constraints == null || constraints.length == 0) { return true; } // Constraints must be met by all values for (Value value : values) { if (!meetsValueConstraints(value, constraints)) { return false; } } return true; }
private static boolean meetsValueConstraints(Value[] values, String[] constraints) { if (constraints == null || constraints.length == 0) { return true; } // Constraints must be met by all values for (Value value : values) { if (!meetsValueConstraints(value, constraints)) { return false; } } return true; }
@Override public boolean canSetProperty(String propertyName, Value value) { if (value == null) { return canRemoveProperty(propertyName); } try { EffectiveNodeTypeImpl effective = new EffectiveNodeTypeImpl(this, getManager()); PropertyDefinition def = effective.getPropertyDefinition( propertyName, false, value.getType(), false); return !def.isProtected() && meetsTypeConstraints(value, def.getRequiredType()) && meetsValueConstraints(value, def.getValueConstraints()); } catch (RepositoryException e) { // TODO don't use exceptions for flow control. Use internal method in ReadOnlyNodeTypeManager instead. log.debug(e.getMessage()); return false; } }
@Override public boolean canSetProperty(String propertyName, Value[] values) { if (values == null) { return canRemoveProperty(propertyName); } try { int type = (values.length == 0) ? PropertyType.STRING : values[0].getType(); EffectiveNodeTypeImpl effective = new EffectiveNodeTypeImpl(this, getManager()); PropertyDefinition def = effective.getPropertyDefinition( propertyName, true, type, false); return !def.isProtected() && meetsTypeConstraints(values, def.getRequiredType()) && meetsValueConstraints(values, def.getValueConstraints()); } catch (RepositoryException e) { // TODO don't use exceptions for flow control. Use internal method in ReadOnlyNodeTypeManager instead. log.debug(e.getMessage()); return false; } }
@Override public boolean canSetProperty(String propertyName, Value value) { if (value == null) { return canRemoveProperty(propertyName); } try { EffectiveNodeTypeImpl effective = new EffectiveNodeTypeImpl(this, getManager()); PropertyDefinition def = effective.getPropertyDefinition( propertyName, false, value.getType(), false); return !def.isProtected() && meetsTypeConstraints(value, def.getRequiredType()) && meetsValueConstraints(value, def.getValueConstraints()); } catch (RepositoryException e) { // TODO don't use exceptions for flow control. Use internal method in ReadOnlyNodeTypeManager instead. log.debug(e.getMessage()); return false; } }
@Override public boolean canSetProperty(String propertyName, Value[] values) { if (values == null) { return canRemoveProperty(propertyName); } try { int type = (values.length == 0) ? PropertyType.STRING : values[0].getType(); EffectiveNodeTypeImpl effective = new EffectiveNodeTypeImpl(this, getManager()); PropertyDefinition def = effective.getPropertyDefinition( propertyName, true, type, false); return !def.isProtected() && meetsTypeConstraints(values, def.getRequiredType()) && meetsValueConstraints(values, def.getValueConstraints()); } catch (RepositoryException e) { // TODO don't use exceptions for flow control. Use internal method in ReadOnlyNodeTypeManager instead. log.debug(e.getMessage()); return false; } }
@Override public boolean canSetProperty(String propertyName, Value value) { if (value == null) { return canRemoveProperty(propertyName); } try { EffectiveNodeTypeImpl effective = new EffectiveNodeTypeImpl(this, getManager()); PropertyDefinition def = effective.getPropertyDefinition( propertyName, false, value.getType(), false); return !def.isProtected() && meetsTypeConstraints(value, def.getRequiredType()) && meetsValueConstraints(value, def.getValueConstraints()); } catch (RepositoryException e) { // TODO don't use exceptions for flow control. Use internal method in ReadOnlyNodeTypeManager instead. log.debug(e.getMessage()); return false; } }
@Override public boolean canSetProperty(String propertyName, Value[] values) { if (values == null) { return canRemoveProperty(propertyName); } try { int type = (values.length == 0) ? PropertyType.STRING : values[0].getType(); EffectiveNodeTypeImpl effective = new EffectiveNodeTypeImpl(this, getManager()); PropertyDefinition def = effective.getPropertyDefinition( propertyName, true, type, false); return !def.isProtected() && meetsTypeConstraints(values, def.getRequiredType()) && meetsValueConstraints(values, def.getValueConstraints()); } catch (RepositoryException e) { // TODO don't use exceptions for flow control. Use internal method in ReadOnlyNodeTypeManager instead. log.debug(e.getMessage()); return false; } }