public boolean delete(String resultID) { FittsResult result = this.findByResultID(resultID); if (result != null) { for (FittsStageResult stage : result.getStageResults()) { for (FittsTrackPath path : stage.getFittsTrackPaths()) { // Delete all Track events this.fittsTrackEventRepository.delete(path.getPath()); } // Delete all Track Paths this.fittsTrackPathRepository.delete(stage.getFittsTrackPaths()); } // Delete all Stage Results this.fittsStageResultRepository.delete(result.getStageResults()); // Delete link with user User user = userService.findUserWithResult(result); if (user != null) { user.getResults().remove(result); } // Delete Result this.fittsResultRepository.delete(result); return true; } return false; }
public void save(List<FittsResult> results) { for (FittsResult result : results) { for (FittsStageResult stage : result.getStageResults()) { for (FittsTrackPath path : stage.getFittsTrackPaths()) { // Save the events of the path to the database this.fittsTrackEventRepository.save(path.getPath()); } // Save the paths of the stage to the database this.fittsTrackPathRepository.save(stage.getFittsTrackPaths()); } // Save the stages of the test result to the database this.fittsStageResultRepository.save(result.getStageResults()); } // Save the test result to the database this.fittsResultRepository.save(results); }