Package com.atlassian.jira.bc.license
Class JiraLicenseServiceImpl
java.lang.Object
com.atlassian.jira.bc.license.JiraLicenseServiceImpl
- All Implemented Interfaces:
JiraLicenseService
,JiraLicenseUpdaterService
The implementation of JiraLicenseService
- Since:
- v4.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.jira.bc.license.JiraLicenseService
JiraLicenseService.ValidationResult
-
Constructor Summary
ConstructorsConstructorDescriptionJiraLicenseServiceImpl
(JiraLicenseManager licenseManager, ClusterManager clusterManager, com.atlassian.application.api.ApplicationManager applicationManager, UserManager userManager, HelpUrls helpUrls) -
Method Summary
Modifier and TypeMethodDescriptiongetLicenseDetails
(String licenseString, I18nHelper i18nHelper) Retrieve a list of all products licenses installed in this instance.Returns the server ID of this JIRA instance, creating it if necessary.Retrieves the SEN (Support Entitlement Number) of all installed licenses and orders them in a consistent manner.boolean
Returns whether or not Jira is licensed for DataCenter.boolean
Returns true if at least one license has beenset
.void
removeLicenses
(Iterable<? extends LicenseDetails> licensesToRemove) Removes provided licenses.setLicense
(JiraLicenseService.ValidationResult validationResult) Sets the license from the given ValidationResult as the current JIRA license.setLicenseNoEvent
(JiraLicenseService.ValidationResult validationResult) Sets the license from the given ValidationResult as the current JIRA license.validate
(com.atlassian.application.api.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.validate
(I18nHelper i18nHelper) Checks that allexisting licenses
arevalid
.validate
(I18nHelper i18n, Iterable<String> licenses) Validates each license String provided in preparation for setting them.validate
(I18nHelper i18nHelper, String licenseString) Performs minimum validation on the license.validateApplicationLicense
(I18nHelper i18nHelper, String licenseString) Deprecated.validateMultiLicenses
(Collection<LicenseValidationInformation> licenseValidationInformations, I18nHelper i18nHelper) Validates a JIRA application multiple license string in preparation for setting that string as the license for the specified application.
-
Constructor Details
-
JiraLicenseServiceImpl
public JiraLicenseServiceImpl(@Nonnull JiraLicenseManager licenseManager, @Nonnull ClusterManager clusterManager, @Nonnull com.atlassian.application.api.ApplicationManager applicationManager, @Nonnull UserManager userManager, @Nonnull HelpUrls helpUrls)
-
-
Method Details
-
getServerId
Description copied from interface:JiraLicenseService
Returns the server ID of this JIRA instance, creating it if necessary.- Specified by:
getServerId
in interfaceJiraLicenseService
- Returns:
- see above
-
validate
public JiraLicenseService.ValidationResult validate(@Nonnull I18nHelper i18nHelper, @Nonnull String licenseString) Description copied from interface:JiraLicenseService
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.- Specified by:
validate
in interfaceJiraLicenseService
- Parameters:
i18nHelper
- the helper for i18nlicenseString
- the license to validate- Returns:
- a validation result with the validated license and potential errors.
-
validate
public JiraLicenseService.ValidationResult validate(@Nonnull com.atlassian.application.api.ApplicationKey applicationKey, @Nonnull String licenseString, @Nonnull I18nHelper i18nHelper) Description copied from interface:JiraLicenseService
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.- Specified by:
validate
in interfaceJiraLicenseService
- Parameters:
applicationKey
- the application key this license is forlicenseString
- the license to validatei18nHelper
- the helper for i18n- Returns:
- a validation result with the validated license and potential errors.
-
validateMultiLicenses
public Collection<LicenseValidationInformation> validateMultiLicenses(@Nonnull Collection<LicenseValidationInformation> licenseValidationInformations, @Nonnull I18nHelper i18nHelper) Description copied from interface:JiraLicenseService
Validates a JIRA application multiple license string in preparation for setting that string as the license for the specified application. This validation does not include checking if the licenses provides access to the given applications, and populates the returned LicenseValidationInformation with any errors- Specified by:
validateMultiLicenses
in interfaceJiraLicenseService
- Parameters:
licenseValidationInformations
- the license validation information of the licenses that will get validatedi18nHelper
- the helper for i18n- Returns:
-
getLicenseDetails
public Optional<LicenseDetails> getLicenseDetails(@Nullable String licenseString, @Nonnull I18nHelper i18nHelper) - Specified by:
getLicenseDetails
in interfaceJiraLicenseService
- Parameters:
licenseString
- the license to validatei18nHelper
- the helper for i18n- Returns:
-
validateApplicationLicense
@Deprecated public JiraLicenseService.ValidationResult validateApplicationLicense(@Nonnull I18nHelper i18nHelper, @Nonnull String licenseString) Deprecated.Description copied from interface:JiraLicenseService
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
JiraLicenseService.validate(com.atlassian.application.api.ApplicationKey, java.lang.String, com.atlassian.jira.util.I18nHelper)
is used instead of this method.- Specified by:
validateApplicationLicense
in interfaceJiraLicenseService
- Parameters:
i18nHelper
- i18n helper used for messaging.licenseString
- the license to validate- Returns:
- a validation result with the validated license and potential errors.
-
getSupportEntitlementNumbers
Description copied from interface:JiraLicenseService
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.- Specified by:
getSupportEntitlementNumbers
in interfaceJiraLicenseService
- 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.
- See Also:
-
validate
Description copied from interface:JiraLicenseService
Checks that allexisting licenses
arevalid
.- Specified by:
validate
in interfaceJiraLicenseService
- Returns:
- an ErrorCollection containing 0-many license validation error messages.
-
validate
public Iterable<JiraLicenseService.ValidationResult> validate(I18nHelper i18n, Iterable<String> licenses) Description copied from interface:JiraLicenseService
Validates each license String provided in preparation for setting them. Populates the resulting ValidationResults with errors while validating.- Specified by:
validate
in interfaceJiraLicenseService
- Parameters:
i18n
- the helper for i18n - used to populate the error messageslicenses
- the licenses to validate- Returns:
- all the validation results for the validated licenses including errors
-
isLicenseSet
public boolean isLicenseSet()Description copied from interface:JiraLicenseService
Returns true if at least one license has beenset
.- Specified by:
isLicenseSet
in interfaceJiraLicenseService
- See Also:
-
isDataCenterLicensed
public boolean isDataCenterLicensed()Description copied from interface:JiraLicenseService
Returns whether or not Jira is licensed for DataCenter.- Specified by:
isDataCenterLicensed
in interfaceJiraLicenseService
- Returns:
- whether or not Jira is licensed for DataCenter.
-
setLicense
Description copied from interface:JiraLicenseUpdaterService
Sets the license from the given ValidationResult as the current JIRA license. The validation result must have no errors.- Specified by:
setLicense
in interfaceJiraLicenseUpdaterService
- Parameters:
validationResult
- the validation result to get the license from.- Returns:
- the new LicenseDetails created from the validated license.
-
setLicenseNoEvent
Description copied from interface:JiraLicenseUpdaterService
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.
- Specified by:
setLicenseNoEvent
in interfaceJiraLicenseUpdaterService
- Parameters:
validationResult
- the validation result to get the license from.- Returns:
- the new LicenseDetails created from the validated license.
-
removeLicenses
Description copied from interface:JiraLicenseUpdaterService
Removes provided licenses. If any of the provided licenses do not exist they will be ignored.- Specified by:
removeLicenses
in interfaceJiraLicenseUpdaterService
- Parameters:
licensesToRemove
- the licenses that are going to be removed.
-
getLicenses
Description copied from interface:JiraLicenseService
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.
- Specified by:
getLicenses
in interfaceJiraLicenseService
- Returns:
- all product licenses installed in this instance.
-
validate(com.atlassian.application.api.ApplicationKey, java.lang.String, com.atlassian.jira.util.I18nHelper)