use of easytests.core.models.TopicModelInterface in project easy-tests by malinink.
the class TopicsController method delete.
@PostMapping("delete/{topicId}")
public String delete(Model model, @PathVariable("topicId") Integer topicId, @PathVariable("subjectId") Integer subjectId) {
final SubjectModelInterface subjectModel = getCurrentSubjectModel(subjectId, false);
final TopicModelInterface topicModel = getTopicModel(topicId, subjectId, topicsOptionsBuilder.forDelete());
if (questionsService.findByTopic(topicModel).isEmpty()) {
topicsService.delete(topicModel);
} else {
topicsService.delete(topicModel, this.topicsOptionsBuilder.forDelete());
}
return "redirect:/personal/subjects/" + subjectId + "/topics/";
}
use of easytests.core.models.TopicModelInterface in project easy-tests by malinink.
the class TopicsController method list.
@GetMapping("")
public String list(Model model, @PathVariable("subjectId") Integer subjectId) {
final SubjectModelInterface subjectModel = getCurrentSubjectModel(subjectId, true);
final List<TopicModelInterface> topics = subjectModel.getTopics();
model.addAttribute("topics", topics);
model.addAttribute("subjectId", subjectId);
return "topics/list";
}
use of easytests.core.models.TopicModelInterface in project easy-tests by malinink.
the class TopicsController method getTopicModel.
private TopicModelInterface getTopicModel(Integer id, Integer subjectId) {
final TopicsOptionsInterface topicsOptionsBuilder = this.topicsOptionsBuilder.forAuth();
final TopicModelInterface topicModel = this.topicsService.find(id, topicsOptionsBuilder);
checkModel(topicModel, subjectId);
return topicModel;
}
use of easytests.core.models.TopicModelInterface in project easy-tests by malinink.
the class TopicsController method deleteConfirmation.
@GetMapping("delete/{topicId}")
public String deleteConfirmation(Model model, @PathVariable("topicId") Integer topicId, @PathVariable("subjectId") Integer subjectId) {
final SubjectModelInterface subjectModel = getCurrentSubjectModel(subjectId, false);
final TopicModelInterface topicModel = this.getTopicModel(topicId, subjectId);
model.addAttribute("subjectId", subjectId);
return "topics/delete";
}
use of easytests.core.models.TopicModelInterface in project easy-tests by malinink.
the class TopicsService method map.
private TopicModelInterface map(TopicEntity topicEntity) {
if (topicEntity == null) {
return null;
}
final TopicModelInterface topicModel = new TopicModel();
topicModel.map(topicEntity);
return topicModel;
}
Aggregations