Module org.eclipse.persistence.core
Class TablePerMultitenantPolicy
java.lang.Object
org.eclipse.persistence.descriptors.TablePerMultitenantPolicy
- All Implemented Interfaces:
Serializable,Cloneable,MultitenantPolicy
- Direct Known Subclasses:
SchemaPerMultitenantPolicy
A table per tenant multitenant policy. Tables can either be per schema
or augmented with a prefix or suffix per tenant.
- Since:
- EclipseLink 2.4
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected ClassDescriptorprotected Map<DatabaseTable, DatabaseTable> protected TenantTableDiscriminatorType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFieldsToRow(AbstractRecord row, AbstractSession session) INTERNAL:voidaddToTableDefinition(TableDefinition tableDefinition) INTERNAL:clone(ClassDescriptor descriptor) INTERNAL: Multitenant policies are cloned per inheritance subclass.INTERNAL: Return the context property for this table per tenant policy.INTERNAL: Return the new database table associated with this tenant.getTable(DatabaseTable table) INTERNAL: Return the new database table associated with this tenant.protected StringgetTableName(DatabaseTable table, String tenant) INTERNAL: Return the tenant table name.booleanINTERNAL: Return true if the tenant has been set for this policy.voidinitialize(AbstractSession session) INTERNAL:booleanPUBLIC: Return true if this descriptor requires a prefix to the table per tenant.booleanINTERNAL:booleanPUBLIC: Return true if this descriptor requires a table schema per tenant.booleanINTERNAL:booleanPUBLIC: Return true if this descriptor requires a suffix to the table per tenant.booleanINTERNAL:voidpostInitialize(AbstractSession session) INTERNAL:voidpreInitialize(AbstractSession session) INTERNAL:voidsetContextProperty(String contextProperty) PUBLIC: Set the context property used to define the table per tenant.voidsetContextTenant(String contextTenant) INTERNAL:protected voidINTERNAL: This method is used to update the table per tenant descriptor with a table per tenant prefix or suffix on its associated tables.protected voidINTERNAL: This method is used to update the table per tenant descriptor with a table per tenant schema.voidPUBLIC: Set the tenant table discriminator type.booleanshouldInitialize(AbstractSession session) INTERNAL: This method is called during regular descriptor initialization.protected DatabaseTableupdateTable(DatabaseTable table) INTERNAL: This method will update the table by cloning it and setting a new name on it.booleanusesContextProperty(String property) INTERNAL: Return true if this policy accepts the given property.
-
Field Details
-
descriptor
-
tablePerTenantTables
-
type
-
contextProperty
-
contextTenant
-
-
Constructor Details
-
TablePerMultitenantPolicy
-
-
Method Details
-
addFieldsToRow
INTERNAL:- Specified by:
addFieldsToRowin interfaceMultitenantPolicy
-
addToTableDefinition
INTERNAL:- Specified by:
addToTableDefinitionin interfaceMultitenantPolicy
-
clone
INTERNAL: Multitenant policies are cloned per inheritance subclass.- Specified by:
clonein interfaceMultitenantPolicy
-
getContextProperty
INTERNAL: Return the context property for this table per tenant policy. -
getTable
INTERNAL: Return the new database table associated with this tenant. -
getTable
INTERNAL: Return the new database table associated with this tenant. -
getTableName
INTERNAL: Return the tenant table name. -
hasContextTenant
public boolean hasContextTenant()INTERNAL: Return true if the tenant has been set for this policy. -
initialize
INTERNAL:- Specified by:
initializein interfaceMultitenantPolicy- Throws:
DescriptorException
-
isPrefixPerTable
public boolean isPrefixPerTable()PUBLIC: Return true if this descriptor requires a prefix to the table per tenant. -
isSchemaPerTable
public boolean isSchemaPerTable()PUBLIC: Return true if this descriptor requires a table schema per tenant. -
isSingleTableMultitenantPolicy
public boolean isSingleTableMultitenantPolicy()INTERNAL:- Specified by:
isSingleTableMultitenantPolicyin interfaceMultitenantPolicy
-
isSchemaPerMultitenantPolicy
public boolean isSchemaPerMultitenantPolicy()INTERNAL:- Specified by:
isSchemaPerMultitenantPolicyin interfaceMultitenantPolicy
-
isSuffixPerTable
public boolean isSuffixPerTable()PUBLIC: Return true if this descriptor requires a suffix to the table per tenant. -
isTablePerMultitenantPolicy
public boolean isTablePerMultitenantPolicy()INTERNAL:- Specified by:
isTablePerMultitenantPolicyin interfaceMultitenantPolicy
-
postInitialize
INTERNAL:- Specified by:
postInitializein interfaceMultitenantPolicy
-
preInitialize
INTERNAL:- Specified by:
preInitializein interfaceMultitenantPolicy- Throws:
DescriptorException
-
setTenantTableDiscriminatorType
PUBLIC: Set the tenant table discriminator type. -
setContextProperty
PUBLIC: Set the context property used to define the table per tenant. If it is not set by the user, the policy defaults it to the multitenant property default of "eclipselink.tenant-id" -
setTablePerTenant
protected void setTablePerTenant()INTERNAL: This method is used to update the table per tenant descriptor with a table per tenant prefix or suffix on its associated tables. This includes any relation tables from mappings. If the given session is a client session than we must clone the tables. Outside of a client session, assume global usage and no cloning is needed. This method should only be called at the start of a client session lifecycle and should only be called once. -
setTableSchemaPerTenant
protected void setTableSchemaPerTenant()INTERNAL: This method is used to update the table per tenant descriptor with a table per tenant schema. This includes any relation tables from mappings. This will be done through the setting of a table qualifier on the tables. This method should only be called at the start of a client session lifecycle and should only be called once. -
setContextTenant
INTERNAL: -
shouldInitialize
INTERNAL: This method is called during regular descriptor initialization. When initializing at that level no cloning should be done on when setting the context tenant. -
updateTable
INTERNAL: This method will update the table by cloning it and setting a new name on it. The table association will be stored here as well for ease of future look up. -
usesContextProperty
INTERNAL: Return true if this policy accepts the given property.
-