Search in sources :

Example 1 with AncestryEventView

use of uk.ac.ebi.spot.goci.curation.model.AncestryEventView in project goci by EBISPOT.

the class AncestryEventsViewService method createViews.

@Override
public List<EventView> createViews(Long studyId) {
    List<EventView> views = new ArrayList<>();
    Collection<Ancestry> ancestryCollection = ancestryRepository.findByStudyId(studyId);
    List<DeletedAncestry> deletedAncestryCollection = deletedAncestryRepository.findByStudyId(studyId);
    if (!ancestryCollection.isEmpty()) {
        ancestryCollection.forEach(ancestry -> {
            ancestry.getEvents().forEach(event -> {
                String eventName = eventTypeService.translateEventByEventType(event.getEventType());
                EventView eventView = new AncestryEventView(eventName, event.getEventDate(), ancestry.getId(), event.getUser().getEmail(), createAncestrySummary(ancestry));
                views.add(eventView);
            });
        });
    }
    return views;
}
Also used : ArrayList(java.util.ArrayList) DeletedAncestry(uk.ac.ebi.spot.goci.model.DeletedAncestry) Ancestry(uk.ac.ebi.spot.goci.model.Ancestry) DeletedAncestry(uk.ac.ebi.spot.goci.model.DeletedAncestry) AncestryEventView(uk.ac.ebi.spot.goci.curation.model.AncestryEventView) AncestryEventView(uk.ac.ebi.spot.goci.curation.model.AncestryEventView) EventView(uk.ac.ebi.spot.goci.curation.model.EventView)

Aggregations

ArrayList (java.util.ArrayList)1 AncestryEventView (uk.ac.ebi.spot.goci.curation.model.AncestryEventView)1 EventView (uk.ac.ebi.spot.goci.curation.model.EventView)1 Ancestry (uk.ac.ebi.spot.goci.model.Ancestry)1 DeletedAncestry (uk.ac.ebi.spot.goci.model.DeletedAncestry)1