Class DefaultLicensedApplications

java.lang.Object
com.atlassian.jira.license.DefaultLicensedApplications
All Implemented Interfaces:
LicensedApplications

public final class DefaultLicensedApplications extends Object implements LicensedApplications
Default implementation of LicensedApplications.

This implementation fails fast (in the constructor) on detection of invalid license or license application/role details.

Since:
v7.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    String that identifies a license key as being part of an application, as distinct from an addon.
    static final String
    String that prefixes a license key as being a JIRA role-based application (product), typically "jira.product.".
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultLicensedApplications(String license, com.atlassian.extras.decoder.api.LicenseDecoder licenseDecoder)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static final String
    getApplicationLicensePropertyName(com.atlassian.application.api.ApplicationKey app, String property)
    Returns a fully-qualified license property name for the given application and license property.
    Returns a user-friendly string version of the Applications encoded in the source license, or the empty string if there are no Applications in the source license.
    Set<com.atlassian.application.api.ApplicationKey>
    Returns the ApplicationKeys encoded in the source license.
    int
    getUserLimit(com.atlassian.application.api.ApplicationKey key)
    Returns the number of seats for the given ApplicationKey.
    boolean
    Indicates whether the license key has been issued as an JIRA Application license ( role based license ) or whether we have interpreted it as an JIRA Application license.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • APPLICATION_NAMESPACE

      public static final String APPLICATION_NAMESPACE
      String that identifies a license key as being part of an application, as distinct from an addon.
      See Also:
    • JIRA_PRODUCT_NAMESPACE

      public static final String JIRA_PRODUCT_NAMESPACE
      String that prefixes a license key as being a JIRA role-based application (product), typically "jira.product.".
  • Constructor Details

    • DefaultLicensedApplications

      public DefaultLicensedApplications(@Nonnull String license, @Nonnull com.atlassian.extras.decoder.api.LicenseDecoder licenseDecoder) throws com.atlassian.extras.api.LicenseException
      Parameters:
      license - An encoded license string.
      licenseDecoder - A license decoder capable of decoding the given license.
      Throws:
      com.atlassian.extras.api.LicenseException - on detection of invalid applications or application user counts.
  • Method Details

    • getKeys

      @Nonnull public Set<com.atlassian.application.api.ApplicationKey> getKeys()
      Returns the ApplicationKeys encoded in the source license. This may return an empty set, but never returns null.

      Note: This implementation returns an unmodifiable Set.

      Specified by:
      getKeys in interface LicensedApplications
    • getUserLimit

      public int getUserLimit(@Nonnull com.atlassian.application.api.ApplicationKey key)
      Description copied from interface: LicensedApplications
      Returns the number of seats for the given ApplicationKey. It will return:
      1. 0 if the passed ApplicationKey is not licensed.
      2. LicensePropertiesConstants.UNLIMITED_USERS if the passed ApplicationKey has no limit.
      3. positive number when the passed ApplicationKey has that exact limit.
      Specified by:
      getUserLimit in interface LicensedApplications
      Returns:
      the number of users/seats for the given ApplicationKey, 0, or LicensePropertiesConstants.UNLIMITED_USERS.
    • getDescription

      @Nonnull public String getDescription()
      Description copied from interface: LicensedApplications
      Returns a user-friendly string version of the Applications encoded in the source license, or the empty string if there are no Applications in the source license.
      Specified by:
      getDescription in interface LicensedApplications
    • getApplicationLicensePropertyName

      @Nonnull public static final String getApplicationLicensePropertyName(@Nonnull com.atlassian.application.api.ApplicationKey app, @Nonnull String property)
      Returns a fully-qualified license property name for the given application and license property. Currently, the returned string is of form "jira.product.[application-key].[property]".
      Parameters:
      app - application identifier (key)
      property - a license property
      Returns:
      a fully-qualified license property
      See Also:
    • hasNativeRole

      public boolean hasNativeRole()
      Description copied from interface: LicensedApplications
      Indicates whether the license key has been issued as an JIRA Application license ( role based license ) or whether we have interpreted it as an JIRA Application license.
      Specified by:
      hasNativeRole in interface LicensedApplications
      Returns:
      true if license key was issued as an JIRA Application license ( role based license ), false if we have interpreted license as JIRA Application license or when no interpretation occurred.