Search in sources :

Example 1 with PropertyTypeCondition

use of eu.esdihumboldt.hale.common.align.model.condition.PropertyTypeCondition in project hale by halestudio.

the class PropertyParameter method createConditions.

private static List<PropertyCondition> createConditions(IConfigurationElement conf) {
    List<PropertyCondition> result = new ArrayList<PropertyCondition>();
    IConfigurationElement[] children = conf.getChildren();
    if (children != null) {
        for (IConfigurationElement child : children) {
            String name = child.getName();
            if (name.equals("propertyCondition")) {
                try {
                    PropertyCondition condition = (PropertyCondition) child.createExecutableExtension("class");
                    result.add(condition);
                } catch (CoreException e) {
                    log.error("Error creating property condition from extension", e);
                }
            } else if (name.equals("bindingCondition")) {
                BindingCondition bc = createBindingCondition(child);
                if (bc != null) {
                    result.add(new PropertyTypeCondition(bc));
                }
            } else if (name.equals("geometryCondition")) {
                GeometryCondition gc = createGeometryCondition(child);
                if (gc != null) {
                    result.add(new PropertyTypeCondition(gc));
                }
            } else if (name.equals("geometryOrParentCondition")) {
                GeometryCondition gc = createGeometryCondition(child);
                if (gc != null) {
                    result.add(new PropertyOrChildrenTypeCondition(gc));
                }
            } else if (name.equals("valueCondition")) {
                String attr = child.getAttribute("allowAugmented");
                boolean allowAugmented;
                if (attr == null || attr.isEmpty()) {
                    // default value
                    allowAugmented = true;
                } else {
                    allowAugmented = Boolean.parseBoolean(attr);
                }
                if (allowAugmented) {
                    result.add(VALUE_CONDITION);
                } else {
                    result.add(VALUE_CONDITION_STRICT);
                }
            } else {
                // ignore
                log.warn("Unrecognized property condition");
            }
        }
    }
    return result;
}
Also used : PropertyCondition(eu.esdihumboldt.hale.common.align.model.condition.PropertyCondition) CoreException(org.eclipse.core.runtime.CoreException) ArrayList(java.util.ArrayList) BindingCondition(eu.esdihumboldt.hale.common.align.model.condition.impl.BindingCondition) PropertyTypeCondition(eu.esdihumboldt.hale.common.align.model.condition.PropertyTypeCondition) PropertyOrChildrenTypeCondition(eu.esdihumboldt.hale.common.align.model.condition.PropertyOrChildrenTypeCondition) GeometryCondition(eu.esdihumboldt.hale.common.align.model.condition.impl.GeometryCondition) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Aggregations

PropertyCondition (eu.esdihumboldt.hale.common.align.model.condition.PropertyCondition)1 PropertyOrChildrenTypeCondition (eu.esdihumboldt.hale.common.align.model.condition.PropertyOrChildrenTypeCondition)1 PropertyTypeCondition (eu.esdihumboldt.hale.common.align.model.condition.PropertyTypeCondition)1 BindingCondition (eu.esdihumboldt.hale.common.align.model.condition.impl.BindingCondition)1 GeometryCondition (eu.esdihumboldt.hale.common.align.model.condition.impl.GeometryCondition)1 ArrayList (java.util.ArrayList)1 CoreException (org.eclipse.core.runtime.CoreException)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1