return;
}
final ExtendedPropertyMapper propertyMapper = null;
final String parentEntityName = null;
final EntityConfiguration entityCfg = new EntityConfiguration(
entityName,
pc.getClassName(),
idMapper,
propertyMapper,
parentEntityName
);
notAuditedEntitiesConfigurations.put( entityName, entityCfg );
return;
}
final String entityName = pc.getEntityName();
LOG.debugf( "Generating first-pass auditing mapping for entity %s", entityName );
final String auditEntityName = verEntCfg.getAuditEntityName( entityName );
final String auditTableName = verEntCfg.getAuditTableName( entityName, pc.getTable().getName() );
// Registering the audit entity name, now that it is known
auditEntityNameRegister.register( auditEntityName );
final AuditTableData auditTableData = new AuditTableData( auditEntityName, auditTableName, schema, catalog );
// Generating a mapping for the id
final IdMappingData idMapper = idMetadataGenerator.addId( pc, true );
final InheritanceType inheritanceType = InheritanceType.get( pc );
// These properties will be read from the mapping data
final Element classMapping;
final ExtendedPropertyMapper propertyMapper;
final String parentEntityName;
final Triple<Element, ExtendedPropertyMapper, String> mappingData;
// Reading the mapping data depending on inheritance type (if any)
switch ( inheritanceType ) {
case NONE:
mappingData = generateMappingData( pc, xmlMappingData, auditTableData, idMapper );
break;
case SINGLE:
mappingData = generateInheritanceMappingData( pc, xmlMappingData, auditTableData, "subclass" );
break;
case JOINED:
mappingData = generateInheritanceMappingData( pc, xmlMappingData, auditTableData, "joined-subclass" );
// Adding the "key" element with all id columns...
final Element keyMapping = mappingData.getFirst().addElement( "key" );
MetadataTools.addColumns( keyMapping, pc.getTable().getPrimaryKey().columnIterator() );
// ... and the revision number column, read from the revision info relation mapping.
keyMapping.add( (Element) cloneAndSetupRevisionInfoRelationMapping().element( "column" ).clone() );
break;
case TABLE_PER_CLASS:
mappingData = generateInheritanceMappingData( pc, xmlMappingData, auditTableData, "union-subclass" );
break;
default:
throw new AssertionError( "Impossible enum value." );
}
classMapping = mappingData.getFirst();
propertyMapper = mappingData.getSecond();
parentEntityName = mappingData.getThird();
xmlMappingData.setClassMapping( classMapping );
// Mapping unjoined properties
addProperties(
classMapping, pc.getUnjoinedPropertyIterator(), propertyMapper,
auditingData, pc.getEntityName(), xmlMappingData,
true
);
// Creating and mapping joins (first pass)
createJoins( pc, classMapping, auditingData );
addJoins( pc, propertyMapper, auditingData, pc.getEntityName(), xmlMappingData, true );
// Storing the generated configuration
final EntityConfiguration entityCfg = new EntityConfiguration(
auditEntityName,
pc.getClassName(),
idMapper,
propertyMapper,
parentEntityName