Search in sources :

Example 1 with LicenseManager

use of com.licensespring.LicenseManager in project jans by JanssenProject.

the class LicenseDetailsService method activateLicense.

public Boolean activateLicense(LicenseRequest licenseRequest) {
    AUIConfiguration auiConfiguration = auiConfigurationService.getAUIConfiguration();
    LicenseManager licenseManager = auiConfiguration.getLicenseConfiguration().getLicenseManager();
    try {
        log.debug("Trying to activate License.");
        ActivationLicense keyBased = ActivationLicense.fromKey(licenseRequest.getLicenseKey());
        License license = licenseManager.activateLicense(keyBased);
        log.debug("License activated : {} ", license.getProduct());
        return !license.getData().isExpired();
    } catch (Exception e) {
        log.error(ErrorResponse.ACTIVATE_LICENSE_ERROR.getDescription(), e);
        return false;
    }
}
Also used : ActivationLicense(com.licensespring.model.ActivationLicense) AUIConfiguration(io.jans.ca.plugin.adminui.model.config.AUIConfiguration) BackOfficeLicense(com.licensespring.management.model.BackOfficeLicense) ActivationLicense(com.licensespring.model.ActivationLicense) License(com.licensespring.License) LicenseManager(com.licensespring.LicenseManager) ApplicationException(io.jans.ca.plugin.adminui.model.exception.ApplicationException)

Aggregations

License (com.licensespring.License)1 LicenseManager (com.licensespring.LicenseManager)1 BackOfficeLicense (com.licensespring.management.model.BackOfficeLicense)1 ActivationLicense (com.licensespring.model.ActivationLicense)1 AUIConfiguration (io.jans.ca.plugin.adminui.model.config.AUIConfiguration)1 ApplicationException (io.jans.ca.plugin.adminui.model.exception.ApplicationException)1