Search in sources :

Example 1 with PropertyTypeOverrideProperty

use of eu.esdihumboldt.hale.common.schema.model.impl.PropertyTypeOverrideProperty in project hale by halestudio.

the class CustomTypeContentHelper method replaceTypeForProperty.

private static void replaceTypeForProperty(PropertyDefinition propDef, DefinitionGroup propParent, TypeDefinition newPropertyType) {
    PropertyDefinition newProperty;
    if (propDef instanceof PropertyTypeOverrideProperty) {
        newProperty = new PropertyTypeOverrideProperty(((PropertyTypeOverrideProperty) propDef).getDecoratedProperty(), newPropertyType);
    } else {
        newProperty = new PropertyTypeOverrideProperty(propDef, newPropertyType);
    }
    if (propParent instanceof DefaultTypeDefinition) {
        DefaultTypeDefinition type = (DefaultTypeDefinition) propParent;
        type.overrideChild(newProperty);
    } else // else if (propParent instanceof DefaultGroupPropertyDefinition) {
    // // TODO
    // }
    {
        log.error("Could not update custom content property because of unsupported parent definition group");
    }
}
Also used : DefaultTypeDefinition(eu.esdihumboldt.hale.common.schema.model.impl.DefaultTypeDefinition) PropertyTypeOverrideProperty(eu.esdihumboldt.hale.common.schema.model.impl.PropertyTypeOverrideProperty) DefaultPropertyDefinition(eu.esdihumboldt.hale.common.schema.model.impl.DefaultPropertyDefinition) DefaultGroupPropertyDefinition(eu.esdihumboldt.hale.common.schema.model.impl.DefaultGroupPropertyDefinition) PropertyDefinition(eu.esdihumboldt.hale.common.schema.model.PropertyDefinition)

Aggregations

PropertyDefinition (eu.esdihumboldt.hale.common.schema.model.PropertyDefinition)1 DefaultGroupPropertyDefinition (eu.esdihumboldt.hale.common.schema.model.impl.DefaultGroupPropertyDefinition)1 DefaultPropertyDefinition (eu.esdihumboldt.hale.common.schema.model.impl.DefaultPropertyDefinition)1 DefaultTypeDefinition (eu.esdihumboldt.hale.common.schema.model.impl.DefaultTypeDefinition)1 PropertyTypeOverrideProperty (eu.esdihumboldt.hale.common.schema.model.impl.PropertyTypeOverrideProperty)1