Set aliases = new HashSet();
Class clazz = propertyMapping.getPropertyType();
aliases.add(((CompassClassMapping) mappingByClass.get(clazz)).getAlias());
GrailsDomainClassProperty domainClassProperty = GrailsDomainClassUtils.getGrailsDomainClassProperty(grailsDomainClasses, mappedClass, propertyMapping.getPropertyName());
GrailsDomainClass dc = domainClassProperty.getReferencedDomainClass();
if (dc == null) {
Class elementClass = SearchableUtils.getElementClass(domainClassProperty);
dc = GrailsDomainClassUtils.getGrailsDomainClass(elementClass, grailsDomainClasses);
if (dc == null) {
LOG.warn("Cannot find domain class for property '" + domainClassProperty.getName() +
"' of class '" + domainClassProperty.getDomainClass().getFullName());
continue;
}
}
Collection clazzes = GrailsDomainClassUtils.getClazzes(dc.getSubClasses());
for (Iterator citer = clazzes.iterator(); citer.hasNext(); ) {
CompassClassMapping mapping = (CompassClassMapping) mappingByClass.get(citer.next());
if (mapping != null) {
aliases.add(mapping.getAlias());
}