use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.
the class LicenseUIFactory method updateVisibility.
public static void updateVisibility(SingleSelection licenseEl, TextElement licensorEl, TextElement licenseFreetextEl) {
boolean licenseSelected = false;
boolean freetextSelected = false;
if (licenseEl != null && licenseEl.isOneSelected()) {
LicenseService licenseService = CoreSpringFactory.getImpl(LicenseService.class);
String selectedKey = licenseEl.getSelectedKey();
LicenseType licenseType = licenseService.loadLicenseTypeByKey(selectedKey);
licenseSelected = !licenseService.isNoLicense(licenseType);
freetextSelected = licenseService.isFreetext(licenseType);
}
if (licensorEl != null) {
licensorEl.setVisible(licenseSelected);
}
if (licenseFreetextEl != null) {
licenseFreetextEl.setVisible(freetextSelected);
}
}
use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.
the class LicenseServiceImpl method getDefaultLicenseType.
private LicenseType getDefaultLicenseType(LicenseHandler handler) {
String defaultLicenseTypeKey = licenseModule.getDefaultLicenseTypeKey(handler);
LicenseType defautlLicenseType = loadLicenseTypeByKey(defaultLicenseTypeKey);
if (defautlLicenseType == null) {
defautlLicenseType = licenseTypeDao.loadNoLicenseType();
}
return defautlLicenseType;
}
use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.
the class LicenseServiceImpl method loadOrCreateLicense.
@Override
public ResourceLicense loadOrCreateLicense(OLATResourceable ores) {
ResourceLicense license = licenseDao.loadByResource(ores);
if (license == null) {
LicenseType licenseType = licenseTypeDao.loadNoLicenseType();
license = licenseDao.createAndPersist(ores, licenseType);
}
return license;
}
use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.
the class LicenseServiceImpl method createDefaultLicense.
@Override
public ResourceLicense createDefaultLicense(OLATResourceable ores, LicenseHandler handler, Identity licensor) {
LicenseType defautlLicenseType = getDefaultLicenseType(handler);
String licensorName = licensorFactory.create(handler, licensor);
return licenseDao.createAndPersist(ores, defautlLicenseType, licensorName);
}
use of org.olat.core.commons.services.license.LicenseType in project OpenOLAT by OpenOLAT.
the class LicenseServiceImpl method createLicenseType.
@Override
public LicenseType createLicenseType(String name) {
LicenseType licenseType = licenseTypeDao.create(name);
log.info("License type created: " + licenseType);
return licenseType;
}
Aggregations