34 lines
918 B
Java
34 lines
918 B
Java
package eu.dnetlib.uoamonitorservice.entities;
|
|
|
|
import eu.dnetlib.uoamonitorservice.dto.StakeholderFull;
|
|
import eu.dnetlib.uoamonitorservice.generics.Common;
|
|
import eu.dnetlib.uoamonitorservice.generics.StakeholderGeneric;
|
|
import org.springframework.data.mongodb.core.mapping.Document;
|
|
|
|
import java.util.HashSet;
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
import java.util.stream.Collectors;
|
|
|
|
@Document
|
|
public class Stakeholder extends StakeholderGeneric<String> {
|
|
|
|
public Stakeholder() {
|
|
super();
|
|
}
|
|
|
|
public Stakeholder(StakeholderFull stakeholder) {
|
|
super(stakeholder);
|
|
this.topics = stakeholder.getTopics().stream().map(Common::getId).collect(Collectors.toList());
|
|
this.topics.removeIf(Objects::isNull);
|
|
}
|
|
|
|
public void addTopic(String id) {
|
|
this.topics.add(id);
|
|
}
|
|
|
|
public void removeTopic(String id) {
|
|
this.topics.remove(id);
|
|
}
|
|
}
|