Search in sources :

Example 1 with Property

use of com.developmentontheedge.beans.model.Property in project be5 by DevelopmentOnTheEdge.

the class BeModelElementSupport method mergeThis.

protected void mergeThis(BeModelElement other, boolean inherit) {
    if (inherit) {
        this.prototype = other;
    } else {
        this.prototype = null;
        Set<String> customizableProperties = new HashSet<>(getCustomizableProperties());
        customizableProperties.removeAll(getCustomizedProperties());
        for (String customizableProperty : customizableProperties) {
            try {
                Object value = Beans.getBeanPropertyValue(other, customizableProperty);
                ComponentModel info = ComponentFactory.getModel(this, ComponentFactory.Policy.DEFAULT);
                Property property = info.findProperty(customizableProperty);
                if (property != null) {
                    if (!customizableProperty.equals("roles")) {
                        property.setValue(value);
                    }
                }
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
}
Also used : ComponentModel(com.developmentontheedge.beans.model.ComponentModel) Property(com.developmentontheedge.beans.model.Property) ProjectElementException(com.developmentontheedge.be5.metadata.exception.ProjectElementException) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Aggregations

ProjectElementException (com.developmentontheedge.be5.metadata.exception.ProjectElementException)1 ComponentModel (com.developmentontheedge.beans.model.ComponentModel)1 Property (com.developmentontheedge.beans.model.Property)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1