public class

JiraLicenseServiceImpl

extends Object
implements JiraLicenseUpdaterService
java.lang.Object
   ↳ com.atlassian.jira.bc.license.JiraLicenseServiceImpl

Class Overview

The implementation of JiraLicenseService

Summary

Public Constructors
JiraLicenseServiceImpl(JiraLicenseManager licenseManager, ClusterManager clusterManager, ApplicationManager applicationManager, UserManager userManager, HelpUrls helpUrls)
Public Methods
@Nonnull Iterable<LicenseDetails> getLicenses()
Retrieve a list of all products licenses installed in this instance.
String getServerId()
Gets the server ID of the JIRA instance, creates it if it doesn't already exists.
SortedSet<String> getSupportEntitlementNumbers()
Retrieves the SEN (Support Entitlement Number) of all installed licenses and orders them in a consistent manner.
boolean isLicenseSet()
Returns true if at least one license has been set.
void removeLicenses(Iterable<? extends LicenseDetails> licensesToRemove)
Removes provided licenses.
LicenseDetails setLicense(JiraLicenseService.ValidationResult validationResult)
Sets the license from the given ValidationResult as the current JIRA license.
LicenseDetails setLicenseNoEvent(JiraLicenseService.ValidationResult validationResult)
Sets the license from the given ValidationResult as the current JIRA license.
@Nonnull Iterable<JiraLicenseService.ValidationResult> validate(I18nHelper i18nHelper)
Checks that all existing licenses are valid.
JiraLicenseService.ValidationResult validate(I18nHelper i18nHelper, String licenseString)
Performs minimum validation on the license.
Iterable<JiraLicenseService.ValidationResult> validate(I18nHelper i18n, Iterable<String> licenses)
Validates each license String provided in preparation for setting them.
JiraLicenseService.ValidationResult validate(ApplicationKey applicationKey, String licenseString, I18nHelper i18nHelper)
Validates a JIRA application license string in preparation for setting that string as the license for the specified application.
JiraLicenseService.ValidationResult validateApplicationLicense(I18nHelper i18nHelper, String licenseString)
Validates the passed license string against all installed JIRA applications in preparation for setting a new JIRA application license.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.bc.license.JiraLicenseService
From interface com.atlassian.jira.bc.license.JiraLicenseUpdaterService

Public Constructors

public JiraLicenseServiceImpl (JiraLicenseManager licenseManager, ClusterManager clusterManager, ApplicationManager applicationManager, UserManager userManager, HelpUrls helpUrls)

Public Methods

@Nonnull public Iterable<LicenseDetails> getLicenses ()

Retrieve a list of all products licenses installed in this instance.

In JIRA 6.3 this method returns an iterable containing at most one license. In later versions it may contain more.

Returns
  • all product licenses installed in this instance.

public String getServerId ()

Gets the server ID of the JIRA instance, creates it if it doesn't already exists.

Returns
  • the server ID for this JIRA instance.

public SortedSet<String> getSupportEntitlementNumbers ()

Retrieves the SEN (Support Entitlement Number) of all installed licenses and orders them in a consistent manner. The order is guaranteed for a given set of licenses. It may change when licenses are added or removed. Clients that used to use a single SEN can easily retrieve the first item. That will suffice in most cases, though ensure to consider the consequences of when the licenses changes.

Returns
  • of the SEN. The ordere of SENs in the set will be maintained as far as the consistency of the licenses installed doesn't change.

public boolean isLicenseSet ()

Returns true if at least one license has been set.

public void removeLicenses (Iterable<? extends LicenseDetails> licensesToRemove)

Removes provided licenses. If any of the provided licenses do not exist they will be ignored.

Parameters
licensesToRemove the licenses that are going to be removed.

public LicenseDetails setLicense (JiraLicenseService.ValidationResult validationResult)

Sets the license from the given ValidationResult as the current JIRA license. The validation result must have no errors.

Parameters
validationResult the validation result to get the license from.
Returns
  • the new LicenseDetails created from the validated license.

public LicenseDetails setLicenseNoEvent (JiraLicenseService.ValidationResult validationResult)

Sets the license from the given ValidationResult as the current JIRA license. The validation result must have no errors.

Note that this is a special method specifically for resetting a license during Data Import which is why it will specifically not fire an Event.

Parameters
validationResult the validation result to get the license from.
Returns
  • the new LicenseDetails created from the validated license.

@Nonnull public Iterable<JiraLicenseService.ValidationResult> validate (I18nHelper i18nHelper)

Checks that all existing licenses are valid.

Returns
  • an ErrorCollection containing 0-many license validation error messages.

public JiraLicenseService.ValidationResult validate (I18nHelper i18nHelper, String licenseString)

Performs minimum validation on the license. But won't check if the license gives you access to applications. Populates the ValidationResult with errors while validating.

Parameters
i18nHelper the helper for i18n
licenseString the license to validate
Returns
  • a validation result with the validated license and potential errors.

public Iterable<JiraLicenseService.ValidationResult> validate (I18nHelper i18n, Iterable<String> licenses)

Validates each license String provided in preparation for setting them. Populates the resulting ValidationResults with errors while validating.

Parameters
i18n the helper for i18n - used to populate the error messages
licenses the licenses to validate
Returns
  • all the validation results for the validated licenses including errors

public JiraLicenseService.ValidationResult validate (ApplicationKey applicationKey, String licenseString, I18nHelper i18nHelper)

Validates a JIRA application license string in preparation for setting that string as the license for the specified application. This validation does not include checking if the license provides access to the given application, and populates the returned ValidationResult with any errors.

Parameters
applicationKey the application key this license is for
licenseString the license to validate
i18nHelper the helper for i18n
Returns
  • a validation result with the validated license and potential errors.

public JiraLicenseService.ValidationResult validateApplicationLicense (I18nHelper i18nHelper, String licenseString)

Validates the passed license string against all installed JIRA applications in preparation for setting a new JIRA application license. That is, will the new license cause loss of access to any of the applications under the conditions of the current license. The returned ValidationResult will contain any errors found in the process.

It is recommended that validate(com.atlassian.application.api.ApplicationKey, java.lang.String, com.atlassian.jira.util.I18nHelper) is used instead of this method.

Parameters
i18nHelper i18n helper used for messaging.
licenseString the license to validate
Returns
  • a validation result with the validated license and potential errors.