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;
}
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);
}
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);
}
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);
}
}
}
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();
}
Aggregations