java.lang.Object
com.broadleafcommerce.data.tracking.core.tenant.domain.Application
All Implemented Interfaces:
ContextStateAware, Serializable

public class Application extends Object implements ContextStateAware, Serializable
Represents the tenant concept of a storefront structure. This structure ties together concepts of visible catalogs, as well as URI resolution.
Author:
Jeff Fischer
See Also:
  • Constructor Details

    • Application

      public Application(String id)
    • Application

      public Application()
  • Method Details

    • mutability

      @Nullable public String mutability(@NonNull Catalog catalog)
      Given a catalog, determine the mutability of that catalog from the viewpoint of this application.
      Parameters:
      catalog - the catalog instance to check
      Returns:
      the string representation of the mutability if available, else MutabilityType.CUSTOMIZABLE
    • computeDefaultCurrency

      public Currency computeDefaultCurrency()
      Utility method to retrieve the default currency. If defaultCurrency is null, this will compute it from the default currency (Currency.getInstance(Locale)) of defaultLocale.
      Returns:
      The computed default currency for this application
      See Also:
      • defaultCurrency
    • computeAllowedCurrencies

      public List<Currency> computeAllowedCurrencies()
      Utility method to retrieve allowed currencies. If allowedCurrencies is empty, this will compute them from the default currencies (Currency.getInstance(Locale)) for each of the allowed locales. Otherwise, this will return a copy of allowedCurrencies to prevent accidental mutation.
      Returns:
      Computed list of allowed currencies for this application
      See Also:
      • allowedCurrencies
    • getId

      public String getId()
      The context id, which is a separate identifier from the database primary key. This may be auto generated, or may be explicity provided upon entity creation.
      Returns:
      Separate identifier from the database primary key
    • getName

      public String getName()
      The general name for the application
      Returns:
      The general name for the application
    • getTenantId

      public String getTenantId()
      The tenant to which this application belongs
      Returns:
      The tenant to which this application belongs
    • getIdentifierType

      public String getIdentifierType()
      Defines the type of the application identifier: Whether a domain or a domain prefix.
      Returns:
      the type of the application identifier: Whether a domain or a domain prefix.
      See Also:
    • getIdentifierValue

      public String getIdentifierValue()
      Determines how applications are distinguished from each other using all or part of their domains or hostnames. Values could be the myapplication.mycompany.com in https://myapplication.mycompany.com/ or the myapplication in https://myapplication.mycompany.com/ depending on identifierType.
      Returns:
      the domain (a.k.a., hostname) or domain segment identifying this application.
      See Also:
      • identifierType
    • getCustomerContextId

      public String getCustomerContextId()
      The customer context id that is used to discriminate entities with TrackableBehavior.CUSTOMER_CONTEXT.
    • isDeactivated

      public boolean isDeactivated()
      Determines whether this application is active.
      Returns:
      Determines whether this application is active.
    • getDefaultLocale

      public Locale getDefaultLocale()
      The Locale that this application, by default, assumes all data is within and can drive the default Locale selection as a result.
      Returns:
      The default Locale as a string.
    • getAllowedLocales

      public List<Locale> getAllowedLocales()
      List of Locales that are available to be selected for this application. All Catalogs within that are related to this application's should be restricted to this locale set.
      Returns:
      List of Locales available for this application.
    • getDefaultCurrency

      public Currency getDefaultCurrency()
      The Currency that this application, by default, assumes all data is within and can drive the default currency selection on a frontend. If not set, the system will use the default currency for defaultLocale in response to API requests.
      Returns:
      The Currency that this application.
    • getAllowedCurrencies

      public List<Currency> getAllowedCurrencies()
      List of Currencies that are available to be selected for use with this application. All Catalogs that are related to this application should be restricted to this currency set. However, note that this can be empty, in which case, APIs will respond to requests with a list of currencies that the system determines to be the defaults for each locale in allowedLocales.
      Returns:
      List of Currencies that are available to be selected for use with this application
    • getIsolatedCatalogs

      public List<ApplicationCatalogRef> getIsolatedCatalogs()
      Individual catalogs assigned to this application. ApplicationCatalogRefs provide additional control over the mutability and visibility of the contents of the catalogs assigned.
      Returns:
      Individual catalogs assigned to this application
      See Also:
    • getInheritanceLines

      public InheritanceLines getInheritanceLines()
      Context list of the contextIds for the deep catalog tree parenting the isolatedCatalogs. These values are generally not included in reported Json, but instead are calculated and leveraged internally during catalog visibility and mutability determinations.
      Returns:
      Context list of the contextIds for the deep catalog tree parenting the isolatedCatalogs
    • isMarketplace

      public boolean isMarketplace()
      Whether or not the application is a marketplace application. Marketplace applications leverage MarketplaceApplicationCatalog relationships to catalogs, in addition to the explicit relationships declared in getIsolatedCatalogs().

      Generally, all relationships to vendor catalogs should be defined exclusively with MarketplaceApplicationCatalog, and any additional relationships to non-vendor catalogs would be in getIsolatedCatalogs().

      Returns:
      Whether or not the application is a marketplace
    • getContextState

      public ContextState getContextState()
      A subset of Tracking information to expose the context state for this object.
      Specified by:
      getContextState in interface ContextStateAware
      Returns:
      a subset of Tracking information to expose the context state for this object
    • setId

      public void setId(String id)
      The context id, which is a separate identifier from the database primary key. This may be auto generated, or may be explicity provided upon entity creation.
      Parameters:
      id - Separate identifier from the database primary key
    • setName

      public void setName(String name)
      The general name for the application
      Parameters:
      name - The general name for the application
    • setTenantId

      public void setTenantId(String tenantId)
      The tenant to which this application belongs
      Parameters:
      tenantId - The tenant to which this application belongs
    • setIdentifierType

      public void setIdentifierType(String identifierType)
      Defines the type of the application identifier: Whether a domain or a domain prefix.
      Parameters:
      identifierType - the type of the application identifier: Whether a domain or a domain prefix.
      See Also:
    • setIdentifierValue

      public void setIdentifierValue(String identifierValue)
      Determines how applications are distinguished from each other using all or part of their domains or hostnames. Values could be the myapplication.mycompany.com in https://myapplication.mycompany.com/ or the myapplication in https://myapplication.mycompany.com/ depending on identifierType.
      Parameters:
      identifierValue - the domain (a.k.a., hostname) or domain segment identifying this application.
      See Also:
      • identifierType
    • setCustomerContextId

      public void setCustomerContextId(String customerContextId)
      The customer context id that is used to discriminate entities with TrackableBehavior.CUSTOMER_CONTEXT.
    • setDeactivated

      public void setDeactivated(boolean deactivated)
      Determines whether this application is active.
      Parameters:
      deactivated - Determines whether this application is active.
    • setDefaultLocale

      public void setDefaultLocale(Locale defaultLocale)
      The Locale that this application, by default, assumes all data is within and can drive the default Locale selection as a result.
      Parameters:
      defaultLocale - The default Locale as a string.
    • setAllowedLocales

      public void setAllowedLocales(List<Locale> allowedLocales)
      List of Locales that are available to be selected for this application. All Catalogs within that are related to this application's should be restricted to this locale set.
      Parameters:
      allowedLocales - List of Locales available for this application.
    • setDefaultCurrency

      public void setDefaultCurrency(Currency defaultCurrency)
      The Currency that this application, by default, assumes all data is within and can drive the default currency selection on a frontend. If not set, the system will use the default currency for defaultLocale in response to API requests.
      Parameters:
      defaultCurrency - The Currency that this application
    • setAllowedCurrencies

      public void setAllowedCurrencies(List<Currency> allowedCurrencies)
      List of Currencies that are available to be selected for use with this application. All Catalogs that are related to this application should be restricted to this currency set. However, note that this can be empty, in which case, APIs will respond to requests with a list of currencies that the system determines to be the defaults for each locale in allowedLocales.
      Parameters:
      allowedCurrencies - List of Currencies that are available to be selected for use with this application
    • setIsolatedCatalogs

      public void setIsolatedCatalogs(List<ApplicationCatalogRef> isolatedCatalogs)
      Individual catalogs assigned to this application. ApplicationCatalogRefs provide additional control over the mutability and visibility of the contents of the catalogs assigned.
      Parameters:
      isolatedCatalogs - Individual catalogs assigned to this application
      See Also:
    • setInheritanceLines

      public void setInheritanceLines(InheritanceLines inheritanceLines)
      Context list of the contextIds for the deep catalog tree parenting the isolatedCatalogs. These values are generally not included in reported Json, but instead are calculated and leveraged internally during catalog visibility and mutability determinations.
      Parameters:
      Context - list of the contextIds for the deep catalog tree parenting the isolatedCatalogs
    • setMarketplace

      public void setMarketplace(boolean isMarketplace)
      Whether or not the application is a marketplace application. Marketplace applications leverage MarketplaceApplicationCatalog relationships to catalogs, in addition to the explicit relationships declared in getIsolatedCatalogs().

      Generally, all relationships to vendor catalogs should be defined exclusively with MarketplaceApplicationCatalog, and any additional relationships to non-vendor catalogs would be in getIsolatedCatalogs().

      Parameters:
      isMarketplace - Whether or not the application is a marketplace
    • setContextState

      public void setContextState(ContextState contextState)
      A subset of Tracking information to expose the context state for this object.
      Specified by:
      setContextState in interface ContextStateAware
      Parameters:
      contextState - a subset of Tracking information to expose the context state for this object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object