public void delete(ProblemEntity problem) { for (String string : problem.getAnswers()) { AnswerEntity answerEntity = answerService.getAnswerByKey(string); answerService.delete(answerEntity); } persistenceManager.deletePersistent(problem); }
public boolean inDataBase(ProblemEntity problemEntity) { List<TestEntity> testEntities = testService.getTestes(); for (TestEntity testEntity : testEntities) { List<String> problemEntities = testEntity.getProblems(); for (String problemKey : problemEntities) { if (problemEntity.getKey().equals(problemKey)) { return true; } } } return false; }