public class JiraLicenseManagerImpl extends Object implements JiraLicenseManager, CachingComponent
Constructor and Description |
---|
JiraLicenseManagerImpl(com.atlassian.license.SIDManager sidManager,
com.atlassian.event.api.EventPublisher eventPublisher,
MultiLicenseStore multiLicenseStore,
LicenseDetailsFactory licenseDetailsFactory,
ApplicationProperties applicationProperties,
com.atlassian.cache.CacheManager cacheManager) |
Modifier and Type | Method and Description |
---|---|
void |
clearAndSetLicense(String licenseString)
Removes all licenses from JIRA and replace them with the new license.
|
LicenseDetails |
clearAndSetLicenseNoEvent(String licenseString)
Removes all licenses from JIRA and replace them with the new license without raising an event.
|
void |
clearCache()
Clear the cache within the component.
|
void |
confirmProceedUnderEvaluationTerms(String userName)
Records that the user has acknowledged that one or more of their licenses is out of maintenance.
|
Set<com.atlassian.application.api.ApplicationKey> |
getAllLicensedApplicationKeys()
Retrieve a Set of all installed product license's keys in this instance.
|
io.atlassian.fugue.Option<LicenseDetails> |
getLicense(com.atlassian.application.api.ApplicationKey application)
Return the
LicenseDetails associated with the passed
ApplicationKey . |
LicenseDetails |
getLicense(String licenseString)
Returns the
LicenseDetails corresponding to the given license string after decoding, or throws an
exception if the license string is invalid or cannot be decoded. |
List<LicenseDetails> |
getLicenses()
Retrieve a collection of all product licenses installed in this instance.
|
String |
getServerId()
Returns the server ID of this JIRA instance, creating it if necessary.
|
SortedSet<String> |
getSupportEntitlementNumbers()
Retrieves the SEN (Support Entitlement Number) of all installed licenses and orders them in a consistent manner.
|
boolean |
hasLicenseTooOldForBuildConfirmationBeenDone()
Returns true if the support/maintenance period for this JIRA instance has been exceeded and an instance admin
has acknowledged this fact.
|
boolean |
isDecodeable(String licenseString)
This returns true if the provided licence string can be decoded into a valid licence
|
boolean |
isLicensed(com.atlassian.application.api.ApplicationKey application)
Returns
true if the given application is licensed. |
boolean |
isLicenseSet()
Returns true if at least one license has been
set . |
void |
onCacheClear(ClearCacheEvent clearEvent) |
void |
removeLicense(com.atlassian.application.api.ApplicationKey application)
Removes the license that grants access to the passed application.
|
void |
removeLicenses(Iterable<? extends LicenseDetails> licenses)
Removes passed licenses.
|
LicenseDetails |
setLicense(String licenseString)
Sets the current license of this instance.
|
LicenseDetails |
setLicenseNoEvent(String licenseString)
Sets the current license of this instance.
|
Set<LicenseDetails> |
setLicenses(Collection<String> licenseStrings)
Sets the current licenses of this instance.
|
void |
subscribeToClearCache(java.util.function.Consumer<Void> consumer)
Subscribe a
Consumer to be called after this manager's cache has been cleared. |
void |
unSubscribeFromClearCache(java.util.function.Consumer<Void> consumer)
Un-subscribe a
Consumer from being called after clearing of this manager's cache. |
public JiraLicenseManagerImpl(com.atlassian.license.SIDManager sidManager, com.atlassian.event.api.EventPublisher eventPublisher, MultiLicenseStore multiLicenseStore, LicenseDetailsFactory licenseDetailsFactory, ApplicationProperties applicationProperties, com.atlassian.cache.CacheManager cacheManager)
@Nonnull public String getServerId()
JiraLicenseManager
getServerId
in interface JiraLicenseManager
@Nonnull public LicenseDetails getLicense(@Nonnull String licenseString)
JiraLicenseManager
LicenseDetails
corresponding to the given license string after decoding, or throws an
exception if the license string is invalid or cannot be decoded.getLicense
in interface JiraLicenseManager
licenseString
- the license string.LicenseDetails
for license encoded by the given string.JiraLicenseManager.isDecodeable(String)
,
StringUtils.isBlank(CharSequence)
@Nonnull public List<LicenseDetails> getLicenses()
JiraLicenseManager
In pre-7.0 JIRA this method returns an iterable containing at most one license.
getLicenses
in interface JiraLicenseManager
@Nonnull public Set<com.atlassian.application.api.ApplicationKey> getAllLicensedApplicationKeys()
JiraLicenseManager
getAllLicensedApplicationKeys
in interface JiraLicenseManager
public SortedSet<String> getSupportEntitlementNumbers()
JiraLicenseManager
getSupportEntitlementNumbers
in interface JiraLicenseManager
SortedSet
of the SEN. The order of SENs in the set will be maintained as far as the
set of installed licenses doesn't change.LicenseDetails.getSupportEntitlementNumber()
public io.atlassian.fugue.Option<LicenseDetails> getLicense(@Nonnull com.atlassian.application.api.ApplicationKey application)
JiraLicenseManager
LicenseDetails
associated with the passed
ApplicationKey
.getLicense
in interface JiraLicenseManager
application
- the ApplicationKey
to query.LicenseDetails
associated with the passed application key or
Option.none()
if no such application exists.public boolean isLicensed(@Nonnull com.atlassian.application.api.ApplicationKey application)
JiraLicenseManager
true
if the given application is licensed.isLicensed
in interface JiraLicenseManager
application
- the applicationtrue
if the given application is licensed.public boolean isDecodeable(String licenseString)
JiraLicenseManager
isDecodeable
in interface JiraLicenseManager
licenseString
- the license stringpublic LicenseDetails setLicense(String licenseString)
JiraLicenseManager
Note that this method will fire a LicenseChangedEvent
.
setLicense
in interface JiraLicenseManager
licenseString
- the license stringlicense
is valid.public Set<LicenseDetails> setLicenses(Collection<String> licenseStrings)
JiraLicenseManager
Note that this method will fire a LicenseChangedEvent
.
setLicenses
in interface JiraLicenseManager
licenseStrings
- the list of license string to set.IllegalArgumentException
- if any of is invalid.com.atlassian.extras.api.LicenseException
- if any of was null or could not be decodedpublic LicenseDetails setLicenseNoEvent(String licenseString)
JiraLicenseManager
This is a special version of JiraLicenseManager.setLicense(String)
that will not fire any event and is purely for use
during a Data Import.
setLicenseNoEvent
in interface JiraLicenseManager
licenseString
- the license stringlicense
is valid.public void removeLicense(@Nonnull com.atlassian.application.api.ApplicationKey application)
JiraLicenseManager
removeLicense
in interface JiraLicenseManager
application
- the key of the application to check.public void removeLicenses(@Nonnull Iterable<? extends LicenseDetails> licenses)
JiraLicenseManager
removeLicenses
in interface JiraLicenseManager
licenses
- to be removedpublic boolean isLicenseSet()
JiraLicenseManager
set
.isLicenseSet
in interface JiraLicenseManager
JiraLicenseService.isLicenseSet()
public void clearAndSetLicense(String licenseString)
JiraLicenseManager
IllegalArgumentException
.clearAndSetLicense
in interface JiraLicenseManager
public LicenseDetails clearAndSetLicenseNoEvent(String licenseString)
JiraLicenseManager
IllegalArgumentException
.clearAndSetLicenseNoEvent
in interface JiraLicenseManager
@EventListener public void onCacheClear(ClearCacheEvent clearEvent)
public void confirmProceedUnderEvaluationTerms(String userName)
JiraLicenseManager
confirmProceedUnderEvaluationTerms
in interface JiraLicenseManager
userName
- the name of the user that made the confirmation.JiraLicenseManager.hasLicenseTooOldForBuildConfirmationBeenDone()
public boolean hasLicenseTooOldForBuildConfirmationBeenDone()
JiraLicenseManager
hasLicenseTooOldForBuildConfirmationBeenDone
in interface JiraLicenseManager
true
if the licenses in use are too old for the current build number and this instance is in
a maintenance grace period.JiraLicenseManager.confirmProceedUnderEvaluationTerms(String)
public void subscribeToClearCache(@Nonnull java.util.function.Consumer<Void> consumer)
JiraLicenseManager
Consumer
to be called after this manager's cache has been cleared.subscribeToClearCache
in interface JiraLicenseManager
consumer
- Consumer
that will be called after this manager's cache has been cleared.JiraLicenseManager.unSubscribeFromClearCache(Consumer)
public void unSubscribeFromClearCache(@Nonnull java.util.function.Consumer<Void> consumer)
JiraLicenseManager
Consumer
from being called after clearing of this manager's cache.unSubscribeFromClearCache
in interface JiraLicenseManager
consumer
- Consumer
to be un-subscribed from this manager.JiraLicenseManager.subscribeToClearCache(Consumer)
public void clearCache()
CachingComponent
clearCache
in interface CachingComponent
Copyright © 2002-2024 Atlassian. All Rights Reserved.