package eu.dnetlib.uoamonitorservice.entities; import eu.dnetlib.uoamonitorservice.dto.SubCategoryFull; import eu.dnetlib.uoamonitorservice.generics.Common; import eu.dnetlib.uoamonitorservice.generics.SubCategoryGeneric; import org.springframework.data.mongodb.core.mapping.Document; import java.util.Objects; import java.util.stream.Collectors; @Document public class SubCategory extends SubCategoryGeneric { public SubCategory() {} public SubCategory(SubCategoryFull subCategory) { super(subCategory); this.numbers = subCategory.getNumbers().stream().map(Common::getId).collect(Collectors.toList()); this.charts = subCategory.getCharts().stream().map(Common::getId).collect(Collectors.toList()); this.numbers.removeIf(Objects::isNull); this.charts.removeIf(Objects::isNull); } }