Class LicenseAccess
java.lang.Object
de.xima.fc.license.LicenseAccess
- All Implemented Interfaces:
ILicenseAccess
Model that combines a system and a client license. When querying a
feature, first it checks
whether that feature exists in the client license. If not, it falls back to the system license. Otherwise, an
appropriate default value is returned.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH, Dresden
-
Constructor Summary
ConstructorsConstructorDescriptionLicenseAccess(LicenseModel systemLicense) LicenseAccess(LicenseModel systemLicense, LicenseModel clientLicense) Creates a new license wrapper with a client and system license. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetBooleanFeature(ELicenseFeature feature) booleangetBooleanFeature(ELicenseFeature feature, boolean defaultValue) booleangetBooleanFeature(String featureName, boolean defaultValue) Gets the clientLicenseintgetIntFeature(ELicenseFeature feature) Gets the value of the given feature as an integer.intgetIntFeature(ELicenseFeature feature, int defaultValue) Gets the value of the given feature as an integer.intgetIntFeature(String feature) Gets the value of the given feature as an integer.intgetIntFeature(String feature, int defaultValue) Gets the value of the given feature as an integer.getNumberFeature(ELicenseFeature feature) getNumberFeature(ELicenseFeature feature, Number defaultValue) getNumberFeature(String featureName, Number defaultValue) getStringFeature(ELicenseFeature feature) getStringFeature(ELicenseFeature feature, String defaultValue) getStringFeature(String featureName, String defaultValue) intgetSublicenseCount(String subLicenseItemKey) getSubLicensesByItem(String subLicenseItemKey) Gets the systemLicensebooleanhasAccess(EAccessProperty property) hasFeature(ELicenseFeature feature) Checks if the license has the given license feature and returns the value of the feature if it is set.booleanWhether the authorizer of the access propertyEAccessProperty.CLIENT_SINGLE_USER_PORTALis authorized.booleanhasSublicense(String subLicenseItemKey) booleanboolean
-
Constructor Details
-
LicenseAccess
- Parameters:
systemLicense- the system license
-
LicenseAccess
Creates a new license wrapper with a client and system license. When querying a feature, first it tries the client license, then the system license.- Parameters:
systemLicense- The system license, may benull(which is treated as an empty license without any features).clientLicense- The client license, may benull(which is treated as an empty license without any features).
-
-
Method Details
-
getClientLicense
-
isClientLicenseValid
public boolean isClientLicenseValid()- Returns:
trueif the combination of client and system license is valid,falseotherwise
-
isSystemLicenseValid
public boolean isSystemLicenseValid()- Returns:
trueif the system license is valid,falseotherwise
-
getSystemLicense
-
getBooleanFeature
- Parameters:
feature- the feature to get the value of- Returns:
- the value of the feature,
falseif the feature is not defined
-
getBooleanFeature
- Parameters:
feature- the feature to get the value ofdefaultValue- the default value to return if the feature is not defined- Returns:
- the value of the feature or the defaultValue if the feature is not defined
-
getBooleanFeature
- Parameters:
featureName- the name of the feature to get the value ofdefaultValue- the default value to return if the feature is not defined- Returns:
- the value of the feature or the defaultValue if the feature is not defined
-
getIntFeature
Gets the value of the given feature as an integer. If the feature is not defined, 0 is returned.- Parameters:
feature- The feature to get the value of- Returns:
- The value of the feature, 0 if the feature is not defined
-
getIntFeature
Gets the value of the given feature as an integer. If the feature is not defined, the given default is returned.- Parameters:
feature- The feature to get the value of- Returns:
- The value of the feature, default value if the feature is not defined
-
getIntFeature
Gets the value of the given feature as an integer. If the feature is not defined, 0 is returned.- Parameters:
feature- The feature to get the value of- Returns:
- The value of the feature, 0 if the feature is not defined
-
getIntFeature
Gets the value of the given feature as an integer. If the feature is not defined, the given default is returned.- Parameters:
feature- The feature to get the value of- Returns:
- The value of the feature, default value if the feature is not defined
-
getNumberFeature
- Parameters:
feature- the feature to get the value of- Returns:
- the value of the feature, 0 if the feature is not defined
-
getNumberFeature
- Parameters:
feature- the feature to get the value ofdefaultValue- the default value to return if the feature is not defined- Returns:
- The value of the feature or the default value if the feature is not defined
-
getNumberFeature
-
getStringFeature
- Parameters:
feature- the feature to get the value of- Returns:
- the value of the feature, empty string if the feature does not exist.
-
getStringFeature
- Parameters:
feature- the feature to get the value ofdefaultValue- the default value to return if the feature is not defined- Returns:
- the value of the feature or the defaultValue if the feature does not exist.
-
getStringFeature
-
getSubLicensesByItem
-
getSublicenseCount
-
hasAccess
- Parameters:
property- theEAccessPropertyto check- Returns:
- the value of the
EAccessPropertyin the license ortrueif theEAccessPropertyis not defined
-
hasFeature
Description copied from interface:ILicenseAccessChecks if the license has the given license feature and returns the value of the feature if it is set.- Specified by:
hasFeaturein interfaceILicenseAccess- Parameters:
feature- The feature to check.- Returns:
- The value of the feature if it is set,
Optional.empty()otherwise.
-
hasPortalFeature
public boolean hasPortalFeature()Whether the authorizer of the access propertyEAccessProperty.CLIENT_SINGLE_USER_PORTALis authorized.- Returns:
trueif the authorizer of the access propertyEAccessProperty.CLIENT_SINGLE_USER_PORTALis authorized orfalseotherwise.
-
hasSublicense
-