com.atlassian.jira.license
Class DefaultLicenseDetails

java.lang.Object
  extended by com.atlassian.jira.license.DefaultLicenseDetails
All Implemented Interfaces:
LicenseDetails
Direct Known Subclasses:
SubscriptionLicenseDetails

public class DefaultLicenseDetails
extends Object
implements LicenseDetails

Default implementation of the LicenseDetails interface.

Since:
v3.13

Nested Class Summary
 class DefaultLicenseDetails.Link
          Utility class for HTML anchor tags
 
Nested classes/interfaces inherited from interface com.atlassian.jira.license.LicenseDetails
LicenseDetails.LicenseContact, LicenseDetails.LicenseStatusMessage
 
Method Summary
 String getBriefMaintenanceStatusMessage(I18nHelper i18n)
          Return the single word description of the maintenance status of the license.
 Collection<LicenseDetails.LicenseContact> getContacts()
          Gets the contact people for the license (e.g.
 int getDaysToLicenseExpiry()
          Returns the number of days until the license expires (i.e.
 int getDaysToMaintenanceExpiry()
          Returns the number of days until the license maintenance expires (i.e.
 String getDescription()
           
 com.atlassian.extras.api.jira.JiraLicense getJiraLicense()
          Retrieve the JiraLicense object corresponding to this license.
 String getLicenseExpiryStatusMessage(I18nHelper i18n, OutlookDate outlookDate)
          Return the HTML message that briefly describes the expiry status of the license.
 String getLicenseExpiryStatusMessage(com.atlassian.crowd.embedded.api.User user)
          Return the HTML message that briefly describes the expiry status of the license.
 LicenseRoleDetails getLicenseRoles()
          Returns the license role information contained within this license.
 LicenseDetails.LicenseStatusMessage getLicenseStatusMessage(I18nHelper i18n)
          Return the all messages which contain status message.
 String getLicenseStatusMessage(I18nHelper i18n, OutlookDate ignored, String delimiter)
          Return the HTML message that describes the current status of the license.
 String getLicenseStatusMessage(com.atlassian.crowd.embedded.api.User user, String delimiter)
          Return the HTML message that describes the current status of the license.
 String getLicenseString()
           
 int getLicenseVersion()
          Gets the version of the current license, 0 if not set.
 String getMaintenanceEndString(OutlookDate outlookDate)
          Return the date string representing the end of maintenance of the license, whether the license is Evaluation, New Build Old License or otherwise.
 int getMaximumNumberOfUsers()
          Gets the maximum number of users allowed by the current license
 String getOrganisation()
          Gets the organisation this license belongs to
 String getPartnerName()
           
 String getPurchaseDate(OutlookDate outlookDate)
          Gets a nicely formatted purchase date for the current license
 String getSupportEntitlementNumber()
          Gets the SEN from the license
 String getSupportRequestMessage(I18nHelper i18n, OutlookDate ignored)
          Return the HTML message for support request denial or send e-mail success page.
 String getSupportRequestMessage(com.atlassian.crowd.embedded.api.User user)
          Return the HTML message for support request denial or send e-mail success page.
 boolean hasLicenseTooOldForBuildConfirmationBeenDone()
          Tells whether the admin has acknowledged that the JIRA instance is running on a too old license for its build number.
 boolean isCommercial()
          Tells whether this is a commercial license or not
 boolean isCommunity()
          Tells whether this is a community license or not
 boolean isDataCenter()
          Returns true if this is a DataCenter license.
 boolean isDemonstration()
          Tells whether this is a demonstration license or not
 boolean isDeveloper()
          Tells whether this is a developer license or not
 boolean isEnterpriseLicenseAgreement()
          Indicates whether this licence is a subscription-based Enterprise License Agreement (ELA).
 boolean isEntitledToSupport()
           
 boolean isEvaluation()
          Tells whether this is an evaluation license or not
 boolean isExpired()
          Checks whether the license is either expired for Evaluation or Extended Licenses (New Build, Old License).
 boolean isLicenseAlmostExpired()
          If the license is Evaluation or Extended (New Build, Old License), returns true if we are within 7 days of the expiry date.
 boolean isLicenseSet()
          Tells whether a license has been set or not for this JIRA instance.
 boolean isMaintenanceValidForBuildDate(Date currentBuildDate)
          Tells whether the current build date is within the maintenance of the license
 boolean isNonProfit()
          Tells whether this is a non profit license or not
 boolean isOnDemand()
          Tells whether this is an OnDemand license or not
 boolean isOpenSource()
          Tells whether this is an open source license or not
 boolean isPersonalLicense()
          Tells whether this is a personal license or not
 boolean isStarter()
          Tells wheter this is a starter license or not
 boolean isUnlimitedNumberOfUsers()
          Tells whether the current license authorise an unlimited number of users.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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.

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.

isLicenseAlmostExpired

public boolean isLicenseAlmostExpired()
If the license is Evaluation or Extended (New Build, Old License), returns true if we are within 7 days of the expiry date.

Specified by:
isLicenseAlmostExpired in interface LicenseDetails
Returns:
true if the license is close to expiry; false otherwise.
See Also:
#isExpired()}

isExpired

public boolean isExpired()
Checks whether the license is either expired for Evaluation or Extended Licenses (New Build, Old License).

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.

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 wheter this is a starter license or not

Specified by:
isStarter in interface LicenseDetails
Returns:
true if this is a starter license, 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.

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.

getJiraLicense

public com.atlassian.extras.api.jira.JiraLicense getJiraLicense()
Description copied from interface: LicenseDetails
Retrieve the JiraLicense object corresponding to this license. This will be useful to cross-product code that wants to deal with licenses from different products consistently using the ProductLicense interface (which JiraLicense extends).

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

getLicenseRoles

public LicenseRoleDetails getLicenseRoles()
Description copied from interface: LicenseDetails
Returns the license role information contained within this license.

Specified by:
getLicenseRoles in interface LicenseDetails

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

hasLicenseTooOldForBuildConfirmationBeenDone

public boolean hasLicenseTooOldForBuildConfirmationBeenDone()
Description copied from interface: LicenseDetails
Tells whether the admin has acknowledged that the JIRA instance is running on a too old license for its build number. Typically JIRA allows for a 30 days grace period when doing so.

Specified by:
hasLicenseTooOldForBuildConfirmationBeenDone in interface LicenseDetails
Returns:
true if the license in use is too old with regards to the build number, false otherwise.

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

public Collection<LicenseDetails.LicenseContact> 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 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)

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 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).

getSupportRequestMessage

public String getSupportRequestMessage(com.atlassian.crowd.embedded.api.User user)
Description copied from interface: LicenseDetails
Return the HTML message for support request denial or send e-mail success page.

Specified by:
getSupportRequestMessage in interface LicenseDetails
Parameters:
user - a User object for the calling user
Returns:
the support request message

getSupportRequestMessage

public String getSupportRequestMessage(I18nHelper i18n,
                                       @Nullable
                                       OutlookDate ignored)
Description copied from interface: LicenseDetails
Return the HTML message for support request denial or send e-mail success page.

Specified by:
getSupportRequestMessage in interface LicenseDetails
Parameters:
i18n - i18n bean
ignored - ignored
Returns:
the support request message

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.
See Also:
LicenseDetails.getMaximumNumberOfUsers()

getMaximumNumberOfUsers

public int getMaximumNumberOfUsers()
Description copied from interface: LicenseDetails
Gets the maximum number of users allowed by the current license

Specified by:
getMaximumNumberOfUsers in interface LicenseDetails
Returns:
the maximum number of user allowed by the license, -1 if unlimited
See Also:
LicenseDetails.isUnlimitedNumberOfUsers()

isLicenseSet

public boolean isLicenseSet()
Description copied from interface: LicenseDetails
Tells whether a license has been set or not for this JIRA instance.

Specified by:
isLicenseSet in interface LicenseDetails
Returns:
true if a license has been set, false otherwise.

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.

getDescription

public String getDescription()
Specified by:
getDescription in interface LicenseDetails
Returns:
the description of the current license

getPartnerName

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

getLicenseExpiryStatusMessage

public String getLicenseExpiryStatusMessage(@Nullable
                                            com.atlassian.crowd.embedded.api.User 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 outlookDate)
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
outlookDate - 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"

getLicenseStatusMessage

public String getLicenseStatusMessage(@Nullable
                                      com.atlassian.crowd.embedded.api.User user,
                                      String delimiter)
Description copied from interface: LicenseDetails
Return the HTML message that describes the current status of the license.

Specified by:
getLicenseStatusMessage in interface LicenseDetails
Parameters:
user - the user for whom the message should be i18n'ed
delimiter - the line delimiter for the message
Returns:
the status message

getLicenseStatusMessage

public String getLicenseStatusMessage(I18nHelper i18n,
                                      @Nullable
                                      OutlookDate ignored,
                                      String delimiter)
Description copied from interface: LicenseDetails
Return the HTML message that describes the current status of the license.

Specified by:
getLicenseStatusMessage in interface LicenseDetails
Parameters:
i18n - i18n bean
ignored - ignored
delimiter - the line delimiter for the message
Returns:
the status message

getLicenseStatusMessage

public LicenseDetails.LicenseStatusMessage getLicenseStatusMessage(I18nHelper i18n)
Description copied from interface: LicenseDetails
Return the all messages which contain status message.

Specified by:
getLicenseStatusMessage in interface LicenseDetails
Parameters:
i18n - i18n bean
Returns:
the status message


Copyright © 2002-2014 Atlassian. All Rights Reserved.