CR

 
 
 
Сообщения:81
/**
     * {@inheritDoc}
     */
    @Override
    @PreAuthorize("hasPermission(#topicDto.branch.id, 'BRANCH', 'BranchPermission.CREATE_CODE_REVIEW')")
    public Topic createCodeReview(Topic topicDto, String bodyText,
                             boolean notifyOnAnswers) throws NotFoundException {
        JCUser currentUser = userService.getCurrentUser();

        currentUser.setPostCount(currentUser.getPostCount() + 1);
        Topic topic = new Topic(currentUser, topicDto.getTitle());
        Post first = new Post(currentUser, wrapWithCodeTag(bodyText));
        topic.addPost(first);
        CodeReview codeReview = new CodeReview();
        codeReview.setTopic(topic);
        topic.setCodeReview(codeReview);
        
        Branch branch = topicDto.getBranch();
        branch.addTopic(topic);
        branch.setLastPost(first);
        branchDao.update(branch);

        JCUser user = userService.getCurrentUser();
        securityService.createAclBuilder().grant(GeneralPermission.WRITE).to(user).on(topic).flush();
        securityService.createAclBuilder().grant(GeneralPermission.WRITE).to(user).on(first).flush();

        notificationService.branchChanged(branch);

        subscribeOnTopicIfNotificationsEnabled(notifyOnAnswers, topic, currentUser);

        dao.update(topic);
        logger.debug("Created new code review topic id={}, branch id={}, author={}",
                new Object[]{topic.getId(), branch.getId(), currentUser.getUsername()});
        return topic;
    }
 
Модераторы:LuckysenleftgurookatAlisaTestPetraStillJulikigorss
Сейчас эту тему просматривают:Нет