public Question updateQuestion(SocialUser loginUser, QuestionDto questionDto) { Assert.notNull(loginUser, "loginUser should be not null!"); Assert.notNull(questionDto, "question should be not null!"); Question question = questionRepository.findOne(questionDto.getQuestionId()); Set<Tag> tags = tagService.processTags(questionDto.getPlainTags()); question.update(loginUser, questionDto.getTitle(), questionDto.getContents(), tags); return question; }
@RequestMapping("/search") public @ResponseBody List<TagForm> searchByTagName(String name) { logger.debug("search tag by name : {}", name); List<Tag> searchedTags = tagService.findsBySearch(name); List<TagForm> tags = new ArrayList<TagForm>(); for (Tag tag : searchedTags) { tags.add(new TagForm(tag.getName())); } return tags; }
public Question createQuestion(SocialUser loginUser, QuestionDto questionDto) { Assert.notNull(loginUser, "loginUser should be not null!"); Assert.notNull(questionDto, "question should be not null!"); Set<Tag> tags = tagService.processTags(questionDto.getPlainTags()); Question newQuestion = new Question(loginUser, questionDto.getTitle(), questionDto.getContents(), tags); Question savedQuestion = questionRepository.saveAndFlush(newQuestion); if (questionDto.isConnected()) { log.info("firing sendMessageToFacebook!"); facebookService.sendToQuestionMessage(loginUser, savedQuestion.getQuestionId()); } return savedQuestion; }
public String tags(Integer page, ModelMap model) throws Exception { model.addAttribute("tags", tagService.findPooledTags(createPageable(page))); model.addAttribute("parentTags", tagService.findPooledTags()); return "tags/tags"; }