Class LicenseService


  • public class LicenseService
    extends Object
    Provides license handling routines.

    Licenses always belong to a certain licensee. Licenses are cloned off the corresponding license templates when a licensee obtains them. On validation request the licenses that belong to a licensee are processed according to the licensing models configured for the product modules, and the validation result is sent back for further processing to the requesting side (which is typically a vendor service or a program executed by the end user).

    In simple cases there is no need to work with licenses directly via NetLicensing API, as licenses are assigned either by a licensing model automatically (e.g. evaluation licenses) or actively purchased by a licensee via NetLicensing Shop. However, for some complex licensing models, there may be a need to assign licenses to a licensee programmatically from the vendor software.

    • Constructor Detail

      • LicenseService

        public LicenseService()
    • Method Detail

      • create

        public static License create​(Context context,
                                     String licenseeNumber,
                                     String licenseTemplateNumber,
                                     String transactionNumber,
                                     License license)
                              throws NetLicensingException
        Creates new license object with given properties.
        Parameters:
        context - determines the vendor on whose behalf the call is performed
        licenseeNumber - parent licensee to which the new license is to be added
        licenseTemplateNumber - license template that the license is created from
        transactionNumber - For privileged logins specifies transaction for the license creation. For regular logins new transaction always created implicitly, and the operation will be in a separate transaction. Transaction is generated with the provided transactionNumber, or, if transactionNumber is null, with auto-generated number.
        license - non-null properties will be taken for the new object, null properties will either stay null, or will be set to a default value, depending on property.
        Returns:
        the newly created license object
        Throws:
        NetLicensingException - any subclass of NetLicensingException. These exceptions will be transformed to the corresponding service response messages.
      • list

        public static Page<License> list​(Context context,
                                         String filter)
                                  throws NetLicensingException
        Returns licenses of a vendor.
        Parameters:
        context - determines the vendor on whose behalf the call is performed
        filter - reserved for the future use, must be omitted / set to NULL
        Returns:
        list of licenses (of all products) or null/empty list if nothing found.
        Throws:
        NetLicensingException - any subclass of NetLicensingException. These exceptions will be transformed to the corresponding service response messages.
      • update

        public static License update​(Context context,
                                     String number,
                                     String transactionNumber,
                                     License license)
                              throws NetLicensingException
        Updates license properties.
        Parameters:
        context - determines the vendor on whose behalf the call is performed
        number - license number
        transactionNumber - transaction for the license update. Created implicitly if transactionNumber is null. In this case the operation will be in a separate transaction.
        license - non-null properties will be updated to the provided values, null properties will stay unchanged.
        Returns:
        updated license.
        Throws:
        NetLicensingException - any subclass of NetLicensingException. These exceptions will be transformed to the corresponding service response messages.
      • delete

        public static void delete​(Context context,
                                  String number,
                                  boolean forceCascade)
                           throws NetLicensingException
        Deletes license.

        When any license is deleted, corresponding transaction is created automatically.

        Parameters:
        context - determines the vendor on whose behalf the call is performed
        number - license number
        forceCascade - if true, any entities that depend on the one being deleted will be deleted too
        Throws:
        NetLicensingException - any subclass of NetLicensingException. These exceptions will be transformed to the corresponding service response messages.