@PublicApi public interface

JiraLicenseService

com.atlassian.jira.bc.license.JiraLicenseService
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

A service for get license information. (readonly)

Summary

Nested Classes
interface JiraLicenseService.ValidationResult Holds the validated license and potential errors  
Public Methods
@ExperimentalApi @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.
@Nonnull Iterable<JiraLicenseService.ValidationResult> validate(I18nHelper i18n)
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)

Public Methods

@ExperimentalApi @Nonnull public Iterable<LicenseDetails> getLicenses ()

@ExperimentalApi

This method is considered usable by external developers but its contracts have not stabilized.

Experimental APIs may be changed at any time before being marked @Internal or @PublicApi.

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.

See Also

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

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.
See Also
  • {@link JiraLicenseService#validate(com.atlassian.application.api.ApplicationKey, String, com.atlassian.jira.util.I18nHelper)}.

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)

This method is deprecated.
use validate(com.atlassian.application.api.ApplicationKey, java.lang.String, com.atlassian.jira.util.I18nHelper)

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.