Search in sources :

Example 71 with LicenseType

use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.

the class LicenseAdminConfigController method doSetDefaultLicenceType.

private void doSetDefaultLicenceType(FormItem source, SingleSelection singleSelection) {
    if (singleSelection.isOneSelected()) {
        String selectedKey = singleSelection.getSelectedKey();
        LicenseHandler handler = (LicenseHandler) source.getUserObject();
        LicenseType licenseType = licenseService.loadLicenseTypeByKey(selectedKey);
        licenseModule.setDefaultLicenseTypeKey(handler, String.valueOf(licenseType.getKey()));
    }
}
Also used : LicenseHandler(org.olat.core.commons.services.license.LicenseHandler) LicenseType(org.olat.core.commons.services.license.LicenseType)

Example 72 with LicenseType

use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.

the class LicenseAdminConfigController method doActivateLicenseType.

private void doActivateLicenseType(MultipleSelectionElement multipleSelectionElement) {
    boolean doActivate = multipleSelectionElement.isAtLeastSelected(1) ? true : false;
    HandlerLicenseType handlerLicenseType = (HandlerLicenseType) multipleSelectionElement.getUserObject();
    LicenseHandler handler = handlerLicenseType.getHandler();
    LicenseType licenseType = handlerLicenseType.getLicenseType();
    if (doActivate) {
        licenseService.activate(handler, licenseType);
        reloadDefaultLicenseTypeEl(handler);
    } else {
        if (isDefaultLicenseType(handler, licenseType)) {
            showWarning("error.is.default.license.type");
            loadModel();
        } else {
            licenseService.deactivate(handler, licenseType);
            reloadDefaultLicenseTypeEl(handler);
        }
    }
    // checkboxes of enabled handlers was deactivated after deactivating a license type.
    initGeneralElements();
}
Also used : LicenseHandler(org.olat.core.commons.services.license.LicenseHandler) LicenseType(org.olat.core.commons.services.license.LicenseType)

Example 73 with LicenseType

use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.

the class LicenseAdminConfigController method loadModel.

private void loadModel() {
    List<LicenseType> licenseTypes = licenseService.loadLicenseTypes();
    Collections.sort(licenseTypes);
    List<LicenseTypeRow> rows = new ArrayList<>();
    for (LicenseType licenseType : licenseTypes) {
        List<MultipleSelectionElement> formItems = createActivationCheckBoxes(licenseType, licenseHandlers);
        LicenseTypeRow licenseTypeRow = new LicenseTypeRow(licenseType, formItems);
        rows.add(licenseTypeRow);
    }
    dataModel.setObjects(rows);
    tableEl.reset();
}
Also used : MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) ArrayList(java.util.ArrayList) LicenseType(org.olat.core.commons.services.license.LicenseType)

Example 74 with LicenseType

use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.

the class LicenseAdminConfigController method doUp.

private void doUp(int index) {
    LicenseType downLicenseType = dataModel.getObject(index - 1).getLicenseType();
    LicenseType upLicenseType = dataModel.getObject(index).getLicenseType();
    ;
    switchLicenseTypes(downLicenseType, upLicenseType);
}
Also used : LicenseType(org.olat.core.commons.services.license.LicenseType)

Example 75 with LicenseType

use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.

the class LicenseAdminConfigController method doDown.

private void doDown(int index) {
    LicenseType downLicenseType = dataModel.getObject(index).getLicenseType();
    LicenseType upLicenseType = dataModel.getObject(index + 1).getLicenseType();
    ;
    switchLicenseTypes(downLicenseType, upLicenseType);
}
Also used : LicenseType(org.olat.core.commons.services.license.LicenseType)

Aggregations

LicenseType (org.olat.core.commons.services.license.LicenseType)106 Test (org.junit.Test)40 ResourceLicense (org.olat.core.commons.services.license.ResourceLicense)28 LicenseService (org.olat.core.commons.services.license.LicenseService)14 License (org.olat.core.commons.services.license.License)12 OLATResourceable (org.olat.core.id.OLATResourceable)12 File (java.io.File)6 ArrayList (java.util.ArrayList)4 LicenseHandler (org.olat.core.commons.services.license.LicenseHandler)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 QLicense (org.olat.modules.qpool.model.QLicense)4 Date (java.util.Date)2 Random (java.util.Random)2 IdentityShort (org.olat.basesecurity.IdentityShort)2 LicenseImpl (org.olat.core.commons.services.license.model.LicenseImpl)2 MultipleSelectionElement (org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)2 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)2 Translator (org.olat.core.gui.translator.Translator)2 MultiUserEvent (org.olat.core.util.event.MultiUserEvent)2 LocalFileImpl (org.olat.core.util.vfs.LocalFileImpl)2