Search in sources :

Example 1 with EventView

use of uk.ac.ebi.spot.goci.curation.model.EventView 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)

Example 2 with EventView

use of uk.ac.ebi.spot.goci.curation.model.EventView 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;
}
Also used : ArrayList(java.util.ArrayList) AssociationEventView(uk.ac.ebi.spot.goci.curation.model.AssociationEventView) EventView(uk.ac.ebi.spot.goci.curation.model.EventView) Association(uk.ac.ebi.spot.goci.model.Association) AssociationEventView(uk.ac.ebi.spot.goci.curation.model.AssociationEventView) SingleNucleotidePolymorphism(uk.ac.ebi.spot.goci.model.SingleNucleotidePolymorphism) Event(uk.ac.ebi.spot.goci.model.Event) StringJoiner(java.util.StringJoiner)

Example 3 with EventView

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

the class StudyEventsViewService method createViews.

@Override
public List<EventView> createViews(Long trackableId) {
    List<EventView> views = new ArrayList<>();
    Collection<Event> events = studyRepository.findOne(trackableId).getEvents();
    events.forEach(event -> {
        String eventName = eventTypeService.translateEventByEventType(event.getEventType());
        EventView eventView = new StudyEventView(eventName, event.getEventDate(), trackableId, event.getUser().getEmail(), event.getEventDescription());
        views.add(eventView);
    });
    return views;
}
Also used : StudyEventView(uk.ac.ebi.spot.goci.curation.model.StudyEventView) ArrayList(java.util.ArrayList) Event(uk.ac.ebi.spot.goci.model.Event) StudyEventView(uk.ac.ebi.spot.goci.curation.model.StudyEventView) EventView(uk.ac.ebi.spot.goci.curation.model.EventView)

Aggregations

ArrayList (java.util.ArrayList)3 EventView (uk.ac.ebi.spot.goci.curation.model.EventView)3 Event (uk.ac.ebi.spot.goci.model.Event)2 StringJoiner (java.util.StringJoiner)1 AncestryEventView (uk.ac.ebi.spot.goci.curation.model.AncestryEventView)1 AssociationEventView (uk.ac.ebi.spot.goci.curation.model.AssociationEventView)1 StudyEventView (uk.ac.ebi.spot.goci.curation.model.StudyEventView)1 Ancestry (uk.ac.ebi.spot.goci.model.Ancestry)1 Association (uk.ac.ebi.spot.goci.model.Association)1 DeletedAncestry (uk.ac.ebi.spot.goci.model.DeletedAncestry)1 SingleNucleotidePolymorphism (uk.ac.ebi.spot.goci.model.SingleNucleotidePolymorphism)1