@Transactional public class CrowdLicenseManagerImpl extends Object implements CrowdLicenseManager
Modifier and Type | Field and Description |
---|---|
static EntityQuery<Application> |
ACTIVE_APPS_QUERY |
static EntityQuery<String> |
ACTIVE_USERS_QUERY |
static EntityQuery<String> |
ALL_USERS_QUERY |
Constructor and Description |
---|
CrowdLicenseManagerImpl(PropertyManager propertyManager,
ApplicationManager applicationManager,
DirectoryManager directoryManager,
CrowdLicenseStore licenseStore,
ClusterService clusterService,
com.atlassian.event.api.EventPublisher eventPublisher) |
Modifier and Type | Method and Description |
---|---|
int |
getCurrentResourceUsageTotal()
This will calculate the number of unique Principals currently being used by Crowd.
|
com.atlassian.extras.api.crowd.CrowdLicense |
getLicense()
This will retrieve the license for the currently running Crowd instance.
|
com.atlassian.extras.api.crowd.CrowdLicense |
getLicense(String licenseKey)
This will parse a license key into a license.
|
String |
getRawLicense()
This will retrieve the license key for the currently running Crowd instance.
|
boolean |
isBuildWithinMaintenancePeriod(com.atlassian.extras.api.crowd.CrowdLicense license)
Return's true if the current Build is within the maintenance period for the Crowd license
|
boolean |
isBuildWithinMaintenancePeriod(String licenseKey) |
boolean |
isLicenseKeyValid(String licenseKey)
Will validate that a given License key is valid
|
boolean |
isLicenseValid()
This will evaluate against the current license stored in Crowd LicenseStore.
|
boolean |
isLicenseValid(com.atlassian.extras.api.crowd.CrowdLicense license)
Same logic as
CrowdLicenseManager.isLicenseValid() |
boolean |
isResourceTotalOverLimit(float limit,
int currentResourceCount)
Calculates the percentage of currentResourceCount over the user limit on a license
and returns true or false if the percentage is above the passed in limit.
|
boolean |
isResourceTotalUnderLimitInLicenseKey(String licenseKey)
Validate if a given license key has a higher resource limit than current total resource count
|
boolean |
isSetupLicenseKeyValid(String licenseKey)
Checks if a license key valid for set up.
|
com.atlassian.extras.api.crowd.CrowdLicense |
storeLicense(String licenseKey)
This will store the license in the LicenseStore for the currently running Crowd instance.
|
public static final EntityQuery<String> ACTIVE_USERS_QUERY
public static final EntityQuery<String> ALL_USERS_QUERY
public static final EntityQuery<Application> ACTIVE_APPS_QUERY
public CrowdLicenseManagerImpl(PropertyManager propertyManager, ApplicationManager applicationManager, DirectoryManager directoryManager, CrowdLicenseStore licenseStore, ClusterService clusterService, com.atlassian.event.api.EventPublisher eventPublisher)
public com.atlassian.extras.api.crowd.CrowdLicense getLicense()
CrowdLicenseManager
getLicense
in interface CrowdLicenseManager
CrowdLicenseManager.getLicense()
public com.atlassian.extras.api.crowd.CrowdLicense getLicense(String licenseKey)
CrowdLicenseManager
getLicense
in interface CrowdLicenseManager
licenseKey
- license stringpublic String getRawLicense()
CrowdLicenseManager
getRawLicense
in interface CrowdLicenseManager
public com.atlassian.extras.api.crowd.CrowdLicense storeLicense(String licenseKey) throws CrowdLicenseManagerException
CrowdLicenseManager
storeLicense
in interface CrowdLicenseManager
CrowdLicenseManagerException
public boolean isLicenseValid()
CrowdLicenseManager
Will return true if the License has not gone beyond its resource total and if the user is not running an evaluation version and it has not expired. This is an overriding method to @see isLicenseValid(License license), so will call getLicense() internally.
isLicenseValid
in interface CrowdLicenseManager
CrowdLicenseManager.isLicenseValid()
public boolean isSetupLicenseKeyValid(String licenseKey)
CrowdLicenseManager
isSetupLicenseKeyValid
in interface CrowdLicenseManager
licenseKey
- the String to validate.public boolean isLicenseValid(com.atlassian.extras.api.crowd.CrowdLicense license)
CrowdLicenseManager
CrowdLicenseManager.isLicenseValid()
isLicenseValid
in interface CrowdLicenseManager
public boolean isLicenseKeyValid(String licenseKey)
CrowdLicenseManager
isLicenseKeyValid
in interface CrowdLicenseManager
licenseKey
- the String to validatepublic int getCurrentResourceUsageTotal() throws CrowdLicenseManagerException
CrowdLicenseManager
PropertyManager.getCurrentLicenseResourceTotal()
Note: Do not call this method from the web layer, as this is wrapped in a Spring managed transactiongetCurrentResourceUsageTotal
in interface CrowdLicenseManager
CrowdLicenseManagerException
CrowdLicenseManager.getCurrentResourceUsageTotal()
public boolean isResourceTotalOverLimit(float limit, int currentResourceCount)
CrowdLicenseManager
isResourceTotalOverLimit
in interface CrowdLicenseManager
limit
- the percentage limit to test againstcurrentResourceCount
- the current number of resources in the system.CrowdLicenseManager.isResourceTotalOverLimit(float, int)
public boolean isBuildWithinMaintenancePeriod(com.atlassian.extras.api.crowd.CrowdLicense license)
CrowdLicenseManager
isBuildWithinMaintenancePeriod
in interface CrowdLicenseManager
public boolean isBuildWithinMaintenancePeriod(String licenseKey)
isBuildWithinMaintenancePeriod
in interface CrowdLicenseManager
public boolean isResourceTotalUnderLimitInLicenseKey(String licenseKey)
CrowdLicenseManager
isResourceTotalUnderLimitInLicenseKey
in interface CrowdLicenseManager
licenseKey
- the license key String to validateCopyright © 2021 Atlassian. All rights reserved.