Search in sources :

Example 1 with TopicModel

use of easytests.core.models.TopicModel 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;
}
Also used : TopicModel(easytests.core.models.TopicModel) TopicModelInterface(easytests.core.models.TopicModelInterface)

Example 2 with TopicModel

use of easytests.core.models.TopicModel in project easy-tests by malinink.

the class TopicsController method create.

@PostMapping("create/")
public String create(Model model, @Valid @NotNull TopicDto topic, BindingResult bindingResult, @PathVariable("subjectId") Integer subjectId) {
    final SubjectModelInterface subjectModel = getCurrentSubjectModel(subjectId, false);
    if (bindingResult.hasErrors()) {
        setCreateBehaviour(model);
        model.addAttribute("topic", topic);
        model.addAttribute("subjectId", subjectId);
        model.addAttribute("errors", bindingResult);
        return "topics/form";
    }
    final TopicModelInterface topicModel = new TopicModel();
    topic.mapInto(topicModel);
    topicModel.setSubject(subjectModel);
    this.topicsService.save(topicModel);
    return "redirect:/personal/subjects/" + subjectId + "/topics/";
}
Also used : SubjectModelInterface(easytests.core.models.SubjectModelInterface) TopicModel(easytests.core.models.TopicModel) TopicModelInterface(easytests.core.models.TopicModelInterface) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 3 with TopicModel

use of easytests.core.models.TopicModel in project easy-tests by malinink.

the class TopicsServiceTest method mapTopicModel.

private TopicModelInterface mapTopicModel(TopicEntity topicEntity) {
    final TopicModelInterface topicModel = new TopicModel();
    topicModel.map(topicEntity);
    return topicModel;
}
Also used : TopicModel(easytests.core.models.TopicModel) TopicModelInterface(easytests.core.models.TopicModelInterface)

Aggregations

TopicModel (easytests.core.models.TopicModel)3 TopicModelInterface (easytests.core.models.TopicModelInterface)3 SubjectModelInterface (easytests.core.models.SubjectModelInterface)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1