Top Description Fields Constructors Methods
org.eclipse.persistence.descriptors

public Class TablePerMultitenantPolicy

extends Object
implements MultitenantPolicy, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, org.eclipse.persistence.descriptors.MultitenantPolicy, java.io.Serializable
Known Direct Subclasses
org.eclipse.persistence.descriptors.SchemaPerMultitenantPolicy
Imports
java.util.HashMap, .HashSet, .Map, .Set, .Vector, org.eclipse.persistence.annotations.TenantTableDiscriminatorType, org.eclipse.persistence.config.EntityManagerProperties, org.eclipse.persistence.exceptions.DescriptorException, org.eclipse.persistence.internal.helper.DatabaseTable, .NonSynchronizedVector, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, org.eclipse.persistence.mappings.DatabaseMapping, .DirectCollectionMapping, .ManyToManyMapping, .OneToOneMapping, org.eclipse.persistence.tools.schemaframework.TableDefinition

A table per tenant multitenant policy. Tables can either be per schema or augmented with a prefix or suffix per tenant.
Author
Guy Pelletier
Since
EclipseLink 2.4

Field Summary

Modifier and TypeField and Description
protected String
protected String
protected ClassDescriptor
protected Map<DatabaseTable, DatabaseTable>
protected TenantTableDiscriminatorType

Constructor Summary

AccessConstructor and Description
pack-priv
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
public MultitenantPolicy
clone(ClassDescriptor descriptor)

Implements org.eclipse.persistence.descriptors.MultitenantPolicy.clone.

INTERNAL: Multitenant policies are cloned per inheritance subclass.
public String
getContextProperty()

INTERNAL: Return the context property for this table per tenant policy.

public DatabaseTable
getTable(String tableName)

INTERNAL: Return the new database table associated with this tenant.

public DatabaseTable
getTable(DatabaseTable table)

INTERNAL: Return the new database table associated with this tenant.

protected String
getTableName(DatabaseTable table, String tenant)

INTERNAL: Return the tenant table name.

public boolean
hasContextTenant()

INTERNAL: Return true if the tenant has been set for this policy.

public void
public boolean
isPrefixPerTable()

PUBLIC: Return true if this descriptor requires a prefix to the table per tenant.

public boolean
public boolean
isSchemaPerTable()

PUBLIC: Return true if this descriptor requires a table schema per tenant.

public boolean
public boolean
isSuffixPerTable()

PUBLIC: Return true if this descriptor requires a suffix to the table per tenant.

public boolean
public void
public void
public void
setContextProperty(String contextProperty)

PUBLIC: Set the context property used to define the table per tenant.

public void
setContextTenant(String contextTenant)

INTERNAL:

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.

protected void
setTableSchemaPerTenant()

INTERNAL: This method is used to update the table per tenant descriptor with a table per tenant schema.

public void
setTenantTableDiscriminatorType(TenantTableDiscriminatorType type)

PUBLIC: Set the tenant table discriminator type.

public boolean
shouldInitialize(AbstractSession session)

INTERNAL: This method is called during regular descriptor initialization.

protected DatabaseTable
updateTable(DatabaseTable table)

INTERNAL: This method will update the table by cloning it and setting a new name on it.

public boolean
usesContextProperty(String property)

INTERNAL: Return true if this policy accepts the given property.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextPropertyback to summary
protected String contextProperty
contextTenantback to summary
protected String contextTenant
descriptorback to summary
protected ClassDescriptor descriptor
tablePerTenantTablesback to summary
protected Map<DatabaseTable, DatabaseTable> tablePerTenantTables
typeback to summary
protected TenantTableDiscriminatorType type

Constructor Detail

TablePerMultitenantPolicyback to summary
pack-priv TablePerMultitenantPolicy()
TablePerMultitenantPolicyback to summary
public TablePerMultitenantPolicy(ClassDescriptor desc)

Method Detail

addFieldsToRowback to summary
public void addFieldsToRow(AbstractRecord row, AbstractSession session)

