Class TablePerMultitenantPolicy

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, MultitenantPolicy
    Direct Known Subclasses:
    SchemaPerMultitenantPolicy

    public class TablePerMultitenantPolicy
    extends java.lang.Object
    implements MultitenantPolicy, java.lang.Cloneable
    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
    Author:
    Guy Pelletier
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFieldsToRow​(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL:
      void addToTableDefinition​(TableDefinition tableDefinition)
      INTERNAL:
      MultitenantPolicy clone​(ClassDescriptor descriptor)
      INTERNAL: Multitenant policies are cloned per inheritance subclass.
      java.lang.String getContextProperty()
      INTERNAL: Return the context property for this table per tenant policy.
      org.eclipse.persistence.internal.helper.DatabaseTable getTable​(java.lang.String tableName)
      INTERNAL: Return the new database table associated with this tenant.
      org.eclipse.persistence.internal.helper.DatabaseTable getTable​(org.eclipse.persistence.internal.helper.DatabaseTable table)
      INTERNAL: Return the new database table associated with this tenant.
      boolean hasContextTenant()
      INTERNAL: Return true if the tenant has been set for this policy.
      void initialize​(org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL:
      boolean isPrefixPerTable()
      PUBLIC: Return true if this descriptor requires a prefix to the table per tenant.
      boolean isSchemaPerMultitenantPolicy()
      INTERNAL:
      boolean isSchemaPerTable()
      PUBLIC: Return true if this descriptor requires a table schema per tenant.
      boolean isSingleTableMultitenantPolicy()
      INTERNAL:
      boolean isSuffixPerTable()
      PUBLIC: Return true if this descriptor requires a suffix to the table per tenant.
      boolean isTablePerMultitenantPolicy()
      INTERNAL:
      void postInitialize​(org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL:
      void preInitialize​(org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL:
      void setContextProperty​(java.lang.String contextProperty)
      PUBLIC: Set the context property used to define the table per tenant.
      void setContextTenant​(java.lang.String contextTenant)
      INTERNAL:
      void setTenantTableDiscriminatorType​(TenantTableDiscriminatorType type)
      PUBLIC: Set the tenant table discriminator type.
      boolean shouldInitialize​(org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: This method is called during regular descriptor initialization.
      boolean usesContextProperty​(java.lang.String property)
      INTERNAL: Return true if this policy accepts the given property.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TablePerMultitenantPolicy

        public TablePerMultitenantPolicy​(ClassDescriptor desc)
    • Method Detail

      • addFieldsToRow

        public void addFieldsToRow​(org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                   org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL:
        Specified by:
        addFieldsToRow in interface MultitenantPolicy
      • getContextProperty

        public java.lang.String getContextProperty()
        INTERNAL: Return the context property for this table per tenant policy.
      • getTable

        public org.eclipse.persistence.internal.helper.DatabaseTable getTable​(java.lang.String tableName)
        INTERNAL: Return the new database table associated with this tenant.
      • getTable

        public org.eclipse.persistence.internal.helper.DatabaseTable getTable​(org.eclipse.persistence.internal.helper.DatabaseTable table)
        INTERNAL: Return the new database table associated with this tenant.
      • hasContextTenant

        public boolean hasContextTenant()
        INTERNAL: Return true if the tenant has been set for this policy.
      • 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.
      • isSuffixPerTable

        public boolean isSuffixPerTable()
        PUBLIC: Return true if this descriptor requires a suffix to the table per tenant.
      • postInitialize

        public void postInitialize​(org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL:
        Specified by:
        postInitialize in interface MultitenantPolicy
      • setTenantTableDiscriminatorType

        public void setTenantTableDiscriminatorType​(TenantTableDiscriminatorType type)
        PUBLIC: Set the tenant table discriminator type.
      • setContextProperty

        public void setContextProperty​(java.lang.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"
      • setContextTenant

        public void setContextTenant​(java.lang.String contextTenant)
        INTERNAL:
      • shouldInitialize

        public boolean shouldInitialize​(org.eclipse.persistence.internal.sessions.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.
      • usesContextProperty

        public boolean usesContextProperty​(java.lang.String property)
        INTERNAL: Return true if this policy accepts the given property.