@Test public void testProperCallbacks() { PersistentClassVisitorValidator vv = new PersistentClassVisitorValidator(); new RootClass( metadataBuildingContext ).accept( vv ); new Subclass( new RootClass( metadataBuildingContext ), metadataBuildingContext ).accept( vv ); new JoinedSubclass( new RootClass( metadataBuildingContext ), metadataBuildingContext ).accept( vv ); new SingleTableSubclass( new RootClass( metadataBuildingContext ), metadataBuildingContext ).accept( vv ); new UnionSubclass( new RootClass( metadataBuildingContext ), metadataBuildingContext ).accept( vv ); }
private static PersistentClass makePersistentClass( InheritanceState inheritanceState, PersistentClass superEntity, MetadataBuildingContext metadataBuildingContext) { //we now know what kind of persistent entity it is if ( !inheritanceState.hasParents() ) { return new RootClass( metadataBuildingContext ); } else if ( InheritanceType.SINGLE_TABLE.equals( inheritanceState.getType() ) ) { return new SingleTableSubclass( superEntity, metadataBuildingContext ); } else if ( InheritanceType.JOINED.equals( inheritanceState.getType() ) ) { return new JoinedSubclass( superEntity, metadataBuildingContext ); } else if ( InheritanceType.TABLE_PER_CLASS.equals( inheritanceState.getType() ) ) { return new UnionSubclass( superEntity, metadataBuildingContext ); } else { throw new AssertionFailure( "Unknown inheritance type: " + inheritanceState.getType() ); } }
public void bindEntityHierarchy(EntityHierarchySourceImpl hierarchySource) { final RootClass rootEntityDescriptor = new RootClass( metadataBuildingContext ); bindRootEntity( hierarchySource, rootEntityDescriptor ); hierarchySource.getRoot() .getLocalMetadataBuildingContext() .getMetadataCollector() .addEntityBinding( rootEntityDescriptor ); switch ( hierarchySource.getHierarchyInheritanceType() ) { case NO_INHERITANCE: { // nothing to do break; } case DISCRIMINATED: { bindDiscriminatorSubclassEntities( hierarchySource.getRoot(), rootEntityDescriptor ); break; } case JOINED: { bindJoinedSubclassEntities( hierarchySource.getRoot(), rootEntityDescriptor ); break; } case UNION: { bindUnionSubclassEntities( hierarchySource.getRoot(), rootEntityDescriptor ); break; } } }
@Test public void testProperCallbacks() { final MetadataImplementor metadata = (MetadataImplementor) new MetadataSources( serviceRegistry ) .buildMetadata(); final Table tbl = new Table(); final RootClass rootClass = new RootClass( metadataBuildingContext ); ValueVisitor vv = new ValueVisitorValidator(); MetadataBuildingContextTestingImpl metadataBuildingContext = new MetadataBuildingContextTestingImpl(); new Any( metadataBuildingContext, tbl ).accept( vv ); new Array( metadataBuildingContext, rootClass ).accept( vv ); new Bag( metadataBuildingContext, rootClass ).accept( vv ); new Component( metadataBuildingContext, rootClass ).accept( vv ); new DependantValue( metadataBuildingContext, tbl, null ).accept( vv ); new IdentifierBag( metadataBuildingContext, rootClass ).accept( vv ); new List( metadataBuildingContext, rootClass ).accept( vv ); new ManyToOne( metadataBuildingContext, tbl ).accept( vv ); new Map( metadataBuildingContext, rootClass ).accept( vv ); new OneToMany( metadataBuildingContext, rootClass ).accept( vv ); new OneToOne( metadataBuildingContext, tbl, rootClass ).accept( vv ); new PrimitiveArray( metadataBuildingContext, rootClass ).accept( vv ); new Set( metadataBuildingContext, rootClass ).accept( vv ); new SimpleValue( metadataBuildingContext ).accept( vv ); }
private static PersistentClass makePersistentClass(InheritanceState inheritanceState, PersistentClass superEntity) { //we now know what kind of persistent entity it is PersistentClass persistentClass; //create persistent class if ( !inheritanceState.hasParents() ) { persistentClass = new RootClass(); } else if ( InheritanceType.SINGLE_TABLE.equals( inheritanceState.getType() ) ) { persistentClass = new SingleTableSubclass( superEntity ); } else if ( InheritanceType.JOINED.equals( inheritanceState.getType() ) ) { persistentClass = new JoinedSubclass( superEntity ); } else if ( InheritanceType.TABLE_PER_CLASS.equals( inheritanceState.getType() ) ) { persistentClass = new UnionSubclass( superEntity ); } else { throw new AssertionFailure( "Unknown inheritance type: " + inheritanceState.getType() ); } return persistentClass; }
@GET @Path("/so-test") @Produces({AgiMediaType.APPLICATION_XML, AgiMediaType.APPLICATION_JSON}) public RootClass getGreetings() { List<TestClassForSo> greetingList = new ArrayList<>(); for (int i = 0; i < 3; i++) { TestClassForSo testClassForSo = new TestClassForSo(); String id = "hello-word"; List<String> greetings = new ArrayList<>(Arrays.asList("Hello World " + i)); testClassForSo.id = id; testClassForSo.description = greetings; greetingList.add(testClassForSo); } RootClass r = new RootClass(); r.greetingList = greetingList; return r; }
RootClass rootclass = new RootClass(); bindRootClass( element, rootclass, mappings, inheritedMetas ); mappings.addClass( rootclass );
while ( nodes.hasNext() ) { Element n = (Element) nodes.next(); RootClass rootclass = new RootClass(); bindRootClass( n, rootclass, mappings, inheritedMetas ); mappings.addClass( rootclass );
RootClass rootclass = new RootClass(); bindRootClass( element, rootclass, mappings, inheritedMetas ); mappings.addClass( rootclass );
RootClass rootclass = new RootClass(); bindRootClass( element, rootclass, mappings, inheritedMetas ); mappings.addClass( rootclass );
RootClass root = new RootClass(); root.setAbstract(Modifier.isAbstract(domainClass.getClazz().getModifiers())); if (!domainClass.hasSubClasses()) {
RootClass root = new RootClass(); root.setAbstract(entity.isAbstract()); final MappingContext mappingContext = entity.getMappingContext();
RootClass rc = new RootClass(mdbc); TableIdentifier tableIdentifier = TableIdentifier.create(table); String className = revengStrategy.tableToClassName( tableIdentifier );
RootClass rc = new RootClass(mdbc); TableIdentifier tableIdentifier = TableIdentifier.create(table); String className = revengStrategy.tableToClassName( tableIdentifier );
private static PersistentClass makePersistentClass( InheritanceState inheritanceState, PersistentClass superEntity, MetadataBuildingContext metadataBuildingContext) { //we now know what kind of persistent entity it is if ( !inheritanceState.hasParents() ) { return new RootClass( metadataBuildingContext ); } else if ( InheritanceType.SINGLE_TABLE.equals( inheritanceState.getType() ) ) { return new SingleTableSubclass( superEntity, metadataBuildingContext ); } else if ( InheritanceType.JOINED.equals( inheritanceState.getType() ) ) { return new JoinedSubclass( superEntity, metadataBuildingContext ); } else if ( InheritanceType.TABLE_PER_CLASS.equals( inheritanceState.getType() ) ) { return new UnionSubclass( superEntity, metadataBuildingContext ); } else { throw new AssertionFailure( "Unknown inheritance type: " + inheritanceState.getType() ); } }
private static PersistentClass makePersistentClass(InheritanceState inheritanceState, PersistentClass superEntity) { //we now know what kind of persistent entity it is PersistentClass persistentClass; //create persistent class if ( !inheritanceState.hasParents() ) { persistentClass = new RootClass(); } else if ( InheritanceType.SINGLE_TABLE.equals( inheritanceState.getType() ) ) { persistentClass = new SingleTableSubclass( superEntity ); } else if ( InheritanceType.JOINED.equals( inheritanceState.getType() ) ) { persistentClass = new JoinedSubclass( superEntity ); } else if ( InheritanceType.TABLE_PER_CLASS.equals( inheritanceState.getType() ) ) { persistentClass = new UnionSubclass( superEntity ); } else { throw new AssertionFailure( "Unknown inheritance type: " + inheritanceState.getType() ); } return persistentClass; }
private static PersistentClass makePersistentClass(InheritanceState inheritanceState, PersistentClass superEntity) { //we now know what kind of persistent entity it is PersistentClass persistentClass; //create persistent class if ( !inheritanceState.hasParents() ) { persistentClass = new RootClass(); } else if ( InheritanceType.SINGLE_TABLE.equals( inheritanceState.getType() ) ) { persistentClass = new SingleTableSubclass( superEntity ); } else if ( InheritanceType.JOINED.equals( inheritanceState.getType() ) ) { persistentClass = new JoinedSubclass( superEntity ); } else if ( InheritanceType.TABLE_PER_CLASS.equals( inheritanceState.getType() ) ) { persistentClass = new UnionSubclass( superEntity ); } else { throw new AssertionFailure( "Unknown inheritance type: " + inheritanceState.getType() ); } return persistentClass; }
aTable.getTableName(), aTable.getTableName(), null); RootClass clazz = new RootClass(); clazz.setEntityName(aTable.getActualEntityName()); clazz.setJpaEntityName(aTable.getActualEntityName());
aTable.getTableName(), aTable.getTableName(), null); RootClass clazz = new RootClass(); clazz.setEntityName(aTable.getActualEntityName()); clazz.setJpaEntityName(aTable.getActualEntityName());
public void bindEntityHierarchy(EntityHierarchySourceImpl hierarchySource) { final RootClass rootEntityDescriptor = new RootClass( metadataBuildingContext ); bindRootEntity( hierarchySource, rootEntityDescriptor ); final InFlightMetadataCollector metadataCollector = hierarchySource.getRoot() .getLocalMetadataBuildingContext() .getMetadataCollector(); metadataCollector.addEntityBinding( rootEntityDescriptor ); metadataCollector.addEntityMappingHierarchy( rootEntityDescriptor.getEntityMappingHierarchy() ); switch ( hierarchySource.getHierarchyInheritanceType() ) { case NO_INHERITANCE: { // nothing to do break; } case DISCRIMINATED: { bindDiscriminatorSubclassEntities( hierarchySource.getRoot(), rootEntityDescriptor ); break; } case JOINED: { bindJoinedSubclassEntities( hierarchySource.getRoot(), rootEntityDescriptor ); break; } case UNION: { bindUnionSubclassEntities( hierarchySource.getRoot(), rootEntityDescriptor ); break; } } }