Search in sources :

Example 1 with XmlAppInfo

use of eu.esdihumboldt.hale.io.xsd.constraint.XmlAppInfo in project hale by halestudio.

the class XmlSchemaReader method setMetadata.

/**
 * Set the metadata for a definition
 *
 * @param definition the definition
 * @param annotated the XML annotated object
 * @param schemaLocation the schema location
 */
public static void setMetadata(AbstractDefinition<?> definition, XmlSchemaAnnotated annotated, String schemaLocation) {
    definition.setDescription(XMLSchemaIO.getDescription(annotated));
    List<XmlSchemaAppInfo> appInfo = XMLSchemaIO.getAppInfo(annotated);
    if (appInfo != null) {
        XmlAppInfo constraint = new XmlAppInfo(appInfo);
        if (definition instanceof DefaultPropertyDefinition) {
            ((DefaultPropertyDefinition) definition).setConstraint(constraint);
        } else if (definition instanceof DefaultGroupPropertyDefinition) {
            ((DefaultGroupPropertyDefinition) definition).setConstraint(constraint);
        } else if (definition instanceof DefaultTypeDefinition) {
            ((DefaultTypeDefinition) definition).setConstraint(constraint);
        }
    }
    definition.setLocation(createLocationURI(schemaLocation, annotated));
}
Also used : DefaultTypeDefinition(eu.esdihumboldt.hale.common.schema.model.impl.DefaultTypeDefinition) DefaultPropertyDefinition(eu.esdihumboldt.hale.common.schema.model.impl.DefaultPropertyDefinition) DefaultGroupPropertyDefinition(eu.esdihumboldt.hale.common.schema.model.impl.DefaultGroupPropertyDefinition) XmlAppInfo(eu.esdihumboldt.hale.io.xsd.constraint.XmlAppInfo) XmlSchemaAppInfo(org.apache.ws.commons.schema.XmlSchemaAppInfo)

Aggregations

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 XmlAppInfo (eu.esdihumboldt.hale.io.xsd.constraint.XmlAppInfo)1 XmlSchemaAppInfo (org.apache.ws.commons.schema.XmlSchemaAppInfo)1