use of org.olat.core.commons.services.license.model.LicenseTypeImpl in project OpenOLAT by OpenOLAT.
the class LicenseTypeDAO method create.
LicenseType create(String name) {
LicenseTypeImpl licenseType = new LicenseTypeImpl();
Date now = new Date();
licenseType.setCreationDate(now);
licenseType.setLastModified(now);
licenseType.setName(name);
licenseType.setPredefined(false);
return licenseType;
}
use of org.olat.core.commons.services.license.model.LicenseTypeImpl in project OpenOLAT by OpenOLAT.
the class LicenseXStreamHelperTest method shouldConvertToXmlAndBack.
@Test
public void shouldConvertToXmlAndBack() {
String licensor = "licensor";
String freetext = "freetext";
String licenseTypeName = "licenseTypeName";
LicenseTypeImpl licenseType = new LicenseTypeImpl();
licenseType.setName(licenseTypeName);
LicenseImpl license = new LicenseImpl();
license.setLicensor(licensor);
license.setFreetext(freetext);
license.setLicenseType(licenseType);
LicenseXStreamHelper licenseXStreamHelper = new LicenseXStreamHelper();
String licenseAsXml = licenseXStreamHelper.toXml(license);
System.out.println(licenseAsXml);
License licenseFromXml = licenseXStreamHelper.licenseFromXml(licenseAsXml);
assertThat(licenseFromXml.getLicensor()).isEqualTo(licensor);
assertThat(licenseFromXml.getFreetext()).isEqualTo(freetext);
assertThat(licenseFromXml.getLicenseType().getName()).isEqualTo(licenseTypeName);
}
use of org.olat.core.commons.services.license.model.LicenseTypeImpl in project openolat by klemens.
the class DefaultModuleValues method createAndPersistPredefined.
private void createAndPersistPredefined(String name, String cssClass, String text) {
if (!licenseTypeDao.exists(name)) {
LicenseTypeImpl licenseType = (LicenseTypeImpl) licenseTypeDao.create(name);
licenseType.setCssClass(cssClass);
licenseType.setText(text);
licenseType.setPredefined(true);
licenseTypeDao.save(licenseType);
}
}
use of org.olat.core.commons.services.license.model.LicenseTypeImpl in project openolat by klemens.
the class LicenseTypeDAO method create.
LicenseType create(String name) {
LicenseTypeImpl licenseType = new LicenseTypeImpl();
Date now = new Date();
licenseType.setCreationDate(now);
licenseType.setLastModified(now);
licenseType.setName(name);
licenseType.setPredefined(false);
return licenseType;
}
use of org.olat.core.commons.services.license.model.LicenseTypeImpl in project openolat by klemens.
the class LicenseXStreamHelperTest method shouldConvertToXmlAndBack.
@Test
public void shouldConvertToXmlAndBack() {
String licensor = "licensor";
String freetext = "freetext";
String licenseTypeName = "licenseTypeName";
LicenseTypeImpl licenseType = new LicenseTypeImpl();
licenseType.setName(licenseTypeName);
LicenseImpl license = new LicenseImpl();
license.setLicensor(licensor);
license.setFreetext(freetext);
license.setLicenseType(licenseType);
LicenseXStreamHelper licenseXStreamHelper = new LicenseXStreamHelper();
String licenseAsXml = licenseXStreamHelper.toXml(license);
System.out.println(licenseAsXml);
License licenseFromXml = licenseXStreamHelper.licenseFromXml(licenseAsXml);
assertThat(licenseFromXml.getLicensor()).isEqualTo(licensor);
assertThat(licenseFromXml.getFreetext()).isEqualTo(freetext);
assertThat(licenseFromXml.getLicenseType().getName()).isEqualTo(licenseTypeName);
}
Aggregations