use of org.eclipse.persistence.internal.jpa.metadata.converters.MixedConverterMetadata in project eclipselink by eclipse-ee4j.
the class XMLEntityMappings method initPersistenceUnitClasses.
/**
* INTERNAL:
* Assumes the correct class loader has been set before calling this
* method.
*/
public void initPersistenceUnitClasses(HashMap<String, EntityAccessor> allEntities, HashMap<String, EmbeddableAccessor> allEmbeddables) {
// the mixed converter metadata list.
for (MixedConverterMetadata mixedConverter : m_mixedConverters) {
if (mixedConverter.isConverterMetadata()) {
m_converters.add(mixedConverter.buildConverterMetadata());
} else {
m_converterAccessors.add(mixedConverter.buildConverterAccessor());
}
}
// Process the entities
for (EntityAccessor entity : getEntities()) {
// Initialize the class with the package from entity mappings.
MetadataClass entityClass = getMetadataClass(getPackageQualifiedClassName(entity.getClassName()), false);
// Initialize the entity with its metadata descriptor and project.
// This initialization must be done before a potential merge below.
entity.initXMLClassAccessor(entityClass, new MetadataDescriptor(entityClass, entity), m_project, this);
if (allEntities.containsKey(entityClass.getName())) {
// Merge this entity with the existing one.
allEntities.get(entityClass.getName()).merge(entity);
} else {
// Add this entity to the map.
allEntities.put(entityClass.getName(), entity);
}
}
// Process the embeddables.
for (EmbeddableAccessor embeddable : getEmbeddables()) {
// Initialize the class with the package from entity mappings.
MetadataClass embeddableClass = getMetadataClass(getPackageQualifiedClassName(embeddable.getClassName()), false);
// Initialize the embeddable with its metadata descriptor and project.
// This initialization must be done before a potential merge below.
embeddable.initXMLClassAccessor(embeddableClass, new MetadataDescriptor(embeddableClass, embeddable), m_project, this);
if (allEmbeddables.containsKey(embeddableClass.getName())) {
// Merge this embeddable with the existing one.
allEmbeddables.get(embeddableClass.getName()).merge(embeddable);
} else {
// Add this embeddable to the map.
allEmbeddables.put(embeddableClass.getName(), embeddable);
}
}
// Process the mapped superclasses
for (MappedSuperclassAccessor mappedSuperclass : getMappedSuperclasses()) {
// Initialize the class with the package from entity mappings.
MetadataClass mappedSuperclassClass = getMetadataClass(getPackageQualifiedClassName(mappedSuperclass.getClassName()), false);
// Initialize the mapped superclass with a metadata descriptor and project.
// This initialization must be done before a potential merge below.
mappedSuperclass.initXMLClassAccessor(mappedSuperclassClass, new MetadataDescriptor(mappedSuperclassClass, mappedSuperclass), m_project, this);
if (m_project.hasMappedSuperclass(mappedSuperclassClass)) {
// Merge this mapped superclass with the existing one.
m_project.getMappedSuperclassAccessor(mappedSuperclassClass).merge(mappedSuperclass);
} else {
// Add this mapped superclass to the project.
m_project.addMappedSuperclass(mappedSuperclass);
}
}
// Process the JPA converter classes.
for (ConverterAccessor converterAccessor : m_converterAccessors) {
// Initialize the class with the package from entity mappings.
MetadataClass converterClass = getMetadataClass(getPackageQualifiedClassName(converterAccessor.getClassName()), false);
// Initialize the converter class.
// This initialization must be done before a potential merge below.
converterAccessor.initXMLObject(converterClass, this);
if (m_project.hasConverterAccessor(converterClass)) {
// Merge this converter with the existing one (will check for discrepancies between them)
m_project.getConverterAccessor(converterClass).merge(converterAccessor);
} else {
// Add this converter to the project.
m_project.addConverterAccessor(converterAccessor);
}
}
}
Aggregations