Class LicenseServerUtil


  • public class LicenseServerUtil
    extends Object
    Utility class for reading data from and writing data to the product management server via HTTP requests.
    Author:
    XIMA MEDIA GmbH
    • Constructor Detail

      • LicenseServerUtil

        public LicenseServerUtil()
    • Method Detail

      • updateClientLicense

        public <R> StageChain<Void,​R> updateClientLicense​(IPublicPromaInvocationContext pc,
                                                                String key,
                                                                Locale locale)
        Tries to update an client-license by the given key
        Parameters:
        pc - Context for accessing the PROMA API.
        key - the key of the client license to update
        locale - the locale for localized item informations
        Returns:
        A stage that completes when the license was updated.
      • updateSystemLicenseVersionState

        public <R> StageChain<ELicenseVersionState,​R> updateSystemLicenseVersionState​(IPublicPromaInvocationContext pc,
                                                                                            Locale locale)
        Updates the system license state by an server-side http query
        Parameters:
        pc - Context for accessing the PROMA API.
        locale - the locale for localized item informations
        Returns:
        the new system license version state
      • createDemoLicense

        public static <R> StageChain<IPromaResponse<byte[]>,​R> createDemoLicense​(IPublicPromaInvocationContext pc,
                                                                                       String parentLicenseKey,
                                                                                       String firstname,
                                                                                       String lastname,
                                                                                       String email,
                                                                                       String customerName,
                                                                                       String currentHardwareId,
                                                                                       Locale locale)
        This method creates a demo license based on the passed parameters and returns the status code of the request and on success the license data of the demo license. If the parent license key is null, it is the creation of a demo system license, which requires a hardware id.
        Parameters:
        pc - Context for the PROMA API invocation.
        parentLicenseKey - the license key of the parent license
        firstname - the first name of the customer
        lastname - the last name of the customer
        email - mail of the customer
        customerName - full name of the customer
        currentHardwareId - the current hardware id
        locale - the locale for localized license informations
        Returns:
        A Pair with the status code of the request and if available the demo license data as byte array
      • createOrUpdateItemLicense

        public static <R> StageChain<Boolean,​R> createOrUpdateItemLicense​(IPublicPromaInvocationContext pc,
                                                                                String licenseKey,
                                                                                String versionKey,
                                                                                Locale locale,
                                                                                String userName)
        This method gets all item licenses of a license from proma and creates or updates them in the database.
        Parameters:
        pc - Context for accessing the PROMA API.
        licenseKey - the license key of the parent license
        versionKey - the version key of the parent license
        locale - the locale for localized license informations
        userName - the user name for the item license
        Returns:
        true when the request was successful or the status code of the request is a 404. Returns false if an error occurred.
      • getLicenseKeyStatus

        public static <R> StageChain<IPromaResponse<byte[]>,​R> getLicenseKeyStatus​(IPublicPromaInvocationContext pc,
                                                                                         String licenseKey,
                                                                                         String currentHardwareId,
                                                                                         Locale locale)
        This method builds an http request for checking the license key and return the status code and the license data as byte array.
        Parameters:
        pc - Context for the PROMA API invocation.
        licenseKey - the license key to check
        currentHardwareId - the current hardware id
        locale - the locale for localized license informations
        Returns:
        If available the license data as byte array
      • getLicenseStatus

        public static <R> StageChain<Integer,​R> getLicenseStatus​(IPublicPromaInvocationContext pc,
                                                                       String licenseKey,
                                                                       String currentHardwareId,
                                                                       Locale locale)
        This method returns the status of the given license key.
        Parameters:
        pc - Context for the PROMA API invocation.
        licenseKey - the license key to be checked
        currentHardwareId - the current hardware id
        locale - the locale for localized license informations
        Returns:
        the status code of the http request
      • getLicenseUpdateStatus

        public static <R> StageChain<Integer,​R> getLicenseUpdateStatus​(IPublicPromaInvocationContext pc,
                                                                             String licenseKey,
                                                                             String versionKey,
                                                                             Locale locale)
        Returns the status code of the given license informations.
        Parameters:
        pc - Context for the PROMA API invocation.
        licenseKey - license key of the license to check for update
        versionKey - version key of the license to check for update
        locale - the locale for localized license informations
        Returns:
        the status code of the license update status
      • isDemoAllowed

        public static <R> StageChain<Boolean,​R> isDemoAllowed​(IPublicPromaInvocationContext pc,
                                                                    Locale locale)
        This method determines whether the product is allowed to create demo licenses.
        Parameters:
        pc - Context for the PROMA API invocation.
        locale - the locale for localized license informations
        Returns:
        true when the returned status code is 200 else return false.
      • setSystemLicenseVersionState

        public static void setSystemLicenseVersionState​(ELicenseVersionState systemLicenseState)
      • swapHardwareID

        public static <R> StageChain<Integer,​R> swapHardwareID​(IPublicPromaInvocationContext pc,
                                                                     String licenseKey,
                                                                     String versionKey,
                                                                     String swapTargetId,
                                                                     String currentHardwareId)
        Builds an http request for swapping a hardware ID.
        Parameters:
        pc - Context for the PROMA API invocation.
        licenseKey - the license key of the license
        versionKey - the version key of the license
        swapTargetId - the hardware id to swap
        currentHardwareId - the current hardware id
        Returns:
        The status code of the request