Implements org.eclipse.persistence.descriptors.MultitenantPolicy.addFieldsToRow.

INTERNAL:

Annotations
@Override
addToTableDefinitionback to summary
public void addToTableDefinition(TableDefinition tableDefinition)

Implements org.eclipse.persistence.descriptors.MultitenantPolicy.addToTableDefinition.

INTERNAL:

Annotations
@Override
cloneback to summary
public MultitenantPolicy clone(ClassDescriptor descriptor)

Implements org.eclipse.persistence.descriptors.MultitenantPolicy.clone.

INTERNAL: Multitenant policies are cloned per inheritance subclass.

Annotations
@Override
getContextPropertyback to summary
public String getContextProperty()

INTERNAL: Return the context property for this table per tenant policy.

getTableback to summary
public DatabaseTable getTable(String tableName)

INTERNAL: Return the new database table associated with this tenant.

getTableback to summary
public DatabaseTable getTable(DatabaseTable table)

INTERNAL: Return the new database table associated with this tenant.

getTableNameback to summary
protected String getTableName(DatabaseTable table, String tenant)

INTERNAL: Return the tenant table name.

hasContextTenantback to summary
public boolean hasContextTenant()

INTERNAL: Return true if the tenant has been set for this policy.

initializeback to summary
public void initialize(AbstractSession session) throws DescriptorException

Implements org.eclipse.persistence.descriptors.MultitenantPolicy.initialize.

INTERNAL:

Annotations
@Override
isPrefixPerTableback to summary
public boolean isPrefixPerTable()

PUBLIC: Return true if this descriptor requires a prefix to the table per tenant.

isSchemaPerMultitenantPolicyback to summary
public boolean isSchemaPerMultitenantPolicy()

Implements org.eclipse.persistence.descriptors.MultitenantPolicy.isSchemaPerMultitenantPolicy.

INTERNAL:

Annotations
@Override
isSchemaPerTableback to summary
public boolean isSchemaPerTable()

PUBLIC: Return true if this descriptor requires a table schema per tenant.

isSingleTableMultitenantPolicyback to summary
public boolean isSingleTableMultitenantPolicy()

Implements org.eclipse.persistence.descriptors.MultitenantPolicy.isSingleTableMultitenantPolicy.

INTERNAL:

Annotations
@Override
isSuffixPerTableback to summary
public boolean isSuffixPerTable()

PUBLIC: Return true if this descriptor requires a suffix to the table per tenant.

isTablePerMultitenantPolicyback to summary
public boolean isTablePerMultitenantPolicy()

Implements org.eclipse.persistence.descriptors.MultitenantPolicy.isTablePerMultitenantPolicy.

INTERNAL:

Annotations
@Override
postInitializeback to summary
public void postInitialize(AbstractSession session)

Implements org.eclipse.persistence.descriptors.MultitenantPolicy.postInitialize.

INTERNAL:

Annotations
@Override
preInitializeback to summary
public void preInitialize(AbstractSession session) throws DescriptorException

Implements org.eclipse.persistence.descriptors.MultitenantPolicy.preInitialize.

INTERNAL:

Annotations
@Override
setContextPropertyback to summary
public void setContextProperty(String contextProperty)

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"

setContextTenantback to summary
public void setContextTenant(String contextTenant)

INTERNAL:

setTablePerTenantback to summary
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.

setTableSchemaPerTenantback to summary
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.

setTenantTableDiscriminatorTypeback to summary
public void setTenantTableDiscriminatorType(TenantTableDiscriminatorType type)

PUBLIC: Set the tenant table discriminator type.

shouldInitializeback to summary
public boolean shouldInitialize(AbstractSession session)

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.

updateTableback to summary
protected DatabaseTable updateTable(DatabaseTable table)

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.

usesContextPropertyback to summary
public boolean usesContextProperty(String property)

INTERNAL: Return true if this policy accepts the given property.