Package com.labs64.netlicensing.service
Class ProductService
- java.lang.Object
-
- com.labs64.netlicensing.service.ProductService
-
public class ProductService extends Object
Provides product handling routines.Product entity represents the vendor product within NetLicensing. Usually it corresponds to an actual product of the vendor, but variations possible - in some cases it may be feasible to configure two or more separate products within NetLicensing for a single actual product of the vendor. Products comprise of multiple product modules, and licensing rules are defined for each product module. The products are completely independent of each other in terms of license management. Once product is configured, licensees can be registered with the product. Licensees can obtain licenses according to configured license templates.
-
-
Constructor Summary
Constructors Constructor Description ProductService()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Product
create(Context context, Product product)
Creates new product with given properties.static void
delete(Context context, String number, boolean forceCascade)
Deletes product.static Product
get(Context context, String number)
Gets product by its number.static Page<Product>
list(Context context, String filter)
Returns products of a vendor.static Product
update(Context context, String number, Product product)
Updates product properties.
-
-
-
Method Detail
-
create
public static Product create(Context context, Product product) throws NetLicensingException
Creates new product with given properties.- Parameters:
context
- determines the vendor on whose behalf the call is performedproduct
- 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 product object
- Throws:
NetLicensingException
- any subclass of NetLicensingException. These exceptions will be transformed to the corresponding service response messages.
-
get
public static Product get(Context context, String number) throws NetLicensingException
Gets product by its number.- Parameters:
context
- determines the vendor on whose behalf the call is performednumber
- the product number- Returns:
- the product
- Throws:
NetLicensingException
- any subclass of NetLicensingException. These exceptions will be transformed to the corresponding service response messages.
-
list
public static Page<Product> list(Context context, String filter) throws NetLicensingException
Returns products 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:
- collection of product entities 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 Product update(Context context, String number, Product product) throws NetLicensingException
Updates product properties.- Parameters:
context
- determines the vendor on whose behalf the call is performednumber
- product numberproduct
- non-null properties will be updated to the provided values, null properties will stay unchanged.- Returns:
- updated product.
- 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 product.- Parameters:
context
- determines the vendor on whose behalf the call is performednumber
- product 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.
-
-