CR

 
 
 
Сообщения:81
  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. @PreAuthorize("hasPermission(#topicDto.branch.id, 'BRANCH', 'BranchPermission.CREATE_CODE_REVIEW')")
     
    Julik сказал(а):
    111121
  6. public Topic createCodeReview(Topic topicDto, String bodyText,
  7. boolean notifyOnAnswers) throws NotFoundException {
  8. JCUser currentUser = userService.getCurrentUser();
  9.  
  10. currentUser.setPostCount(currentUser.getPostCount() + 1);
  11. Topic topic = new Topic(currentUser, topicDto.getTitle());
  12. Post first = new Post(currentUser, wrapWithCodeTag(bodyText));
     
    elle сказал(а):
    dddd
  13. topic.addPost(first);
  14. CodeReview codeReview = new CodeReview();
  15. codeReview.setTopic(topic);
  16. topic.setCodeReview(codeReview);
  17. Branch branch = topicDto.getBranch();
  18. branch.addTopic(topic);
  19. branch.setLastPost(first);
  20. branchDao.update(branch);
  21.  
  22. JCUser user = userService.getCurrentUser();
  23. securityService.createAclBuilder().grant(GeneralPermission.WRITE).to(user).on(topic).flush();
  24. securityService.createAclBuilder().grant(GeneralPermission.WRITE).to(user).on(first).flush();
  25.  
  26. notificationService.branchChanged(branch);
  27.  
  28. subscribeOnTopicIfNotificationsEnabled(notifyOnAnswers, topic, currentUser);
  29.  
  30. dao.update(topic);
  31. logger.debug("Created new code review topic id={}, branch id={}, author={}",
  32. new Object[]{topic.getId(), branch.getId(), currentUser.getUsername()});
  33. return topic;
  34. }
 
Модераторы:LuckysenleftgurookatAlisaTestPetraStillJulikigorss
Сейчас эту тему просматривают:Нет