Search in sources :

Example 1 with DeletedAncestry

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

the class StudyAncestryService method deleteAncestry.

private void deleteAncestry(Ancestry ancestry, SecureUser user) {
    getLog().warn("Deleting ancestry: ".concat(String.valueOf(ancestry.getId())));
    // Add deletion event
    trackingOperationService.delete(ancestry, user);
    DeletedAncestry deletedAncestry = createDeletedAncestry(ancestry);
    // Delete ancestry
    ancestryRepository.delete(ancestry);
    // Save deleted details
    getLog().info("Saving details of deleted ancestry: ".concat(String.valueOf(deletedAncestry.getId())));
    deletedAncestryRepository.save(deletedAncestry);
}
Also used : DeletedAncestry(uk.ac.ebi.spot.goci.model.DeletedAncestry)

Example 2 with DeletedAncestry

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

DeletedAncestry (uk.ac.ebi.spot.goci.model.DeletedAncestry)2 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