Class MockLicenseDetails

java.lang.Object
com.atlassian.jira.license.MockLicenseDetails
All Implemented Interfaces:
LicenseDetails

public class MockLicenseDetails extends Object implements LicenseDetails
Since:
v6.2.3
  • Constructor Details

    • MockLicenseDetails

      public MockLicenseDetails()
  • Method Details

    • getLicenseVersion

      public int getLicenseVersion()
      Description copied from interface: LicenseDetails
      Gets the version of the current license, 0 if not set. This is the version of encoder/decoder that was used with this license.
      Specified by:
      getLicenseVersion in interface LicenseDetails
      Returns:
      the version of the current license, 0 if not set.
    • isEntitledToSupport

      public boolean isEntitledToSupport()
      Specified by:
      isEntitledToSupport in interface LicenseDetails
      Returns:
      true for licenses that are entitled to support and updates of JIRA. This includes everything which is not a Personal License or Non-Commercial-Non-Renewable.
    • getJiraLicense

      public com.atlassian.extras.api.jira.JiraLicense getJiraLicense()
      Description copied from interface: LicenseDetails
      Retrieve the JiraLicense object corresponding to this license.

      Jira 7.0 introduced a new licensing model where a license can contain multiple applications. This method will return the JiraLicense object and has no knowledge of the applications contained within the license.

      To find the user limit for a specific application, use LicenseDetails.getLicensedApplications() and LicensedApplications.getUserLimit(ApplicationKey).

      The values returned by ProductLicense.getMaximumNumberOfUsers() and ProductLicense.isUnlimitedNumberOfUsers() should not be used.

      Specified by:
      getJiraLicense in interface LicenseDetails
      Returns:
      the JiraLicense object corresponding to this license
    • getLicensedApplications

      @Nonnull public LicensedApplications getLicensedApplications()
      Description copied from interface: LicenseDetails
      Returns all the application/role information contained within this license, even if they are non active.
      Specified by:
      getLicensedApplications in interface LicenseDetails
      Returns:
      the application/role information contained within this license.
    • hasApplication

      public boolean hasApplication(@Nonnull com.atlassian.application.api.ApplicationKey application)
      Description copied from interface: LicenseDetails
      Returns true if the given application is contained within this license.
      Specified by:
      hasApplication in interface LicenseDetails
      Parameters:
      application - the application to query
      Returns:
      true if the application is found in this license
    • setLicensedApplications

      public MockLicenseDetails setLicensedApplications(LicensedApplications licensedApplications)
    • getLicenseStatusMessage

      public LicenseDetails.LicenseStatusMessage getLicenseStatusMessage(I18nHelper i18n, UserManager userManager)
      Description copied from interface: LicenseDetails
      Return the all messages which contain status message.
      Specified by:
      getLicenseStatusMessage in interface LicenseDetails
      Parameters:
      i18n - i18n bean
      userManager - used to get user context if necessary
      Returns:
      the status message
    • getMaintenanceMessage

      public LicenseDetails.LicenseStatusMessage getMaintenanceMessage(@Nonnull I18nHelper i18n, String applicationName)
      Description copied from interface: LicenseDetails
      Get the maintenance message for this license, this does not evaluate the maintenance date, it only provides the message that should be displayed when license out of maintenance for a given JIRA Application. For subscription license no message would be returned LicenseDetails.LicenseStatusMessage.hasAnyMessages() would return false.
      Specified by:
      getMaintenanceMessage in interface LicenseDetails
      Parameters:
      i18n - i18n helper
      applicationName - JIRA Application name (trademark for display)
      Returns:
      the status message, subscription license would return no messages.
    • getLicenseExpiryStatusMessage

      public String getLicenseExpiryStatusMessage(@Nullable ApplicationUser user)
      Description copied from interface: LicenseDetails
      Return the HTML message that briefly describes the expiry status of the license. Intended for use with the Admin Portlet.
      Specified by:
      getLicenseExpiryStatusMessage in interface LicenseDetails
      Parameters:
      user - the user for whom the message should be i18n'ed
      Returns:
      the status message, null for normal license outside of support period
    • getLicenseExpiryStatusMessage

      public String getLicenseExpiryStatusMessage(I18nHelper i18n, @Nullable OutlookDate ignored)
      Description copied from interface: LicenseDetails
      Return the HTML message that briefly describes the expiry status of the license. Intended for use with the Admin Portlet.
      Specified by:
      getLicenseExpiryStatusMessage in interface LicenseDetails
      Parameters:
      i18n - i18n bean
      ignored - outlookDate bean
      Returns:
      the status message, null for normal license outside of support period
    • getBriefMaintenanceStatusMessage

      public String getBriefMaintenanceStatusMessage(I18nHelper i18n)
      Description copied from interface: LicenseDetails
      Return the single word description of the maintenance status of the license. Intended for use with the Support Request and System Info pages.
      Specified by:
      getBriefMaintenanceStatusMessage in interface LicenseDetails
      Parameters:
      i18n - i18n bean
      Returns:
      the status message - either "Supported", "Expired" or "Unsupported"
    • getMaintenanceExpiryDate

      @Nullable public Date getMaintenanceExpiryDate()
      Description copied from interface: LicenseDetails
      Returns the maintenance expiry Date of this license, or null if the maintenance period of this license is unlimited.
      Specified by:
      getMaintenanceExpiryDate in interface LicenseDetails
      Returns:
      the maintenance expiry Date of this license, or null if the maintenance period of this license is unlimited.
    • getMaintenanceEndString

      public String getMaintenanceEndString(OutlookDate outlookDate)
      Description copied from interface: LicenseDetails
      Return the date string representing the end of maintenance of the license, whether the license is Evaluation, New Build Old License or otherwise.

      Note that the return type here is a String to intentionally signify that this value should not be used in any logic calculations and only for displaying to the user.

      Specified by:
      getMaintenanceEndString in interface LicenseDetails
      Parameters:
      outlookDate - outlookDate bean
      Returns:
      the date as a string (should never be null)
    • isUnlimitedNumberOfUsers

      public boolean isUnlimitedNumberOfUsers()
      Description copied from interface: LicenseDetails
      Tells whether the current license authorise an unlimited number of users.
      Specified by:
      isUnlimitedNumberOfUsers in interface LicenseDetails
      Returns:
      true if the license authorise an unlimited number of users, false otherwise.
    • getDescription

      public String getDescription()
      Description copied from interface: LicenseDetails
      Returns the literal description of the current license as given in the license itself.
      Specified by:
      getDescription in interface LicenseDetails
      Returns:
      the literal description of the current license as given in the license itself.
    • getPartnerName

      public String getPartnerName()
      Specified by:
      getPartnerName in interface LicenseDetails
      Returns:
      the Partner name inside the current license or null if its not set
    • isExpired

      public boolean isExpired()
      Description copied from interface: LicenseDetails
      Checks whether the license is either expired or the grace period for an extended license (after upgrade) is over.
      Specified by:
      isExpired in interface LicenseDetails
      Returns:
      true if has, false otherwise.
    • getPurchaseDate

      public String getPurchaseDate(OutlookDate outlookDate)
      Description copied from interface: LicenseDetails
      Gets a nicely formatted purchase date for the current license
      Specified by:
      getPurchaseDate in interface LicenseDetails
      Parameters:
      outlookDate - the date formatter
      Returns:
      a formatted purchased date.
    • setEvaluation

      public MockLicenseDetails setEvaluation(boolean eval)
    • isEvaluation

      public boolean isEvaluation()
      Description copied from interface: LicenseDetails
      Tells whether this is an evaluation license or not
      Specified by:
      isEvaluation in interface LicenseDetails
      Returns:
      true if this is an evaluation license, false otherwise.
    • isStarter

      public boolean isStarter()
      Description copied from interface: LicenseDetails
      Tells whether this is a starter license or not
      Specified by:
      isStarter in interface LicenseDetails
      Returns:
      true if this is a starter license, false otherwise.
    • isPaidType

      public boolean isPaidType()
      Description copied from interface: LicenseDetails
      Checks whether the license type is a paid type. The paid types are ACADEMIC, COMMERCIAL, and STARTER.
      Specified by:
      isPaidType in interface LicenseDetails
      Returns:
      true if the license is a paid type, false otherwise.
    • isCommercial

      public boolean isCommercial()
      Description copied from interface: LicenseDetails
      Tells whether this is a commercial license or not
      Specified by:
      isCommercial in interface LicenseDetails
      Returns:
      true if this is a commercial license, false otherwise.
    • isPersonalLicense

      public boolean isPersonalLicense()
      Description copied from interface: LicenseDetails
      Tells whether this is a personal license or not
      Specified by:
      isPersonalLicense in interface LicenseDetails
      Returns:
      true if this is a personal license, false otherwise.
    • isCommunity

      public boolean isCommunity()
      Description copied from interface: LicenseDetails
      Tells whether this is a community license or not
      Specified by:
      isCommunity in interface LicenseDetails
      Returns:
      true if this is a community license, false otherwise.
    • isOpenSource

      public boolean isOpenSource()
      Description copied from interface: LicenseDetails
      Tells whether this is an open source license or not
      Specified by:
      isOpenSource in interface LicenseDetails
      Returns:
      true if this is an open source license, false otherwise.
    • isNonProfit

      public boolean isNonProfit()
      Description copied from interface: LicenseDetails
      Tells whether this is a non profit license or not
      Specified by:
      isNonProfit in interface LicenseDetails
      Returns:
      true if this is a non profit license, false otherwise.
    • isDemonstration

      public boolean isDemonstration()
      Description copied from interface: LicenseDetails
      Tells whether this is a demonstration license or not
      Specified by:
      isDemonstration in interface LicenseDetails
      Returns:
      true if this is a demonstration license, false otherwise.
    • isOnDemand

      public boolean isOnDemand()
      Description copied from interface: LicenseDetails
      Tells whether this is an OnDemand license or not
      Specified by:
      isOnDemand in interface LicenseDetails
      Returns:
      true if this is a OnDemand, false otherwise.
    • isDataCenter

      public boolean isDataCenter()
      Description copied from interface: LicenseDetails
      Returns true if this is a DataCenter license.
      Specified by:
      isDataCenter in interface LicenseDetails
      Returns:
      true if this is a DataCenter license.
    • isEnterpriseLicenseAgreement

      public boolean isEnterpriseLicenseAgreement()
      Description copied from interface: LicenseDetails
      Indicates whether this licence is a subscription-based Enterprise License Agreement (ELA).
      Specified by:
      isEnterpriseLicenseAgreement in interface LicenseDetails
      Returns:
      true if this licence is a subscription-based Enterprise License Agreement (ELA).
    • isDeveloper

      public boolean isDeveloper()
      Description copied from interface: LicenseDetails
      Tells whether this is a developer license or not
      Specified by:
      isDeveloper in interface LicenseDetails
      Returns:
      true if this is a developer license, false otherwise.
    • setDeveloper

      public MockLicenseDetails setDeveloper(boolean developer)
    • getOrganisation

      public String getOrganisation()
      Description copied from interface: LicenseDetails
      Gets the organisation this license belongs to
      Specified by:
      getOrganisation in interface LicenseDetails
      Returns:
      the organisation this license belongs to
    • getLicenseString

      public String getLicenseString()
      Specified by:
      getLicenseString in interface LicenseDetails
      Returns:
      the encoded license string that was was decode to produce the current license. This will return null if it is not set
    • isMaintenanceValidForBuildDate

      public boolean isMaintenanceValidForBuildDate(Date currentBuildDate)
      Description copied from interface: LicenseDetails
      Tells whether the current build date is within the maintenance of the license
      Specified by:
      isMaintenanceValidForBuildDate in interface LicenseDetails
      Parameters:
      currentBuildDate - the current build date
      Returns:
      true if the build date is within the maintenance period, false otherwise.
    • getSupportEntitlementNumber

      public String getSupportEntitlementNumber()
      Description copied from interface: LicenseDetails
      Gets the SEN from the license
      Specified by:
      getSupportEntitlementNumber in interface LicenseDetails
      Returns:
      the SEN from the license
    • getContacts

      Description copied from interface: LicenseDetails
      Gets the contact people for the license (e.g. Name and Email of whoever first signed up for the OD license)
      Specified by:
      getContacts in interface LicenseDetails
      Returns:
      collection of contact people for the license
    • getDaysToLicenseExpiry

      public int getDaysToLicenseExpiry()
      Description copied from interface: LicenseDetails
      Returns the number of days until the license expires (i.e. JIRA will enter read-only mode).

      • A value of 0 indicates that license will expire today (but is still valid).
      • A negative value indicates the number of days the license is expired.
      • A positive value indicates the number of days the license will be valid for. A value of Integer.MAX_VALUE indicates that the license will never expire.

      A partial day will be rounded down. For example, 1.5 days will be reported as 1 while -0.5 days will be reported as -1 days.

      Specified by:
      getDaysToLicenseExpiry in interface LicenseDetails
      Returns:
      the number of days until the license expires (i.e. JIRA will enter read-only mode)
    • setDaysToLicenseExpiry

      public MockLicenseDetails setDaysToLicenseExpiry(int days)
    • getDaysToMaintenanceExpiry

      public int getDaysToMaintenanceExpiry()
      Description copied from interface: LicenseDetails
      Returns the number of days until the license maintenance expires (i.e. support and upgrades will cease).

      • A value of 0 indicates that license maintenance will expire today (but is still valid).
      • A negative value indicates the number of days the license maintenance is expired.
      • A positive value indicates the number of days the license maintenance will be value for. value of Integer.MAX_VALUE indicates that the license maintenance will never expire.

      A partial day will be rounded down. For example, 1.5 days will be reported as 1 while -0.5 days will be reported as -1 days.

      Specified by:
      getDaysToMaintenanceExpiry in interface LicenseDetails
      Returns:
      the number of days until the license maintenance expires (i.e. support and upgrades will cease).
    • getLicenseType

      public com.atlassian.extras.api.LicenseType getLicenseType()
      Specified by:
      getLicenseType in interface LicenseDetails
    • getApplicationDescription

      @Nonnull public String getApplicationDescription()
      Description copied from interface: LicenseDetails
      Returns a user-friendly String description of the Application(s) granted by this license. This method differs from LicenseDetails.getDescription() in that the returned String is Application-focused and heuristically determined, and does not include license type information, number of seats etc.

      If there are no Applications in the current license, then this method returns the String "JIRA".

      Specified by:
      getApplicationDescription in interface LicenseDetails
    • setBriefDescription

      public MockLicenseDetails setBriefDescription(String description)
    • setDaysToMaintenanceExpiry

      public MockLicenseDetails setDaysToMaintenanceExpiry(int days)
    • setSupportEntitlementNumber

      public MockLicenseDetails setSupportEntitlementNumber(@Nonnull String sen)
    • setMaintenanceDate

      public MockLicenseDetails setMaintenanceDate(Date maintenanceDate)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setLicenseString

      public MockLicenseDetails setLicenseString(String licensString)
    • setLicensedApplications

      public MockLicenseDetails setLicensedApplications(com.atlassian.application.api.ApplicationKey... keys)