public MetadataBuildingContextTestingImpl(StandardServiceRegistry serviceRegistry) { buildingOptions = new MetadataBuilderImpl.MetadataBuildingOptionsImpl( serviceRegistry ); bootstrapContext = new BootstrapContextImpl( serviceRegistry, buildingOptions ); mappingDefaults = new MetadataBuilderImpl.MappingDefaultsImpl( serviceRegistry ); metadataCollector = new InFlightMetadataCollectorImpl( bootstrapContext, buildingOptions ); objectNameNormalizer = new ObjectNameNormalizer() { @Override protected MetadataBuildingContext getBuildingContext() { return MetadataBuildingContextTestingImpl.this; } }; }
/** * Ugh! But we need this done before we ask Envers to produce its entities. */ public void processSecondPasses(MetadataBuildingContext buildingContext) { inSecondPass = true; try { processSecondPasses( idGeneratorResolverSecondPassList ); processSecondPasses( implicitColumnNamingSecondPassList ); processSecondPasses( pkDrivenByDefaultMapsIdSecondPassList ); processSecondPasses( setSimpleValueTypeSecondPassList ); processCopyIdentifierSecondPassesInOrder(); processFkSecondPassesInOrder(); processSecondPasses( createKeySecondPasList ); processSecondPasses( secondaryTableSecondPassList ); processSecondPasses( querySecondPassList ); processSecondPasses( generalSecondPassList ); processPropertyReferences(); secondPassCompileForeignKeys( buildingContext ); processUniqueConstraintHolders( buildingContext ); processJPAIndexHolders( buildingContext ); processNaturalIdUniqueKeyBinders(); processCachingOverrides(); } finally { inSecondPass = false; } }
@Override public AnnotatedClassType getClassType(XClass clazz) { AnnotatedClassType type = annotatedClassTypeMap.get( clazz.getName() ); if ( type == null ) { return addClassType( clazz ); } else { return type; } }
private void processCopyIdentifierSecondPassesInOrder() { if ( copyIdentifierComponentSecondPasList == null ) { return; } sortCopyIdentifierComponentSecondPasses(); processSecondPasses( copyIdentifierComponentSecondPasList ); }
@Override public void addSecondPass(SecondPass secondPass, boolean onTopOfTheQueue) { if ( secondPass instanceof IdGeneratorResolverSecondPass ) { addIdGeneratorResolverSecondPass( (IdGeneratorResolverSecondPass) secondPass, onTopOfTheQueue ); addPkDrivenByDefaultMapsIdSecondPass( (PkDrivenByDefaultMapsIdSecondPass) secondPass, onTopOfTheQueue ); addSetSimpleValueTypeSecondPass( (SetSimpleValueTypeSecondPass) secondPass, onTopOfTheQueue ); addCopyIdentifierComponentSecondPass( (CopyIdentifierComponentSecondPass) secondPass, onTopOfTheQueue ); addFkSecondPass( (FkSecondPass) secondPass, onTopOfTheQueue ); addCreateKeySecondPass( (CreateKeySecondPass) secondPass, onTopOfTheQueue ); addSecondaryTableSecondPass( (SecondaryTableSecondPass) secondPass, onTopOfTheQueue ); addQuerySecondPass( (QuerySecondPass) secondPass, onTopOfTheQueue ); addImplicitColumnNamingSecondPass( (ImplicitColumnNamingSecondPass) secondPass ); generalSecondPassList = new ArrayList<>(); addSecondPass( secondPass, generalSecondPassList, onTopOfTheQueue );
final BootstrapContext bootstrapContext, final MetadataBuildingOptions options) { final InFlightMetadataCollectorImpl metadataCollector = new InFlightMetadataCollectorImpl( bootstrapContext, options metadataCollector.addAttributeConverter( converterInfo.toConverterDescriptor( rootMetadataBuildingContext ) ); metadataCollector.processSecondPasses( rootMetadataBuildingContext ); return metadataCollector.buildMetadataInstance( rootMetadataBuildingContext );
processSecondPasses( buildingContext ); processExportableProducers( ); namedEntityGraphMap, sqlFunctionMap, getDatabase(), bootstrapContext ); getBootstrapContext().release();
final BootstrapContext bootstrapContext, final MetadataBuildingOptions options) { final InFlightMetadataCollectorImpl metadataCollector = new InFlightMetadataCollectorImpl( bootstrapContext, options metadataCollector.processSecondPasses( rootMetadataBuildingContext ); return metadataCollector.buildMetadataInstance( rootMetadataBuildingContext );
/** * @param mappings * @param configuration */ public JdbcBinder(ServiceRegistry serviceRegistry, Properties properties, MetadataBuildingContext mdbc, ReverseEngineeringStrategy revengStrategy, boolean preferBasicCompositeIds) { this.serviceRegistry = serviceRegistry; this.mdbc = mdbc; this.properties = properties; this.revengStrategy = revengStrategy; this.preferBasicCompositeIds = preferBasicCompositeIds; this.defaultCatalog = properties.getProperty(AvailableSettings.DEFAULT_CATALOG); this.defaultSchema = properties.getProperty(AvailableSettings.DEFAULT_SCHEMA); metadataCollector = mdbc.getMetadataCollector(); this.metadata = ((InFlightMetadataCollectorImpl)metadataCollector).buildMetadataInstance(mdbc); }
processSecondPasses( buildingContext ); sqlFunctionMap, auditMetadataBuilder, getDatabase(), bootstrapContext ); getBootstrapContext().release();
/** * */ public void readFromDatabase(String catalog, String schema, Mapping mapping) { try { DatabaseCollector collector = readDatabaseSchema(catalog, schema); createPersistentClasses(collector, mapping); //move this to a different step! ((InFlightMetadataCollectorImpl)metadataCollector).processSecondPasses(mdbc); } catch (SQLException e) { JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class); throw jdbcServices.getSqlExceptionHelper().convert(e, "Reading from database", null); } }
@Override public void addUniquePropertyReference(String referencedClass, String propertyName) { addDelayedPropertyReferenceHandler( new DelayedPropertyReferenceHandlerAnnotationImpl( referencedClass, propertyName, true ) ); }
@Override public void addDefaultIdentifierGenerator(IdentifierGeneratorDefinition generator) { this.addIdentifierGenerator( generator ); defaultIdentifierGeneratorNames.add( generator.getName() ); }
@Override public void addSecondPass(SecondPass secondPass, boolean onTopOfTheQueue) { if ( secondPass instanceof IdGeneratorResolverSecondPass ) { addIdGeneratorResolverSecondPass( (IdGeneratorResolverSecondPass) secondPass, onTopOfTheQueue ); addPkDrivenByDefaultMapsIdSecondPass( (PkDrivenByDefaultMapsIdSecondPass) secondPass, onTopOfTheQueue ); addSetSimpleValueTypeSecondPass( (SetSimpleValueTypeSecondPass) secondPass, onTopOfTheQueue ); addCopyIdentifierComponentSecondPass( (CopyIdentifierComponentSecondPass) secondPass, onTopOfTheQueue ); addFkSecondPass( (FkSecondPass) secondPass, onTopOfTheQueue ); addCreateKeySecondPass( (CreateKeySecondPass) secondPass, onTopOfTheQueue ); addSecondaryTableSecondPass( (SecondaryTableSecondPass) secondPass, onTopOfTheQueue ); addQuerySecondPass( (QuerySecondPass) secondPass, onTopOfTheQueue ); addImplicitColumnNamingSecondPass( (ImplicitColumnNamingSecondPass) secondPass ); generalSecondPassList = new ArrayList<>(); addSecondPass( secondPass, generalSecondPassList, onTopOfTheQueue );
private void processCopyIdentifierSecondPassesInOrder() { if ( copyIdentifierComponentSecondPasList == null ) { return; } sortCopyIdentifierComponentSecondPasses(); processSecondPasses( copyIdentifierComponentSecondPasList ); }
/** * @param mappings * @param configuration */ public JDBCBinder(ServiceRegistry serviceRegistry, Properties properties, MetadataBuildingContext mdbc, ReverseEngineeringStrategy revengStrategy, boolean preferBasicCompositeIds) { this.serviceRegistry = serviceRegistry; this.mdbc = mdbc; this.properties = properties; this.revengStrategy = revengStrategy; this.preferBasicCompositeIds = preferBasicCompositeIds; this.defaultCatalog = properties.getProperty(AvailableSettings.DEFAULT_CATALOG); this.defaultSchema = properties.getProperty(AvailableSettings.DEFAULT_SCHEMA); metadataCollector = mdbc.getMetadataCollector(); this.metadata = ((InFlightMetadataCollectorImpl)metadataCollector).buildMetadataInstance(mdbc); }
/** * */ public void readFromDatabase(String catalog, String schema, Mapping mapping) { try { DatabaseCollector collector = readDatabaseSchema(catalog, schema); createPersistentClasses(collector, mapping); //move this to a different step! ((InFlightMetadataCollectorImpl)metadataCollector).processSecondPasses(mdbc); } catch (SQLException e) { JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class); throw jdbcServices.getSqlExceptionHelper().convert(e, "Reading from database", null); } }
@Override public void addPropertyReference(String referencedClass, String propertyName) { addDelayedPropertyReferenceHandler( new DelayedPropertyReferenceHandlerAnnotationImpl( referencedClass, propertyName, false ) ); }
@Override public void addDefaultIdentifierGenerator(IdentifierGeneratorDefinition generator) { this.addIdentifierGenerator( generator ); defaultIdentifierGeneratorNames.add( generator.getName() ); }
/** * Ugh! But we need this done before we ask Envers to produce its entities. */ public void processSecondPasses(MetadataBuildingContext buildingContext) { inSecondPass = true; try { processSecondPasses( idGeneratorResolverSecondPassList ); processSecondPasses( implicitColumnNamingSecondPassList ); processSecondPasses( pkDrivenByDefaultMapsIdSecondPassList ); processSecondPasses( setSimpleValueTypeSecondPassList ); processCopyIdentifierSecondPassesInOrder(); processFkSecondPassesInOrder(); processSecondPasses( createKeySecondPasList ); processSecondPasses( secondaryTableSecondPassList ); processSecondPasses( querySecondPassList ); processSecondPasses( generalSecondPassList ); processPropertyReferences(); secondPassCompileForeignKeys( buildingContext ); processUniqueConstraintHolders( buildingContext ); processJPAIndexHolders( buildingContext ); processNaturalIdUniqueKeyBinders(); processCachingOverrides(); finalizeBootModel(); } finally { inSecondPass = false; } }