コード例 #1
0
  public boolean deleteExercise(TrainingExerciseModel model) {
    ArrayList<ExerciseSets> exerciseSets = exerciseSetsDao.getAllForExercise(model.getId());

    for (ExerciseSets set : exerciseSets) {
      exerciseSetsDao.delete(set.getId());
    }
    return trainingsExercisesDao.delete(model.getId());
  }
コード例 #2
0
  public boolean delete(TrainingModel model) {

    ArrayList<TrainingsExercises> allExercises =
        trainingsExercisesDao.getAllForTraining(model.getId());

    for (TrainingsExercises exercise : allExercises) {
      ArrayList<ExerciseSets> exerciseSets = exerciseSetsDao.getAllForExercise(exercise.getId());
      for (ExerciseSets exerciseSet : exerciseSets) {
        exerciseSetsDao.delete(exerciseSet.getId());
      }
      trainingsExercisesDao.delete(exercise.getId());
    }

    return trainingDao.delete(model.getId());
  }