/** {@inheritDoc} */ @Override @PreAuthorize("hasPermission(#postId, 'org.jtalks.jcommune.model.entity.Post', admin)") public void updatePost(long postId, String postContent) throws NotFoundException { Post post = get(postId); post.setPostContent(postContent); post.updateModificationDate(); this.getDao().update(post); logger.debug("Post id={} updated.", post.getId()); }
/** {@inheritDoc} */ @Override @PreAuthorize( "hasPermission(#postId, 'org.jtalks.jcommune.model.entity.Post', admin) or " + "hasPermission(#postId, 'org.jtalks.jcommune.model.entity.Post', delete)") public void deletePost(long postId) throws NotFoundException { Post post = get(postId); Topic topic = post.getTopic(); topic.removePost(post); topicDao.update(topic); securityService.deleteFromAcl(post); logger.debug("Deleted post id={}", postId); }