Class EclipseLinkJpaMetadataProviderImpl
java.lang.Object
org.kuali.rice.krad.data.provider.impl.MetadataProviderBase
org.kuali.rice.krad.data.jpa.JpaMetadataProviderImpl
org.kuali.rice.krad.data.jpa.eclipselink.EclipseLinkJpaMetadataProviderImpl
- All Implemented Interfaces:
JpaMetadataProvider,MetadataProvider,Provider
Provides an EclipseLink-specific implementation for the
JpaMetadataProviderImpl.-
Field Summary
Fields inherited from class org.kuali.rice.krad.data.jpa.JpaMetadataProviderImpl
entityManagerFields inherited from class org.kuali.rice.krad.data.provider.impl.MetadataProviderBase
masterMetadataMap -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddExtensionRelationship(Class<?> entityClass, String extensionPropertyName, Class<?> extensionEntityClass) Given the parameters, injects into the JPA repository a 1:1 relationship between the parent entity and the extension entity via the given property name (which must exist on the entityClass).protected org.eclipse.persistence.mappings.OneToOneMappingfindExtensionInverse(org.eclipse.persistence.descriptors.ClassDescriptor extensionEntityDescriptor, Class<?> entityType) Gets the inverse extension of the givenClassDescriptor.protected org.eclipse.persistence.mappings.DatabaseMappingfindRelationshipPartner(org.eclipse.persistence.mappings.DatabaseMapping databaseMapping) Gets the inverse mapping of the givenDatabaseMapping.protected org.eclipse.persistence.descriptors.ClassDescriptorgetClassDescriptor(Class<?> entityClass) Gets the descriptor for the entity type.protected org.eclipse.persistence.jpa.JpaEntityManagerThe entity manager for interacting with the database.protected StringgetPropertyNameFromDatabaseColumnName(javax.persistence.metamodel.ManagedType entityType, String databaseColumnName) Returns the property name on the given entity type which the given database column is mapped to.protected voidpopulateImplementationSpecificAttributeLevelMetadata(DataObjectAttributeImpl attribute, javax.persistence.metamodel.SingularAttribute<?, ?> attr) Hook called after all "standard" attribute-level annotations are processed to perform any further extraction based on the internals of the JPA implementation.protected voidpopulateImplementationSpecificCollectionLevelMetadata(DataObjectCollectionImpl collection, javax.persistence.metamodel.PluralAttribute<?, ?, ?> cd) Hook called after all "standard" field-level annotations are processed on attributes identified as "plural" to perform any further extraction based on the internals of the JPA implementation.protected voidpopulateImplementationSpecificEntityLevelMetadata(DataObjectMetadataImpl metadata, javax.persistence.metamodel.EntityType<?> entityType) Hook called after all "standard" annotations are processed to perform any further extraction based on the internals of the JPA implementation.protected voidpopulateImplementationSpecificRelationshipLevelMetadata(DataObjectRelationshipImpl relationship, javax.persistence.metamodel.SingularAttribute<?, ?> rd) Hook called after all "standard" field-level annotations are processed on attributes identified as "associations" to perform any further extraction based on the internals of the JPA implementation.protected voidpopulateInverseRelationship(org.eclipse.persistence.mappings.DatabaseMapping mapping, MetadataChildBase relationship) Populates the inverse relationship for a given relationship.Methods inherited from class org.kuali.rice.krad.data.jpa.JpaMetadataProviderImpl
getAttributeMetadata, getCollectionMetadataFromCollectionAttribute, getCollectionsFromMetadata, getEntityManager, getMetadataForClass, getPrimaryKeyAttributeNames, getRelationshipMetadata, getRelationships, getSingularAttributes, initializeMetadata, isClassPersistable, setEntityManagerMethods inherited from class org.kuali.rice.krad.data.provider.impl.MetadataProviderBase
getMetadataForType, getSupportedTypes, handles, provideMetadata, provideMetadataForTypes, requiresListOfExistingTypesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.kuali.rice.krad.data.provider.MetadataProvider
getMetadataForType, getSupportedTypes, handles, provideMetadata, provideMetadataForTypes, requiresListOfExistingTypes
-
Constructor Details
-
EclipseLinkJpaMetadataProviderImpl
public EclipseLinkJpaMetadataProviderImpl()
-
-
Method Details
-
populateImplementationSpecificEntityLevelMetadata
protected void populateImplementationSpecificEntityLevelMetadata(DataObjectMetadataImpl metadata, javax.persistence.metamodel.EntityType<?> entityType) Hook called after all "standard" annotations are processed to perform any further extraction based on the internals of the JPA implementation.- Specified by:
populateImplementationSpecificEntityLevelMetadatain classJpaMetadataProviderImpl- Parameters:
metadata- The metadata for the data object.entityType- The entity type of the data object.
-
populateImplementationSpecificAttributeLevelMetadata
protected void populateImplementationSpecificAttributeLevelMetadata(DataObjectAttributeImpl attribute, javax.persistence.metamodel.SingularAttribute<?, ?> attr) Hook called after all "standard" attribute-level annotations are processed to perform any further extraction based on the internals of the JPA implementation.- Specified by:
populateImplementationSpecificAttributeLevelMetadatain classJpaMetadataProviderImpl- Parameters:
attribute- The attribute metadata for the data object.attr- The persistent single-valued property or field.
-
populateImplementationSpecificCollectionLevelMetadata
protected void populateImplementationSpecificCollectionLevelMetadata(DataObjectCollectionImpl collection, javax.persistence.metamodel.PluralAttribute<?, ?, ?> cd) Hook called after all "standard" field-level annotations are processed on attributes identified as "plural" to perform any further extraction based on the internals of the JPA implementation.- Specified by:
populateImplementationSpecificCollectionLevelMetadatain classJpaMetadataProviderImpl- Parameters:
collection- The collection metadata for the data object.cd- The persistent collection-valued attribute.
-
getPropertyNameFromDatabaseColumnName
protected String getPropertyNameFromDatabaseColumnName(javax.persistence.metamodel.ManagedType entityType, String databaseColumnName) Returns the property name on the given entity type which the given database column is mapped to.If no field on the given type is mapped to this field (which is common in cases of a JPA relationship without an actual
Columnannotated field to represent the foreign key) then this method will return null.- Parameters:
entityType- the entity type on which to search for a property that is mapped to the given columndatabaseColumnName- the name of the database column- Returns:
- the name of the property on the given entity type which maps to the given column, or null if no such mapping exists
-
populateImplementationSpecificRelationshipLevelMetadata
protected void populateImplementationSpecificRelationshipLevelMetadata(DataObjectRelationshipImpl relationship, javax.persistence.metamodel.SingularAttribute<?, ?> rd) Hook called after all "standard" field-level annotations are processed on attributes identified as "associations" to perform any further extraction based on the internals of the JPA implementation.- Specified by:
populateImplementationSpecificRelationshipLevelMetadatain classJpaMetadataProviderImpl- Parameters:
relationship- The relationship metadata for the data object.rd- The persistent single-valued property or field.
-
populateInverseRelationship
protected void populateInverseRelationship(org.eclipse.persistence.mappings.DatabaseMapping mapping, MetadataChildBase relationship) Populates the inverse relationship for a given relationship.- Parameters:
mapping- theDatabaseMappingthat defines the relationship.relationship- the relationship of which to populate the other side.
-
findRelationshipPartner
protected org.eclipse.persistence.mappings.DatabaseMapping findRelationshipPartner(org.eclipse.persistence.mappings.DatabaseMapping databaseMapping) Gets the inverse mapping of the givenDatabaseMapping.- Parameters:
databaseMapping- theDatabaseMappingof which to get the inverse.- Returns:
- the inverse mapping of the given
DatabaseMapping.
-
addExtensionRelationship
public DataObjectRelationship addExtensionRelationship(Class<?> entityClass, String extensionPropertyName, Class<?> extensionEntityClass) Given the parameters, injects into the JPA repository a 1:1 relationship between the parent entity and the extension entity via the given property name (which must exist on the entityClass).- Specified by:
addExtensionRelationshipin interfaceJpaMetadataProvider- Specified by:
addExtensionRelationshipin classJpaMetadataProviderImpl- Parameters:
entityClass- The parent (owning) class which must be already known to the JPA persistence unit. This one's metadata will be modified within the internals of the JPA metadata.extensionPropertyName- The property on the parent class which will hold the extensionEntity. This property must be of the type of the extension entity or a superclass. (Object will work.)extensionEntityClass- The child/extension class which needs to be linked. It must also already be known to JPA.- Returns:
- A 1:1 relationship between the parent entry and the extension entity via the given property name.
-
findExtensionInverse
protected org.eclipse.persistence.mappings.OneToOneMapping findExtensionInverse(org.eclipse.persistence.descriptors.ClassDescriptor extensionEntityDescriptor, Class<?> entityType) Gets the inverse extension of the givenClassDescriptor.- Parameters:
extensionEntityDescriptor- theClassDescriptorof which to get the inverse.entityType- the type of the entity.- Returns:
- the inverse extension of the given
ClassDescriptor.
-
getClassDescriptor
protected org.eclipse.persistence.descriptors.ClassDescriptor getClassDescriptor(Class<?> entityClass) Gets the descriptor for the entity type.- Parameters:
entityClass- the type of the enty.- Returns:
- the descriptor for the entity type.
-
getEclipseLinkEntityManager
protected org.eclipse.persistence.jpa.JpaEntityManager getEclipseLinkEntityManager()The entity manager for interacting with the database.- Returns:
- the entity manager for interacting with the database.
-