Search in sources :

Example 1 with LicenseImpl

use of org.olat.core.commons.services.license.model.LicenseImpl 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);
}
Also used : License(org.olat.core.commons.services.license.License) LicenseTypeImpl(org.olat.core.commons.services.license.model.LicenseTypeImpl) LicenseImpl(org.olat.core.commons.services.license.model.LicenseImpl) Test(org.junit.Test)

Example 2 with LicenseImpl

use of org.olat.core.commons.services.license.model.LicenseImpl 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);
}
Also used : License(org.olat.core.commons.services.license.License) LicenseTypeImpl(org.olat.core.commons.services.license.model.LicenseTypeImpl) LicenseImpl(org.olat.core.commons.services.license.model.LicenseImpl) Test(org.junit.Test)

Example 3 with LicenseImpl

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

the class LicenseServiceImpl method createLicense.

@Override
public License createLicense(LicenseType licenseType) {
    License license = new LicenseImpl();
    license.setLicenseType(licenseType);
    return license;
}
Also used : License(org.olat.core.commons.services.license.License) ResourceLicense(org.olat.core.commons.services.license.ResourceLicense) LicenseImpl(org.olat.core.commons.services.license.model.LicenseImpl)

Example 4 with LicenseImpl

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

the class LicenseServiceImpl method createDefaultLicense.

@Override
public License createDefaultLicense(LicenseHandler handler, Identity licensor) {
    LicenseType defautlLicenseType = getDefaultLicenseType(handler);
    String licensorName = licensorFactory.create(handler, licensor);
    License license = new LicenseImpl();
    license.setLicenseType(defautlLicenseType);
    license.setLicensor(licensorName);
    return license;
}
Also used : License(org.olat.core.commons.services.license.License) ResourceLicense(org.olat.core.commons.services.license.ResourceLicense) LicenseType(org.olat.core.commons.services.license.LicenseType) LicenseImpl(org.olat.core.commons.services.license.model.LicenseImpl)

Example 5 with LicenseImpl

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

the class LicenseServiceImpl method createDefaultLicense.

@Override
public License createDefaultLicense(LicenseHandler handler, Identity licensor) {
    LicenseType defautlLicenseType = getDefaultLicenseType(handler);
    String licensorName = licensorFactory.create(handler, licensor);
    License license = new LicenseImpl();
    license.setLicenseType(defautlLicenseType);
    license.setLicensor(licensorName);
    return license;
}
Also used : License(org.olat.core.commons.services.license.License) ResourceLicense(org.olat.core.commons.services.license.ResourceLicense) LicenseType(org.olat.core.commons.services.license.LicenseType) LicenseImpl(org.olat.core.commons.services.license.model.LicenseImpl)

Aggregations

License (org.olat.core.commons.services.license.License)6 LicenseImpl (org.olat.core.commons.services.license.model.LicenseImpl)6 ResourceLicense (org.olat.core.commons.services.license.ResourceLicense)4 Test (org.junit.Test)2 LicenseType (org.olat.core.commons.services.license.LicenseType)2 LicenseTypeImpl (org.olat.core.commons.services.license.model.LicenseTypeImpl)2