Class LicenseService
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic License
create
(Context context, String licenseeNumber, String licenseTemplateNumber, String transactionNumber, License license) Creates new license object with given properties.static void
Deletes license.static License
Gets license by its number.Returns licenses of a vendor.static License
Updates license properties.
-
Constructor Details
-
LicenseService
public LicenseService()
-
-
Method Details
-
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 performedlicenseeNumber
- parent licensee to which the new license is to be addedlicenseTemplateNumber
- license template that the license is created fromtransactionNumber
- 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.
-
get
Gets license by its number.- Parameters:
context
- determines the vendor on whose behalf the call is performednumber
- the license number- Returns:
- the license
- Throws:
NetLicensingException
- any subclass of NetLicensingException. These exceptions will be transformed to the corresponding service response messages.
-
list
Returns licenses of a vendor.- Parameters:
context
- determines the vendor on whose behalf the call is performedfilter
- 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 performednumber
- license numbertransactionNumber
- 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 performednumber
- license numberforceCascade
- 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.
-