use of org.grails.datastore.mapping.model.types.Association in project grails-core by grails.
the class DefaultGrailsDomainClass method getAssociations.
/**
* Retrieves a list of associations
*
* @deprecated Use {@link org.grails.datastore.mapping.model.MappingContext} API instead
*/
@Deprecated
public List<GrailsDomainClassProperty> getAssociations() {
verifyContextIsInitialized();
List<GrailsDomainClassProperty> associations = new ArrayList<>();
List<String> associationNames = new ArrayList<>();
for (Association a : persistentEntity.getAssociations()) {
associationNames.add(a.getName());
}
for (GrailsDomainClassProperty p : persistentProperties) {
if (associationNames.contains(p.getName())) {
associations.add(p);
}
}
return associations;
}
use of org.grails.datastore.mapping.model.types.Association in project grails-core by grails.
the class DefaultGrailsDomainClass method getComponents.
/**
* Retrieves a list of embedded components
*
* @deprecated Use {@link org.grails.datastore.mapping.model.MappingContext} API instead
*/
@Deprecated
public List<GrailsDomainClass> getComponents() {
verifyContextIsInitialized();
List<GrailsDomainClass> components = new ArrayList<>();
for (Association a : persistentEntity.getAssociations()) {
if (a.isEmbedded()) {
components.add((GrailsDomainClass) grailsApplication.getArtefact(DomainClassArtefactHandler.TYPE, a.getAssociatedEntity().getName()));
}
}
return components;
}
use of org.grails.datastore.mapping.model.types.Association in project grails-core by grails.
the class DefaultGrailsDomainClass method getMergedConfigurationMap.
@SuppressWarnings("unchecked")
private Map getMergedConfigurationMap() {
verifyContextIsInitialized();
Map configurationMap = new HashMap();
PersistentEntity currentEntity = this.persistentEntity;
while (currentEntity != null) {
List<Association> associations = currentEntity.getAssociations();
for (Association association : associations) {
PersistentEntity associatedEntity = association.getAssociatedEntity();
if (associatedEntity != null) {
configurationMap.put(association.getName(), associatedEntity.getJavaClass());
}
}
currentEntity = currentEntity.getParentEntity();
}
return configurationMap;
}
Aggregations