Search in sources :

Example 96 with LicenseType

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

the class MetaInfoFormController method getLicenseFromFormItems.

private License getLicenseFromFormItems() {
    License license = licenseService.createLicense(null);
    String licensor = "";
    String freetext = "";
    if (licenseModule.isEnabled(licenseHandler)) {
        if (licenseEl != null && licenseEl.isOneSelected()) {
            String licenseTypeKey = licenseEl.getSelectedKey();
            LicenseType licneseType = licenseService.loadLicenseTypeByKey(licenseTypeKey);
            license.setLicenseType(licneseType);
        }
        if (licensorEl != null && licensorEl.isVisible() && StringHelper.containsNonWhitespace(licensorEl.getValue())) {
            licensor = licensorEl.getValue();
        }
        if (licenseFreetextEl != null && licenseFreetextEl.isVisible() && StringHelper.containsNonWhitespace(licenseFreetextEl.getValue())) {
            freetext = licenseFreetextEl.getValue();
        }
        licensorEl.setValue(license.getLicensor());
        licenseFreetextEl.setValue(license.getFreetext());
    }
    license.setLicensor(licensor);
    license.setFreetext(freetext);
    return license;
}
Also used : License(org.olat.core.commons.services.license.License) LicenseType(org.olat.core.commons.services.license.LicenseType)

Example 97 with LicenseType

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

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)

Example 98 with LicenseType

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

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 99 with LicenseType

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

the class LicenseAdminConfigController method reloadDefaultLicenseTypeEl.

private void reloadDefaultLicenseTypeEl(LicenseHandler handler) {
    SingleSelection defaultLicenseTypeEl = defaultLicenseTypeEls.get(handler.getType());
    if (defaultLicenseTypeEl != null) {
        List<LicenseType> activatedLicenseTypes = licenseService.loadActiveLicenseTypes(handler);
        Collections.sort(activatedLicenseTypes);
        String[] licenseTypeKeys = getLicenseTypeKeys(activatedLicenseTypes);
        String[] licenseTypeValues = getLicenseTypeValues(activatedLicenseTypes);
        defaultLicenseTypeEl.setKeysAndValues(licenseTypeKeys, licenseTypeValues, null);
        String defaultLicenseTypeKey = licenseModule.getDefaultLicenseTypeKey(handler);
        if (Arrays.asList(licenseTypeKeys).contains(defaultLicenseTypeKey)) {
            defaultLicenseTypeEl.select(defaultLicenseTypeKey, true);
        }
    }
}
Also used : SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) LicenseType(org.olat.core.commons.services.license.LicenseType)

Example 100 with LicenseType

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

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)

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