Class TablePerMultitenantPolicy

    • Field Detail

      • tablePerTenantTables

        protected Map<org.eclipse.persistence.internal.helper.DatabaseTable,​org.eclipse.persistence.internal.helper.DatabaseTable> tablePerTenantTables
      • contextProperty

        protected String contextProperty
      • contextTenant

        protected String contextTenant
    • 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 String getContextProperty()
        INTERNAL: Return the context property for this table per tenant policy.
      • getTable

        public org.eclipse.persistence.internal.helper.DatabaseTable getTable​(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.
      • getTableName

        protected String getTableName​(org.eclipse.persistence.internal.helper.DatabaseTable table,
                                      String tenant)
        INTERNAL: Return the tenant table name.
      • 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​(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"
      • 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

        public void setContextTenant​(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.
      • updateTable

        protected org.eclipse.persistence.internal.helper.DatabaseTable updateTable​(org.eclipse.persistence.internal.helper.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.
      • usesContextProperty

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