leaf = new ReferenceAttributeLeaf(attributeName, dt); } else { leaf = new AttributeLeaf(attributeName, dt);
/** * Returns the map of attributes names and values for attributes which * value is neither null or the default value. These attributes are * considered having a non default value and must be written out. * * @return map of attributes indexed by name that must be persisted */ private Map<String, String> attributesToWrite() { Map<String, String> attributesToWrite = new HashMap<String, String>(); Map<String, String> localAttr = new HashMap<String, String>(attributes); for (Map.Entry<String, String> a : localAttr.entrySet()) { ConfigModel.AttributeLeaf am = model.attributes.get(a.getKey()); String dv = am.getDefaultValue(); if (dv==null || !dv.equals(a.getValue())) { attributesToWrite.put(a.getKey(), a.getValue()); } } return attributesToWrite; }
private void handleValidation(ConfigModel.Property property, Object value) throws ConstraintViolationException { // First check for dataType constraints -- as was done for v3 Prelude // These validations could be transformed into BV custom annotations // such as AssertBoolean, AssertInteger etc. But since GUI and other // config clients such as AMX need dataType key in @Attribute it's been // decided to validate using existing annotation information Set<ConstraintViolation<?>> constraintViolations = new HashSet<ConstraintViolation<?>>(); if (property instanceof ConfigModel.AttributeLeaf) { ConfigModel.AttributeLeaf al = (ConfigModel.AttributeLeaf)property; if (!al.isReference()) { ConstraintViolation cv = validateDataType(al, value.toString()); if (cv!=null) { constraintViolations.add(cv); } } } constraintViolations.addAll( beanValidator.validateValue( bean.getProxyType(), toCamelCase(property.xmlName()), value)); handleValidationException(constraintViolations); }
leaf = new ReferenceAttributeLeaf(attributeName, dt); } else { leaf = new AttributeLeaf(attributeName, dt);
leaf = new ReferenceAttributeLeaf(attributeName, dt); } else { leaf = new AttributeLeaf(attributeName, dt);
leaf = new ReferenceAttributeLeaf(attributeName, dt); } else { leaf = new AttributeLeaf(attributeName, dt);
leaf = new ReferenceAttributeLeaf(attributeName, dt); } else { leaf = new AttributeLeaf(attributeName, dt);
private void handleValidation(ConfigModel.Property property, Object value) throws ConstraintViolationException { // First check for dataType constraints -- as was done for v3 Prelude // These validations could be transformed into BV custom annotations // such as AssertBoolean, AssertInteger etc. But since GUI and other // config clients such as AMX need dataType key in @Attribute it's been // decided to validate using existing annotation information Set<ConstraintViolation<?>> constraintViolations = new HashSet<ConstraintViolation<?>>(); if (property instanceof ConfigModel.AttributeLeaf) { ConfigModel.AttributeLeaf al = (ConfigModel.AttributeLeaf)property; if (!al.isReference()) { ConstraintViolation cv = validateDataType(al, value.toString()); if (cv!=null) { constraintViolations.add(cv); } } } constraintViolations.addAll( beanValidator.validateValue( bean.getProxyType(), toCamelCase(property.xmlName()), value)); handleValidationException(constraintViolations); }
private void handleValidation(ConfigModel.Property property, Object value) throws ConstraintViolationException { // First check for dataType constraints -- as was done for v3 Prelude // These validations could be transformed into BV custom annotations // such as AssertBoolean, AssertInteger etc. But since GUI and other // config clients such as AMX need dataType key in @Attribute it's been // decided to validate using existing annotation information Set<ConstraintViolation<?>> constraintViolations = new HashSet<ConstraintViolation<?>>(); if (property instanceof ConfigModel.AttributeLeaf) { ConfigModel.AttributeLeaf al = (ConfigModel.AttributeLeaf)property; if (!al.isReference()) { ConstraintViolation cv = validateDataType(al, value.toString()); if (cv!=null) { constraintViolations.add(cv); } } } constraintViolations.addAll( beanValidator.validateValue( bean.getProxyType(), toCamelCase(property.xmlName()), value)); handleValidationException(constraintViolations); }
private void handleValidation(ConfigModel.Property property, Object value) throws ConstraintViolationException { // First check for dataType constraints -- as was done for v3 Prelude // These validations could be transformed into BV custom annotations // such as AssertBoolean, AssertInteger etc. But since GUI and other // config clients such as AMX need dataType key in @Attribute it's been // decided to validate using existing annotation information Set<ConstraintViolation<?>> constraintViolations = new HashSet<ConstraintViolation<?>>(); if (property instanceof ConfigModel.AttributeLeaf) { ConfigModel.AttributeLeaf al = (ConfigModel.AttributeLeaf)property; if (!al.isReference()) { ConstraintViolation cv = validateDataType(al, value.toString()); if (cv!=null) { constraintViolations.add(cv); } } } constraintViolations.addAll( beanValidator.validateValue( bean.getProxyType(), toCamelCase(property.xmlName()), value)); handleValidationException(constraintViolations); }
/** * Returns the map of attributes names and values for attributes which * value is neither null or the default value. These attributes are * considered having a non default value and must be written out. * * @return map of attributes indexed by name that must be persisted */ private Map<String, String> attributesToWrite() { Map<String, String> attributesToWrite = new HashMap<String, String>(); Map<String, String> localAttr = new HashMap<String, String>(attributes); for (Map.Entry<String, String> a : localAttr.entrySet()) { ConfigModel.AttributeLeaf am = model.attributes.get(a.getKey()); String dv = am.getDefaultValue(); if (dv==null || !dv.equals(a.getValue())) { attributesToWrite.put(a.getKey(), a.getValue()); } } return attributesToWrite; }
/** * Returns the map of attributes names and values for attributes which * value is neither null or the default value. These attributes are * considered having a non default value and must be written out. * * @return map of attributes indexed by name that must be persisted */ private Map<String, String> attributesToWrite() { Map<String, String> attributesToWrite = new HashMap<String, String>(); Map<String, String> localAttr = new HashMap<String, String>(attributes); for (Map.Entry<String, String> a : localAttr.entrySet()) { ConfigModel.AttributeLeaf am = model.attributes.get(a.getKey()); String dv = am.getDefaultValue(); if (dv==null || !dv.equals(a.getValue())) { attributesToWrite.put(a.getKey(), a.getValue()); } } return attributesToWrite; }
/** * Returns the map of attributes names and values for attributes which * value is neither null or the default value. These attributes are * considered having a non default value and must be written out. * * @return map of attributes indexed by name that must be persisted */ private Map<String, String> attributesToWrite() { Map<String, String> attributesToWrite = new HashMap<String, String>(); Map<String, String> localAttr = new HashMap<String, String>(attributes); for (Map.Entry<String, String> a : localAttr.entrySet()) { ConfigModel.AttributeLeaf am = model.attributes.get(a.getKey()); String dv = am.getDefaultValue(); if (dv==null || !dv.equals(a.getValue())) { attributesToWrite.put(a.getKey(), a.getValue()); } } return attributesToWrite; }
/** * Returns the map of attributes names and values for attributes which * value is neither null or the default value. These attributes are * considered having a non default value and must be written out. * * @return map of attributes indexed by name that must be persisted */ private Map<String, String> attributesToWrite() { Map<String, String> attributesToWrite = new HashMap<String, String>(); Map<String, String> localAttr = new HashMap<String, String>(attributes); for (Map.Entry<String, String> a : localAttr.entrySet()) { ConfigModel.AttributeLeaf am = model.attributes.get(a.getKey()); String dv = am.getDefaultValue(); if (dv==null || !dv.equals(a.getValue())) { attributesToWrite.put(a.getKey(), a.getValue()); } } return attributesToWrite; }
/** * Obtians the attribute value without variable expansion. * * @return * null if the attribute is not found. */ public String rawAttribute(String name) { String value = attributes.get(name); if (value==null && model.attributes.containsKey(name)) { value = model.attributes.get(name).getDefaultValue(); } return value; }
/** * Obtians the attribute value without variable expansion. * * @return * null if the attribute is not found. */ public String rawAttribute(String name) { String value = attributes.get(name); if (value==null && model.attributes.containsKey(name)) { value = model.attributes.get(name).getDefaultValue(); } return value; }
/** * Obtians the attribute value without variable expansion. * * @return * null if the attribute is not found. */ public String rawAttribute(String name) { String value = attributes.get(name); if (value==null && model.attributes.containsKey(name)) { value = model.attributes.get(name).getDefaultValue(); } return value; }
/** * Gets the value from {@link Dom} in the specified type. * * @param dom The DOM instance to get the value from. * @param returnType The expected type of the returned object. * Valid types are (1) primitive and 'leaf' Java types, such as {@link String}, * (2) {@link ConfigBeanProxy}, (3) and its collections. */ public Object get(Dom dom, Type returnType) { String v = dom.attribute(xmlName); return convertLeafValue(dom, Types.erasure(returnType), v); }
/** * Obtians the attribute value without variable expansion. * * @return * null if the attribute is not found. */ public String rawAttribute(String name) { String value = attributes.get(name); if (value==null && model.attributes.containsKey(name)) { value = model.attributes.get(name).getDefaultValue(); } return value; }
@Override public Object get(Dom dom, Type rt) { Object value = super.get(dom, rt); if (value == null) return (dv); return value; } public String getDefaultValue() {