Search in sources :

Example 1 with I18nPhenomenonEntity

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

the class HibernatePredefinedInsertionHandler method convert.

private PhenomenonEntity convert(Phenomenon phenomenon) {
    PhenomenonEntity entity = new PhenomenonEntity();
    entity.setIdentifier(phenomenon.getIdentifier(), daoFactory.isStaSupportsUrls());
    entity.setName(phenomenon.getName());
    entity.setDescription(phenomenon.getDescription());
    if (phenomenon.hasTranslations()) {
        Set<I18nEntity<? extends Describable>> trans = new LinkedHashSet<>();
        phenomenon.getTranslations().forEach(i -> {
            I18nPhenomenonEntity i18n = new I18nPhenomenonEntity();
            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) I18nPhenomenonEntity(org.n52.series.db.beans.i18n.I18nPhenomenonEntity) Describable(org.n52.series.db.beans.Describable) I18nPhenomenonEntity(org.n52.series.db.beans.i18n.I18nPhenomenonEntity) PhenomenonEntity(org.n52.series.db.beans.PhenomenonEntity) I18nEntity(org.n52.series.db.beans.i18n.I18nEntity)

Aggregations

LinkedHashSet (java.util.LinkedHashSet)1 Describable (org.n52.series.db.beans.Describable)1 PhenomenonEntity (org.n52.series.db.beans.PhenomenonEntity)1 I18nEntity (org.n52.series.db.beans.i18n.I18nEntity)1 I18nPhenomenonEntity (org.n52.series.db.beans.i18n.I18nPhenomenonEntity)1