Class LicenseeService

java.lang.Object
com.labs64.netlicensing.service.LicenseeService

public class LicenseeService extends Object
Provides licensee handling routines.

Licensee is usually an end customer, capable of obtaining licenses for the product. Each licensee is associated with a single product. From the vendor perspective a licensee object in NetLicensing may correspond to a physical instance of the product, customer account within a vendor's service, or it can represent a security dongle given to a user. In practice, each licensee must only have a unique identifier associated with it, that is communicated to NetLicensing as licensee number for performing operations related to this licensee. Licensee doesn't need to have an own account within NetLicensing. There are two main operations performed for licensees: validation and obtaining new licenses. Validation process is typically completely transparent to the end user and performed from the vendor's product by means of this API. Licensee can be offered to obtain new licenses for the product by redirecting the user to the NetLicensing Shop in the web browser.

  • Constructor Details

    • LicenseeService

      public LicenseeService()
  • Method Details

    • create

      public static Licensee create(Context context, String productNumber, Licensee licensee) throws NetLicensingException
      Creates new licensee object with given properties.
      Parameters:
      context - determines the vendor on whose behalf the call is performed
      productNumber - parent product to which the new licensee is to be added
      licensee - 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 licensee object
      Throws:
      NetLicensingException - in case of a service error. Check subclass and message for details.
    • get

      public static Licensee get(Context context, String number) throws NetLicensingException
      Gets licensee by its number.
      Parameters:
      context - determines the vendor on whose behalf the call is performed
      number - the licensee number
      Returns:
      the licensee
      Throws:
      NetLicensingException - in case of a service error. Check subclass and message for details.
    • list

      public static Page<Licensee> list(Context context, String filter) throws NetLicensingException
      Returns all licensees 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 licensees (of all products) or null/empty list if nothing found.
      Throws:
      NetLicensingException - in case of a service error. Check subclass and message for details.
    • update

      public static Licensee update(Context context, String number, Licensee licensee) throws NetLicensingException
      Updates licensee properties.
      Parameters:
      context - determines the vendor on whose behalf the call is performed
      number - licensee number
      licensee - non-null properties will be updated to the provided values, null properties will stay unchanged.
      Returns:
      updated licensee.
      Throws:
      NetLicensingException - in case of a service error. Check subclass and message for details.
    • delete

      public static void delete(Context context, String number, boolean forceCascade) throws NetLicensingException
      Deletes licensee.
      Parameters:
      context - determines the vendor on whose behalf the call is performed
      number - licensee number
      forceCascade - if true, any entities that depend on the one being deleted will be deleted too
      Throws:
      NetLicensingException - in case of a service error. Check subclass and message for details.
    • validate

      @Deprecated public static ValidationResult validate(Context context, String number, String productNumber, String licenseeName, ValidationParameters validationParameters, MetaInfo... meta) throws NetLicensingException
      Deprecated.
      Validates active licenses of the licensee.
      Parameters:
      context - determines the vendor on whose behalf the call is performed
      number - licensee number
      productNumber - optional productNumber, must be provided in case licensee auto-create is enabled
      licenseeName - optional human-readable licensee name in case licensee will be auto-created
      validationParameters - optional validation parameters, specific to licensing model. See licensing model documentation for details.
      meta - optional parameter, receiving messages returned within response section.
      Returns:
      result of the validation
      Throws:
      NetLicensingException - in case of a service error. Check subclass and message for details.
    • validate

      public static ValidationResult validate(Context context, String number, ValidationParameters validationParameters, MetaInfo... meta) throws NetLicensingException
      Validates active licenses of the licensee. In the case of multiple product modules validation, required parameters indexes will be added automatically.
      Parameters:
      context - determines the vendor on whose behalf the call is performed
      number - licensee number
      validationParameters - optional validation parameters. See ValidationParameters and licensing model documentation for details.
      meta - optional parameter, receiving messages returned within response section.
      Returns:
      result of the validation
      Throws:
      NetLicensingException - in case of a service error. Check subclass and message for details.
    • transfer

      public static void transfer(Context context, String number, String sourceLicenseeNumber) throws NetLicensingException
      Transfer licenses between licensees.
      Parameters:
      context - determines the vendor on whose behalf the call is performed
      number - the number of the licensee receiving licenses
      sourceLicenseeNumber - the number of the licensee delivering licenses
      Throws:
      NetLicensingException - in case of a service error. Check subclass and message for details.