use of uk.ac.ebi.spot.goci.curation.model.AssociationEventView in project goci by EBISPOT.
the class AssociationEventsViewService method createViews.
@Override
public List<EventView> createViews(Long studyId) {
List<EventView> views = new ArrayList<>();
Collection<Association> associations = studyRepository.findOne(studyId).getAssociations();
if (!associations.isEmpty()) {
// For each association gather up the events into a collection of views
associations.forEach(association -> {
Collection<Event> events = association.getEvents();
Long associationId = association.getId();
Collection<SingleNucleotidePolymorphism> snps = singleNucleotidePolymorphismRepository.findByRiskAllelesLociAssociationId(associationId);
String associationSummary;
StringJoiner snpJoiner = new StringJoiner(", ");
snps.forEach(singleNucleotidePolymorphism -> {
snpJoiner.add(singleNucleotidePolymorphism.getRsId());
});
associationSummary = snpJoiner.toString();
events.forEach(event -> {
String eventName = eventTypeService.translateEventByEventType(event.getEventType());
EventView eventView = new AssociationEventView(eventName, event.getEventDate(), associationId, event.getUser().getEmail(), associationSummary);
views.add(eventView);
});
});
}
return views;
}
Aggregations