Interface TenantManager

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Tenant create​(java.lang.String tenantId, java.util.Map<java.lang.String,​java.lang.Object> properties)
      Creates a new tenant with the given tenant ID and the initial set of properties.
      void remove​(Tenant tenant)
      Removes the given tenant.
      void removeProperties​(Tenant tenant, java.lang.String... propertyNames)
      Removes one or more properties from the tenant.
      void setProperties​(Tenant tenant, java.util.Map<java.lang.String,​java.lang.Object> properties)
      Sets or removes multiple properties on the tenant.
      void setProperty​(Tenant tenant, java.lang.String name, java.lang.Object value)
      Sets a single property of the tenant to a new value or removes the property if the value is null.
    • Method Detail

      • create

        Tenant create​(java.lang.String tenantId,
                      java.util.Map<java.lang.String,​java.lang.Object> properties)
        Creates a new tenant with the given tenant ID and the initial set of properties.

        After creating the tenant, the TenantManagerHook.setup(Tenant) method is called to allow customizers to configure additional properties.

        Before returning the newly created tenant object the data is persisted.

        Parameters:
        tenantId - The name of the new tenant. This name must not be null or an empty string. It must also not be the same name as that of an existing tenant.
        properties - An optional map of initial properties. This may be null to not preset any properties. It is recommended, though, that this map contain at least the Tenant.PROP_NAME and Tenant.PROP_DESCRIPTION properties.
        Returns:
        The newly created Tenant instance or null if a tenant with the id already exists.
        Throws:
        java.lang.NullPointerException - if tenantId is null.
      • setProperty

        void setProperty​(Tenant tenant,
                         java.lang.String name,
                         java.lang.Object value)
        Sets a single property of the tenant to a new value or removes the property if the value is null.

        Before returning the TenantManagerHook.change(Tenant) method is called to allow customizers to configure additional properties.

        Parameters:
        tenant - The tenant whose property is to be set or remove.
        name - The name of the property to set or remove.
        value - The new value of the property. If this value is null the property is actually removed.
        Throws:
        java.lang.NullPointerException - if tenant or name is null.
      • setProperties

        void setProperties​(Tenant tenant,
                           java.util.Map<java.lang.String,​java.lang.Object> properties)
        Sets or removes multiple properties on the tenant.

        Before returning the TenantManagerHook.change(Tenant) method is called to allow customizers to configure additional properties.

        Parameters:
        tenant - The tenant whose properties are to be modified.
        properties - The map of properties to set or remove. A property whose value is null is removed from the tenant.
        Throws:
        java.lang.NullPointerException - if tenant or properties is null.
      • removeProperties

        void removeProperties​(Tenant tenant,
                              java.lang.String... propertyNames)
        Removes one or more properties from the tenant.

        Before returning the TenantManagerHook.change(Tenant) method is called to allow customizers to configure additional properties unless the properties parameter is null or empty.

        Parameters:
        tenant - The tenant from which to remove properties.
        propertyNames - The list of properties to be removed. If this is null or empty, nothing happens and the TenantCustomizer is not called.
        Throws:
        java.lang.NullPointerException - if tenant is null.
      • remove

        void remove​(Tenant tenant)
        Removes the given tenant.

        Before returning the TenantManagerHook.remove(Tenant) method is called to allow customizers to implement further cleanup upon tenant removal.

        Parameters:
        tenant - The tenant to remove.
        Throws:
        java.lang.NullPointerException - if tenant is null