Class LicensorScriptService

  • All Implemented Interfaces:
    org.xwiki.script.service.ScriptService

    @Component
    @Named("licensing.licensor")
    @Singleton
    @Unstable
    public class LicensorScriptService
    extends Object
    implements org.xwiki.script.service.ScriptService
    Script service for the licensor, to be used when running functional tests of the licensed applications.
    Since:
    1.8
    Version:
    $Id$
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.xwiki.licensing.License addLicense​(org.xwiki.extension.ExtensionId extensionId, com.xwiki.licensing.LicenseType licenseType)
      Add a new license of a certain type for the given extension.
      com.xwiki.licensing.License addLicense​(org.xwiki.extension.ExtensionId extensionId, com.xwiki.licensing.LicenseType licenseType, int expirationDays, long maxUserCount)
      Add a new license of a certain type for the given extension.
      com.xwiki.licensing.License addLicense​(org.xwiki.model.reference.EntityReference entityReference, com.xwiki.licensing.LicenseType licenseType)
      Add a new license of a certain type for the given entity.
      com.xwiki.licensing.License addLicense​(org.xwiki.model.reference.EntityReference entityReference, com.xwiki.licensing.LicenseType licenseType, int expirationDays, long maxUserCount)
      Add a new license of a certain type for the given entity.
      com.xwiki.licensing.License getLicense()
      Retrieve the currently applicable license for the current context document if any.
      com.xwiki.licensing.License getLicenseForEntity​(org.xwiki.model.reference.EntityReference reference)
      Get the license applicable to the given reference.
      com.xwiki.licensing.License getLicenseForExtension​(org.xwiki.extension.ExtensionId extensionId)
      Retrieve the currently applicable license for the given installed extension.
      com.xwiki.licensing.LicenseType getLicenseType​(String licenseType)
      Retrieve the LicenseType corresponding to the given string identifier.
      boolean hasLicensure()
      Equivalent to licensor.hasLicensure() call.
      boolean hasLicensureForEntity​(org.xwiki.model.reference.EntityReference reference)
      Check if the given entity is covered by a valid license.
      boolean hasLicensureForExtension​(org.xwiki.extension.ExtensionId extensionId)
      Check if the given extension is covered by a valid license.
    • Constructor Detail

      • LicensorScriptService

        public LicensorScriptService()
    • Method Detail

      • getLicense

        public com.xwiki.licensing.License getLicense()
        Retrieve the currently applicable license for the current context document if any. Equivalent to licensor.getLicense() call.
        Returns:
        a license, or null if there is no current document, or the current document is not subject to licensing.
      • getLicenseForExtension

        public com.xwiki.licensing.License getLicenseForExtension​(org.xwiki.extension.ExtensionId extensionId)
        Retrieve the currently applicable license for the given installed extension. Equivalent to licensor.getLicense(ExtensionId) call.
        Parameters:
        extensionId - identifier of an installed extension
        Returns:
        a license, or null if the given installed extension is not subject to licensing.
      • getLicenseForEntity

        public com.xwiki.licensing.License getLicenseForEntity​(org.xwiki.model.reference.EntityReference reference)
        Get the license applicable to the given reference. Equivalent to licensor.getLicense(EntityReference) call.
        Parameters:
        reference - the reference to get the license from.
        Returns:
        a license, or null if the given reference is not subject to licensing.
      • hasLicensure

        public boolean hasLicensure()
        Equivalent to licensor.hasLicensure() call.
        Returns:
        true if the current document has a valid license or is not subject to licensing.
      • hasLicensureForExtension

        public boolean hasLicensureForExtension​(org.xwiki.extension.ExtensionId extensionId)
        Check if the given extension is covered by a valid license. Equivalent to licensor.hasLicensure(ExtensionId) call.
        Parameters:
        extensionId - the identifier of the extension for which licensure should be checked.
        Returns:
        true if the given extension has a valid license or is not subject to licensing.
      • hasLicensureForEntity

        public boolean hasLicensureForEntity​(org.xwiki.model.reference.EntityReference reference)
        Check if the given entity is covered by a valid license. Equivalent to licensor.hasLicensure(EntityReference) call.
        Parameters:
        reference - the reference of the entity for which licensure should be checked.
        Returns:
        true if the given reference has a valid license or is not subject to licensing.
      • addLicense

        public com.xwiki.licensing.License addLicense​(org.xwiki.extension.ExtensionId extensionId,
                                                      com.xwiki.licensing.LicenseType licenseType)
        Add a new license of a certain type for the given extension.
        Parameters:
        extensionId - the identifier of the installed extension
        licenseType - the type of License to add (FREE, TRIAL, PAID)
        Returns:
        the newly created License
      • addLicense

        public com.xwiki.licensing.License addLicense​(org.xwiki.extension.ExtensionId extensionId,
                                                      com.xwiki.licensing.LicenseType licenseType,
                                                      int expirationDays,
                                                      long maxUserCount)
        Add a new license of a certain type for the given extension.
        Parameters:
        extensionId - the identifier of the installed extension
        licenseType - the type of License to add (FREE, TRIAL, PAID)
        expirationDays - the number of days until the license expires
        maxUserCount - the maximum number of users allowed under this license
        Returns:
        the newly created License
      • addLicense

        public com.xwiki.licensing.License addLicense​(org.xwiki.model.reference.EntityReference entityReference,
                                                      com.xwiki.licensing.LicenseType licenseType)
        Add a new license of a certain type for the given entity.
        Parameters:
        entityReference - the reference of the entity to which the license applies
        licenseType - the type of License to add (FREE, TRIAL, PAID)
        Returns:
        the newly created License
      • addLicense

        public com.xwiki.licensing.License addLicense​(org.xwiki.model.reference.EntityReference entityReference,
                                                      com.xwiki.licensing.LicenseType licenseType,
                                                      int expirationDays,
                                                      long maxUserCount)
        Add a new license of a certain type for the given entity.
        Parameters:
        entityReference - the reference of the entity to which the license applies
        licenseType - the type of License to add (FREE, TRIAL, PAID)
        expirationDays - the number of days until the license expires
        maxUserCount - the maximum number of users allowed under this license
        Returns:
        the newly created License
      • getLicenseType

        public com.xwiki.licensing.LicenseType getLicenseType​(String licenseType)
        Retrieve the LicenseType corresponding to the given string identifier.
        Parameters:
        licenseType - the name of the license type (FREE, TRIAL, PAID)
        Returns:
        the corresponding enum value of the license type