Class DeployBeanDescriptor<T>
- java.lang.Object
-
- io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor<T>
-
public class DeployBeanDescriptor<T> extends Object
Describes Beans including their deployment information.
-
-
Constructor Summary
Constructors Constructor Description DeployBeanDescriptor(BeanDescriptorManager manager, Class<T> beanType, ServerConfig serverConfig)
Construct the BeanDescriptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DeployBeanProperty
addBeanProperty(DeployBeanProperty prop)
Add a bean property.void
addIndex(IndexDefinition c)
Add a compound unique constraint.void
addNamedQuery(String name, String query)
Add a named query.void
addPersistController(BeanPersistController controller)
void
addPersistListener(BeanPersistListener listener)
void
addPostConstructListener(BeanPostConstructListener postConstructListener)
void
addPostLoad(BeanPostLoad postLoad)
void
addQueryAdapter(BeanQueryAdapter queryAdapter)
void
addRawSql(String name, SpiRawSql rawSql)
Add a named RawSql from ebean.xml file.IdentityMode
buildIdentityMode()
Return the immutable IdentityMode.void
checkInheritanceMapping()
Check the mapping for class inheritanceDeployBeanTable
createDeployBeanTable()
DeployBeanPropertyAssocOne<?>
findJoinToTable(String tableName)
String
getBaseTable()
Return the base table.String
getBaseTableAsOf()
Return the base table with as of suffix.TableName
getBaseTableFull()
Return the base table with full structure.String
getBaseTableVersionsBetween()
Return the base table with versions between suffix.BeanFindController
getBeanFinder()
Return the beanFinder.DeployBeanProperty
getBeanProperty(String propName)
Get a BeanProperty by its name.Class<T>
getBeanType()
Return the class type this BeanDescriptor describes.CacheOptions
getCacheOptions()
Return the cache options.ChangeLogFilter
getChangeLogFilter()
ConcurrencyMode
getConcurrencyMode()
Return the concurrency mode used for beans of this type.String
getDbComment()
String
getDefaultSelectClause()
Return the defaultSelectClause using FetchType.LAZY and FetchType.EAGER.String[]
getDependentTables()
For view based entity return the dependant tables.io.ebean.annotation.DocStore
getDocStore()
io.ebean.annotation.DocStoreMode
getDocStoreDeleteEvent()
Return the DocStore index behavior for bean deletes.String
getDocStoreIndexName()
String
getDocStoreIndexType()
io.ebean.annotation.DocStoreMode
getDocStoreInsertEvent()
Return the DocStore index behavior for bean inserts.PathProperties
getDocStorePathProperties()
String
getDocStoreQueueId()
io.ebean.annotation.DocStoreMode
getDocStoreUpdateEvent()
Return the DocStore index behavior for bean updates.String
getDraftTable()
BeanDescriptor.EntityType
getEntityType()
String
getFullName()
Return the bean class name this descriptor is used for.DeployIdentityMode
getIdentityMode()
PlatformIdGenerator
getIdGenerator()
Return the actual IdGenerator for this bean type (can be null).IndexDefinition[]
getIndexDefinitions()
Return the compound unique constraints (can be null).InheritInfo
getInheritInfo()
Returns the Inheritance mapping information.String
getName()
Return the bean short name.Map<String,String>
getNamedQuery()
Return the named ORM queries.Map<String,SpiRawSql>
getNamedRawSql()
Return the named RawSql queries.PartitionMeta
getPartitionMeta()
BeanPersistController
getPersistController()
Return the BeanPersistController (could be a chain of them, 1 or null).BeanPersistListener
getPersistListener()
Return the BeanPersistListener (could be a chain of them, 1 or null).BeanPostConstructListener
getPostConstructListener()
Return the BeanPostCreate(could be a chain of them, 1 or null).BeanPostLoad
getPostLoad()
Return the BeanPostLoad (could be a chain of them, 1 or null).TableJoin
getPrimaryKeyJoin()
String[]
getProperties()
BeanQueryAdapter
getQueryAdapter()
String
getSelectLastInsertedId()
Return the SQL used to return the last inserted Id.String
getSelectLastInsertedIdDraft()
String
getSinglePrimaryKeyColumn()
Return the Primary Key column assuming it is a single column (not compound).String
getStorageEngine()
DeployBeanPropertyAssocOne<?>
getUnidirectional()
DeployBeanProperty
idProperty()
Return the BeanProperty that is the Id.boolean
isBaseTableType()
boolean
isDocStoreMapped()
Return true if this type is mapped for a doc store.boolean
isDocStoreOnly()
boolean
isDraftable()
boolean
isDraftableElement()
boolean
isEmbedded()
boolean
isHistorySupport()
Return true if this is an @History entity bean.boolean
isIdGeneratedValue()
Return true for automatic Id generation strategy.boolean
isPrimaryKeyCompoundOrNonNumeric()
Return true if the primary key is a compound key or if it's database type is non-numeric (and hence not suitable for db identity or sequence.boolean
isReadAuditing()
Return true if read auditing is on for this entity bean.boolean
isScalaObject()
String
parse(String aggregation)
Parse the aggregation formula into expressions with table alias placeholders.void
postAnnotations()
Collection<DeployBeanProperty>
properties()
Collection<DeployBeanProperty>
propertiesAll()
Return a collection of all BeanProperty deployment information.List<DeployBeanPropertyAssocMany<?>>
propertiesAssocMany()
Return BeanPropertyAssocMany for this descriptor.List<DeployBeanPropertyAssocOne<?>>
propertiesAssocOne()
Return an Iterator of BeanPropertyAssocOne that are not embedded.List<DeployBeanProperty>
propertiesBase()
base properties without the unique id properties.void
readDocStore(io.ebean.annotation.DocStore docStore)
Read the top level doc store deployment information.void
setBaseTable(TableName baseTableFull, String asOfSuffix, String versionsBetweenSuffix)
Set the base table.void
setBeanFinder(BeanFindController beanFinder)
Set the BeanFinder to use for beans of this type.void
setCache(io.ebean.annotation.Cache cache)
Enable L2 bean and query caching based on Cache annotation.void
setChangeLogFilter(ChangeLogFilter changeLogFilter)
void
setConcurrencyMode(ConcurrencyMode concurrencyMode)
Set the concurrency mode used for beans of this type.void
setCustomIdGenerator(PlatformIdGenerator idGenerator)
Assign a custom external IdGenerator.void
setDbComment(String dbComment)
void
setDraftable()
void
setDraftableElement()
void
setEntityType(BeanDescriptor.EntityType entityType)
void
setHistorySupport()
Set to true for @History entity beans that have history.void
setIdClass(Class idClass)
Set the IdClass to use.void
setIdentityMode(io.ebean.annotation.Identity identity)
void
setIdentitySequence(int initialValue, int allocationSize, String seqName)
Set from@Sequence
int
setIdentitySequenceBatchMode(boolean sequenceBatchMode)
Return the sequence increment to use given sequence batch mode.void
setIdentitySequenceGenerator(String genName)
Potentially set sequence name from@GeneratedValue
.void
setIdentityType(IdType type)
void
setIdGeneratedValue()
Set when GeneratedValue explicitly mapped on Id property.void
setIdGenerator(PlatformIdGenerator idGenerator)
Set the actual IdGenerator for this bean type.void
setInheritInfo(InheritInfo inheritInfo)
Set the ORM inheritance mapping information.void
setInvalidateQueryCache(String region)
Set that this type invalidates query caches.void
setName(String name)
Set the bean shortName.void
setOrderColumn(DeployBeanProperty orderColumn)
void
setPartitionMeta(PartitionMeta partitionMeta)
void
setPrimaryKeyJoin(TableJoin join)
PK is also a FK.void
setProperties(String[] props)
void
setReadAuditing()
Set read auditing on for this entity bean.void
setSelectLastInsertedId(String selectLastInsertedId, String selectLastInsertedIdDraft)
Set the SQL used to return the last inserted Id.void
setStorageEngine(String storageEngine)
void
setUnidirectional(DeployBeanPropertyAssocOne<?> unidirectional)
void
setUuidGenerator()
Assign the standard UUID generator if one has not been set.void
setView(String viewName, String[] dependentTables)
Set when entity is based on a view.void
sortProperties()
String
toString()
Summary description.
-
-
-
Constructor Detail
-
DeployBeanDescriptor
public DeployBeanDescriptor(BeanDescriptorManager manager, Class<T> beanType, ServerConfig serverConfig)
Construct the BeanDescriptor.
-
-
Method Detail
-
setIdClass
public void setIdClass(Class idClass)
Set the IdClass to use.
-
setPrimaryKeyJoin
public void setPrimaryKeyJoin(TableJoin join)
PK is also a FK.
-
getPrimaryKeyJoin
public TableJoin getPrimaryKeyJoin()
-
setStorageEngine
public void setStorageEngine(String storageEngine)
-
getStorageEngine
public String getStorageEngine()
-
setHistorySupport
public void setHistorySupport()
Set to true for @History entity beans that have history.
-
isHistorySupport
public boolean isHistorySupport()
Return true if this is an @History entity bean.
-
setReadAuditing
public void setReadAuditing()
Set read auditing on for this entity bean.
-
isReadAuditing
public boolean isReadAuditing()
Return true if read auditing is on for this entity bean.
-
setDbComment
public void setDbComment(String dbComment)
-
getDbComment
public String getDbComment()
-
setPartitionMeta
public void setPartitionMeta(PartitionMeta partitionMeta)
-
getPartitionMeta
public PartitionMeta getPartitionMeta()
-
setDraftable
public void setDraftable()
-
isDraftable
public boolean isDraftable()
-
setDraftableElement
public void setDraftableElement()
-
isDraftableElement
public boolean isDraftableElement()
-
readDocStore
public void readDocStore(io.ebean.annotation.DocStore docStore)
Read the top level doc store deployment information.
-
isScalaObject
public boolean isScalaObject()
-
createDeployBeanTable
public DeployBeanTable createDeployBeanTable()
-
setEntityType
public void setEntityType(BeanDescriptor.EntityType entityType)
-
isEmbedded
public boolean isEmbedded()
-
isBaseTableType
public boolean isBaseTableType()
-
isDocStoreOnly
public boolean isDocStoreOnly()
-
getEntityType
public BeanDescriptor.EntityType getEntityType()
-
buildIdentityMode
public IdentityMode buildIdentityMode()
Return the immutable IdentityMode.
-
getIdentityMode
public DeployIdentityMode getIdentityMode()
-
setIdentityMode
public void setIdentityMode(io.ebean.annotation.Identity identity)
-
setIdentitySequence
public void setIdentitySequence(int initialValue, int allocationSize, String seqName)
Set from@Sequence
-
setIdentitySequenceGenerator
public void setIdentitySequenceGenerator(String genName)
Potentially set sequence name from@GeneratedValue
.
-
setIdentitySequenceBatchMode
public int setIdentitySequenceBatchMode(boolean sequenceBatchMode)
Return the sequence increment to use given sequence batch mode.
-
setIdentityType
public void setIdentityType(IdType type)
-
getProperties
public String[] getProperties()
-
setProperties
public void setProperties(String[] props)
-
getBeanType
public Class<T> getBeanType()
Return the class type this BeanDescriptor describes.
-
setChangeLogFilter
public void setChangeLogFilter(ChangeLogFilter changeLogFilter)
-
getChangeLogFilter
public ChangeLogFilter getChangeLogFilter()
-
getInheritInfo
public InheritInfo getInheritInfo()
Returns the Inheritance mapping information. This will be null if this type of bean is not involved in any ORM inheritance mapping.
-
setInheritInfo
public void setInheritInfo(InheritInfo inheritInfo)
Set the ORM inheritance mapping information.
-
setInvalidateQueryCache
public void setInvalidateQueryCache(String region)
Set that this type invalidates query caches.
-
setCache
public void setCache(io.ebean.annotation.Cache cache)
Enable L2 bean and query caching based on Cache annotation.
-
getCacheOptions
public CacheOptions getCacheOptions()
Return the cache options.
-
getUnidirectional
public DeployBeanPropertyAssocOne<?> getUnidirectional()
-
setUnidirectional
public void setUnidirectional(DeployBeanPropertyAssocOne<?> unidirectional)
-
setOrderColumn
public void setOrderColumn(DeployBeanProperty orderColumn)
-
getConcurrencyMode
public ConcurrencyMode getConcurrencyMode()
Return the concurrency mode used for beans of this type.
-
setConcurrencyMode
public void setConcurrencyMode(ConcurrencyMode concurrencyMode)
Set the concurrency mode used for beans of this type.
-
addIndex
public void addIndex(IndexDefinition c)
Add a compound unique constraint.
-
getIndexDefinitions
public IndexDefinition[] getIndexDefinitions()
Return the compound unique constraints (can be null).
-
getBeanFinder
public BeanFindController getBeanFinder()
Return the beanFinder. Usually null unless overriding the finder.
-
setBeanFinder
public void setBeanFinder(BeanFindController beanFinder)
Set the BeanFinder to use for beans of this type. This is set to override the finding from the default.
-
getPersistController
public BeanPersistController getPersistController()
Return the BeanPersistController (could be a chain of them, 1 or null).
-
getPersistListener
public BeanPersistListener getPersistListener()
Return the BeanPersistListener (could be a chain of them, 1 or null).
-
getQueryAdapter
public BeanQueryAdapter getQueryAdapter()
-
getPostLoad
public BeanPostLoad getPostLoad()
Return the BeanPostLoad (could be a chain of them, 1 or null).
-
getPostConstructListener
public BeanPostConstructListener getPostConstructListener()
Return the BeanPostCreate(could be a chain of them, 1 or null).
-
addPersistController
public void addPersistController(BeanPersistController controller)
-
addPersistListener
public void addPersistListener(BeanPersistListener listener)
-
addQueryAdapter
public void addQueryAdapter(BeanQueryAdapter queryAdapter)
-
addPostLoad
public void addPostLoad(BeanPostLoad postLoad)
-
addPostConstructListener
public void addPostConstructListener(BeanPostConstructListener postConstructListener)
-
getDraftTable
public String getDraftTable()
-
getDependentTables
public String[] getDependentTables()
For view based entity return the dependant tables.
-
getBaseTable
public String getBaseTable()
Return the base table. Only properties mapped to the base table are by default persisted.
-
getBaseTableAsOf
public String getBaseTableAsOf()
Return the base table with as of suffix.
-
getBaseTableVersionsBetween
public String getBaseTableVersionsBetween()
Return the base table with versions between suffix.
-
getBaseTableFull
public TableName getBaseTableFull()
Return the base table with full structure.
-
setView
public void setView(String viewName, String[] dependentTables)
Set when entity is based on a view.
-
setBaseTable
public void setBaseTable(TableName baseTableFull, String asOfSuffix, String versionsBetweenSuffix)
Set the base table. Only properties mapped to the base table are by default persisted.
-
sortProperties
public void sortProperties()
-
postAnnotations
public void postAnnotations()
-
addBeanProperty
public DeployBeanProperty addBeanProperty(DeployBeanProperty prop)
Add a bean property.
-
properties
public Collection<DeployBeanProperty> properties()
-
getBeanProperty
public DeployBeanProperty getBeanProperty(String propName)
Get a BeanProperty by its name.
-
getFullName
public String getFullName()
Return the bean class name this descriptor is used for.If this BeanDescriptor is for a table then this returns the table name instead.
-
getSelectLastInsertedId
public String getSelectLastInsertedId()
Return the SQL used to return the last inserted Id.Used with Identity columns where getGeneratedKeys is not supported.
-
getSelectLastInsertedIdDraft
public String getSelectLastInsertedIdDraft()
-
setSelectLastInsertedId
public void setSelectLastInsertedId(String selectLastInsertedId, String selectLastInsertedIdDraft)
Set the SQL used to return the last inserted Id.
-
getIdGenerator
public PlatformIdGenerator getIdGenerator()
Return the actual IdGenerator for this bean type (can be null).
-
setIdGenerator
public void setIdGenerator(PlatformIdGenerator idGenerator)
Set the actual IdGenerator for this bean type.
-
isIdGeneratedValue
public boolean isIdGeneratedValue()
Return true for automatic Id generation strategy.
-
setIdGeneratedValue
public void setIdGeneratedValue()
Set when GeneratedValue explicitly mapped on Id property.
-
setUuidGenerator
public void setUuidGenerator()
Assign the standard UUID generator if one has not been set.
-
setCustomIdGenerator
public void setCustomIdGenerator(PlatformIdGenerator idGenerator)
Assign a custom external IdGenerator.
-
propertiesAll
public Collection<DeployBeanProperty> propertiesAll()
Return a collection of all BeanProperty deployment information.
-
getDefaultSelectClause
public String getDefaultSelectClause()
Return the defaultSelectClause using FetchType.LAZY and FetchType.EAGER.
-
isPrimaryKeyCompoundOrNonNumeric
public boolean isPrimaryKeyCompoundOrNonNumeric()
Return true if the primary key is a compound key or if it's database type is non-numeric (and hence not suitable for db identity or sequence.
-
getSinglePrimaryKeyColumn
public String getSinglePrimaryKeyColumn()
Return the Primary Key column assuming it is a single column (not compound). This is for the purpose of defining a sequence name.
-
idProperty
public DeployBeanProperty idProperty()
Return the BeanProperty that is the Id.
-
findJoinToTable
public DeployBeanPropertyAssocOne<?> findJoinToTable(String tableName)
-
propertiesAssocOne
public List<DeployBeanPropertyAssocOne<?>> propertiesAssocOne()
Return an Iterator of BeanPropertyAssocOne that are not embedded. These are effectively joined beans. For ManyToOne and OneToOne associations.
-
propertiesAssocMany
public List<DeployBeanPropertyAssocMany<?>> propertiesAssocMany()
Return BeanPropertyAssocMany for this descriptor.
-
propertiesBase
public List<DeployBeanProperty> propertiesBase()
base properties without the unique id properties.
-
checkInheritanceMapping
public void checkInheritanceMapping()
Check the mapping for class inheritance
-
getDocStorePathProperties
public PathProperties getDocStorePathProperties()
-
isDocStoreMapped
public boolean isDocStoreMapped()
Return true if this type is mapped for a doc store.
-
getDocStoreQueueId
public String getDocStoreQueueId()
-
getDocStoreIndexName
public String getDocStoreIndexName()
-
getDocStoreIndexType
public String getDocStoreIndexType()
-
getDocStore
public io.ebean.annotation.DocStore getDocStore()
-
getDocStoreInsertEvent
public io.ebean.annotation.DocStoreMode getDocStoreInsertEvent()
Return the DocStore index behavior for bean inserts.
-
getDocStoreUpdateEvent
public io.ebean.annotation.DocStoreMode getDocStoreUpdateEvent()
Return the DocStore index behavior for bean updates.
-
getDocStoreDeleteEvent
public io.ebean.annotation.DocStoreMode getDocStoreDeleteEvent()
Return the DocStore index behavior for bean deletes.
-
getNamedQuery
public Map<String,String> getNamedQuery()
Return the named ORM queries.
-
addNamedQuery
public void addNamedQuery(String name, String query)
Add a named query.
-
getNamedRawSql
public Map<String,SpiRawSql> getNamedRawSql()
Return the named RawSql queries.
-
addRawSql
public void addRawSql(String name, SpiRawSql rawSql)
Add a named RawSql from ebean.xml file.
-
-