Search in sources :

Example 1 with I18nUnitEntity

use of org.n52.series.db.beans.i18n.I18nUnitEntity in project SOS by 52North.

the class HibernatePredefinedInsertionHandler method convert.

private UnitEntity convert(Unit unit) {
    UnitEntity entity = new UnitEntity();
    entity.setSymbol(unit.getSymbol(), getDaoFactory().isStaSupportsUrls());
    entity.setName(unit.getName());
    entity.setLink(unit.getLink());
    if (unit.hasTranslations()) {
        Set<I18nEntity<? extends Describable>> trans = new LinkedHashSet<>();
        unit.getTranslations().forEach(i -> {
            I18nUnitEntity i18n = new I18nUnitEntity();
            i18n.setLocale(i.getLocale());
            i18n.setName(i.getName());
            i18n.setDescription(i.getDescription());
            trans.add(i18n);
        });
        entity.setTranslations(trans);
    }
    return entity;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Describable(org.n52.series.db.beans.Describable) I18nUnitEntity(org.n52.series.db.beans.i18n.I18nUnitEntity) I18nUnitEntity(org.n52.series.db.beans.i18n.I18nUnitEntity) UnitEntity(org.n52.series.db.beans.UnitEntity) I18nEntity(org.n52.series.db.beans.i18n.I18nEntity)

Aggregations

LinkedHashSet (java.util.LinkedHashSet)1 Describable (org.n52.series.db.beans.Describable)1 UnitEntity (org.n52.series.db.beans.UnitEntity)1 I18nEntity (org.n52.series.db.beans.i18n.I18nEntity)1 I18nUnitEntity (org.n52.series.db.beans.i18n.I18nUnitEntity)1