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);
}
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;
}
Aggregations