Class LicenseAccess


  • public class LicenseAccess
    extends Object
    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 Detail

      • LicenseAccess

        public LicenseAccess​(LicenseModel systemLicense)
        Parameters:
        systemLicense - the system license
      • LicenseAccess

        public LicenseAccess​(LicenseModel systemLicense,
                             LicenseModel clientLicense)
        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 be null (which is treated as an empty license without any features).
        clientLicense - The client license, may be null (which is treated as an empty license without any features).
    • Method Detail

      • getBooleanFeature

        public boolean getBooleanFeature​(ELicenseFeature feature)
        Parameters:
        feature - the feature to get the value of
        Returns:
        the value of the feature, false if the feature is not defined
      • getBooleanFeature

        public boolean getBooleanFeature​(ELicenseFeature feature,
                                         boolean defaultValue)
        Parameters:
        feature - the feature to get the value of
        defaultValue - 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

        public boolean getBooleanFeature​(String featureName,
                                         boolean defaultValue)
        Parameters:
        featureName - the name of the feature to get the value of
        defaultValue - 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
      • getClientLicense

        public LicenseModel getClientLicense()
        Gets the clientLicense
        Returns:
        the clientLicense
      • getNumberFeature

        public Number getNumberFeature​(ELicenseFeature feature)
        Parameters:
        feature - the feature to get the value of
        Returns:
        the value of the feature, 0 if the feature is not defined
      • getNumberFeature

        public Number getNumberFeature​(ELicenseFeature feature,
                                       Number defaultValue)
        Parameters:
        feature - the feature to get the value of
        defaultValue - 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

        public Number getNumberFeature​(String featureName,
                                       Number defaultValue)
        Parameters:
        featureName - the name of the feature to get the value of
        defaultValue - 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
      • getStringFeature

        public String getStringFeature​(ELicenseFeature feature)
        Parameters:
        feature - the feature to get the value of
        Returns:
        the value of the feature, empty string if the feature does not exist.
      • getStringFeature

        public String getStringFeature​(ELicenseFeature feature,
                                       String defaultValue)
        Parameters:
        feature - the feature to get the value of
        defaultValue - 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

        public String getStringFeature​(String featureName,
                                       String defaultValue)
        Parameters:
        featureName - the name of the feature to get the value of
        defaultValue - 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
      • getSystemLicense

        public LicenseModel getSystemLicense()
        Gets the systemLicense
        Returns:
        the systemLicense
      • hasSublicense

        public boolean hasSublicense​(String subLicenseItemKey)
      • getSublicenseCount

        public int getSublicenseCount​(String subLicenseItemKey)
      • isClientLicenseValid

        public boolean isClientLicenseValid()
        Returns:
        true if the combination of client and system license is valid, false otherwise
      • isSystemLicenseValid

        public boolean isSystemLicenseValid()
        Returns:
        true if the system license is valid, false otherwise