sourceDocument, (SingularAttributeSourceEmbedded) attributeSource, new Component( sourceDocument, component ), component.getComponentClassName() );
public static Component createComponent( PropertyHolder propertyHolder, PropertyData inferredData, boolean isComponentEmbedded, boolean isIdentifierMapper, MetadataBuildingContext context) { Component comp = new Component( context, propertyHolder.getPersistentClass() ); comp.setEmbedded( isComponentEmbedded ); //yuk comp.setTable( propertyHolder.getTable() ); //FIXME shouldn't identifier mapper use getClassOrElementName? Need to be checked. if ( isIdentifierMapper || ( isComponentEmbedded && inferredData.getPropertyName() == null ) ) { comp.setComponentClassName( comp.getOwner().getClassName() ); } else { comp.setComponentClassName( inferredData.getClassOrElementName() ); } return comp; }
Component value = new Component( buildingContext, component.getOwner() );
= (IdentifierSourceNonAggregatedComposite) hierarchySource.getIdentifierSource(); final Component cid = new Component( mappingDocument, rootEntityDescriptor ); cid.setKey( true ); rootEntityDescriptor.setIdentifier( cid ); final Component mapper = new Component( mappingDocument, rootEntityDescriptor ); bindComponent( mappingDocument,
= (IdentifierSourceAggregatedComposite) hierarchySource.getIdentifierSource(); final Component cid = new Component( mappingDocument, rootEntityDescriptor ); cid.setKey( true ); rootEntityDescriptor.setIdentifier( cid );
Component component = (Component) value; Iterator properties = component.getPropertyIterator(); Component indexComponent = new Component( getBuildingContext(), collection ); indexComponent.setComponentClassName( component.getComponentClassName() ); while ( properties.hasNext() ) {
mappingDocument, (SingularAttributeSourceEmbedded) attributeSource, new Component( mappingDocument, table, entityDescriptor ), entityDescriptor.getClassName() );
final PluralAttributeMapKeySourceEmbedded mapKeySource = (PluralAttributeMapKeySourceEmbedded) pluralAttributeSource.getIndexSource(); final Component componentBinding = new Component( mappingDocument, collectionBinding
@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 ); }
Component component = (Component) value; Iterator properties = component.getPropertyIterator(); Component indexComponent = new Component( collection ); indexComponent.setComponentClassName( component.getComponentClassName() );
public static Component createComponent(PropertyHolder propertyHolder, PropertyData inferredData, boolean isComponentEmbedded, boolean isIdentifierMapper) { Component comp = new Component( propertyHolder.getPersistentClass() ); comp.setEmbedded( isComponentEmbedded ); //yuk comp.setTable( propertyHolder.getTable() ); //FIXME shouldn't identifier mapper use getClassOrElementName? Need to be checked. if ( isIdentifierMapper || ( isComponentEmbedded && inferredData.getPropertyName() == null ) ) { comp.setComponentClassName( comp.getOwner().getClassName() ); } else { comp.setComponentClassName( inferredData.getClassOrElementName() ); } comp.setNodeName( inferredData.getPropertyName() ); return comp; }
final PluralAttributeElementSourceEmbedded elementSource = (PluralAttributeElementSourceEmbedded) getPluralAttributeSource().getElementSource(); final Component elementBinding = new Component( getMappingDocument(), getCollectionBinding()
private static void bindCompositeId(Element idNode, RootClass entity, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { String propertyName = idNode.attributeValue( "name" ); Component id = new Component( mappings, entity ); entity.setIdentifier( id ); bindCompositeId( idNode, id, entity, propertyName, mappings, inheritedMetas ); if ( propertyName == null ) { entity.setEmbeddedIdentifier( id.isEmbedded() ); if ( id.isEmbedded() ) { // todo : what is the implication of this? id.setDynamic( !entity.hasPojoRepresentation() ); /* * Property prop = new Property(); prop.setName("id"); * prop.setPropertyAccessorName("embedded"); prop.setValue(id); * entity.setIdentifierProperty(prop); */ } } else { Property prop = new Property(); prop.setValue( id ); bindProperty( idNode, prop, mappings, inheritedMetas ); entity.setIdentifierProperty( prop ); } makeIdentifier( idNode, id, mappings ); }
public static Component createComponent( PropertyHolder propertyHolder, PropertyData inferredData, boolean isComponentEmbedded, boolean isIdentifierMapper, MetadataBuildingContext context) { Component comp = new Component( context, propertyHolder.getPersistentClass() ); comp.setEmbedded( isComponentEmbedded ); //yuk comp.setTable( propertyHolder.getMappedTable() ); //FIXME shouldn't identifier mapper use getClassOrElementName? Need to be checked. if ( isIdentifierMapper || ( isComponentEmbedded && inferredData.getPropertyName() == null ) ) { comp.setComponentClassName( comp.getOwner().getClassName() ); } else { comp.setComponentClassName( inferredData.getClassOrElementName() ); } return comp; }
public static Component createComponent( PropertyHolder propertyHolder, PropertyData inferredData, boolean isComponentEmbedded, boolean isIdentifierMapper, Mappings mappings) { Component comp = new Component( mappings, propertyHolder.getPersistentClass() ); comp.setEmbedded( isComponentEmbedded ); //yuk comp.setTable( propertyHolder.getTable() ); //FIXME shouldn't identifier mapper use getClassOrElementName? Need to be checked. if ( isIdentifierMapper || ( isComponentEmbedded && inferredData.getPropertyName() == null ) ) { comp.setComponentClassName( comp.getOwner().getClassName() ); } else { comp.setComponentClassName( inferredData.getClassOrElementName() ); } comp.setNodeName( inferredData.getPropertyName() ); return comp; }
public static Component createComponent( PropertyHolder propertyHolder, PropertyData inferredData, boolean isComponentEmbedded, boolean isIdentifierMapper, Mappings mappings) { Component comp = new Component( mappings, propertyHolder.getPersistentClass() ); comp.setEmbedded( isComponentEmbedded ); //yuk comp.setTable( propertyHolder.getTable() ); //FIXME shouldn't identifier mapper use getClassOrElementName? Need to be checked. if ( isIdentifierMapper || ( isComponentEmbedded && inferredData.getPropertyName() == null ) ) { comp.setComponentClassName( comp.getOwner().getClassName() ); } else { comp.setComponentClassName( inferredData.getClassOrElementName() ); } comp.setNodeName( inferredData.getPropertyName() ); return comp; }
protected void bindCompositeId(PersistentEntity domainClass, RootClass root, CompositeIdentity compositeIdentity, Mappings mappings, String sessionFactoryBeanName) { HibernatePersistentEntity hibernatePersistentEntity = (HibernatePersistentEntity) domainClass; Component id = new Component(mappings, root); id.setNullValue("undefined"); root.setIdentifier(id); root.setEmbeddedIdentifier(true); id.setComponentClassName(domainClass.getName()); id.setKey(true); id.setEmbedded(true); String path = qualify(root.getEntityName(), "id"); id.setRoleName(path); final PersistentProperty[] composite = hibernatePersistentEntity.getCompositeIdentity(); for (PersistentProperty property : composite) { if (property == null) { throw new MappingException("Property referenced in composite-id mapping of class [" + domainClass.getName() + "] is not a valid property!"); } bindComponentProperty(id, null, property, root, "", root.getTable(), mappings, sessionFactoryBeanName); } }
private static void bindCompositeId(GrailsDomainClass domainClass, RootClass root, CompositeIdentity compositeIdentity, Mappings mappings, String sessionFactoryBeanName) { Component id = new Component(mappings, root); id.setNullValue("undefined"); root.setIdentifier(id); root.setEmbeddedIdentifier(true); id.setComponentClassName(domainClass.getFullName()); id.setKey(true); id.setEmbedded(true); String path = StringHelper.qualify(root.getEntityName(), "id"); id.setRoleName(path); String[] props = compositeIdentity.getPropertyNames(); for (String propName : props) { GrailsDomainClassProperty property = domainClass.getPropertyByName(propName); if (property == null) { throw new MappingException("Property [" + propName + "] referenced in composite-id mapping of class [" + domainClass.getFullName() + "] is not a valid property!"); } bindComponentProperty(id, null, property, root, "", root.getTable(), mappings, sessionFactoryBeanName); } }