use of eu.esdihumboldt.hale.schemaprovider.model.AttributeDefinition in project hale by halestudio.
the class AlignmentToModelAlignmentDigester method createAttributePath.
/**
* Create an attribute path from an {@link IDetailedAbout}
*
* @param about the about
* @param elements the available elements
* @return the attribute path
* @throws TranslationException if the attribute path cannot be resolved
*/
private static GmlAttributePath createAttributePath(IDetailedAbout about, Map<String, SchemaElement> elements) throws TranslationException {
GmlAttributePath binding = new GmlAttributePath();
// get the parent class for the entity
// $NON-NLS-1$
SchemaElement entityParent = elements.get(about.getNamespace() + "/" + about.getFeatureClass());
if (entityParent == null) {
// $NON-NLS-1$ //$NON-NLS-2$
throw new TranslationException("Element " + about.getFeatureClass() + " not found");
}
TypeDefinition type = entityParent.getType();
List<String> nestedParts = about.getProperties();
for (String attributeName : nestedParts) {
AttributeDefinition attDef = type.getAttribute(attributeName);
if (attDef == null) {
// $NON-NLS-1$ //$NON-NLS-2$
throw new TranslationException("Attribute " + attributeName + " not found");
}
GmlAttribute attribute = new GmlAttribute(attDef);
binding.add(attribute);
type = attDef.getAttributeType();
}
return binding;
}
Aggregations