Package ru.org.linux.site

Examples of ru.org.linux.site.MessageNotFoundException


  public Comment getById(int id) throws MessageNotFoundException {
    Comment comment;
    try {
      comment = jdbcTemplate.queryForObject(queryCommentById, (resultSet, i) -> new Comment(resultSet), id);
    } catch (EmptyResultDataAccessException exception) {
      throw new MessageNotFoundException(id);
    }
    return comment;
  }
View Full Code Here


  public List<Comment> getCommentsSubtree(int parentId) throws MessageNotFoundException {
    CommentNode parentNode = comments.getNode(parentId);

    if (parentNode==null) {
      throw new MessageNotFoundException(parentId);
    }

    List<Comment> parentList = new ArrayList<>();
    parentNode.buildList(parentList);
View Full Code Here

          return new Topic(resultSet);
        }
      }, id);
    } catch (EmptyResultDataAccessException exception) {
      //noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException
      throw new MessageNotFoundException(id);
    }
    return message;
  }
View Full Code Here

    if (!group.getUrlName().equals(groupName) || group.getSectionId() != section.getId()) {
      return new ModelAndView(new RedirectView(topic.getLink()+"?output=rss"));
    }

    if (topic.isExpired()) {
      throw new MessageNotFoundException(topic.getId(), "no more comments");
    }

    User currentUser = AuthUtil.getCurrentUser();

    permissionService.checkView(group, topic, currentUser, false);
View Full Code Here

      node = comments.getNode(cid);
      deleted = true;
    }

    if (node == null) {
      throw new MessageNotFoundException(topic, cid, "Сообщение #" + cid + " было удалено или не существует");
    }

    int pagenum = deleted?0:comments.getCommentPage(node.getComment(), tmpl.getProf());

    TopicLinkBuilder redirectUrl =
View Full Code Here

    if (currentUser!=null && currentUser.isModerator()) {
      return;
    }

    if (message.isExpired() && showDeleted) {
      throw new MessageNotFoundException(message.getId(), "нельзя посмотреть удаленные комментарии в устаревших темах");
    }

    boolean unauthorized = currentUser == null || currentUser.isAnonymous();
    boolean topicAuthor = currentUser!=null && currentUser.getId() == message.getUid();

    if (message.isDeleted()) {
      if (message.isExpired()) {
        throw new MessageNotFoundException(message.getId(), "нельзя посмотреть устаревшие удаленные сообщения");
      }

      if (unauthorized) {
        throw new MessageNotFoundException(message.getId(), "Сообщение удалено");
      }

      if (topicAuthor) {
        return;
      }

      if (currentUser.getScore() < VIEW_DELETED_SCORE) {
        throw new MessageNotFoundException(message.getId(), "Сообщение удалено");
      }
    }

    if (message.isDraft()) {
      if (message.isExpired()) {
        throw new MessageNotFoundException(message.getId(), "Черновик устарел");
      }

      if (!topicAuthor) {
        throw new MessageNotFoundException(message.getId(), "Нельзя посмотреть чужой черновик");
      }
    }

    if (group.getCommentsRestriction() == -1 && unauthorized) {
      throw new AccessViolationException("Это сообщение нельзя посмотреть");
View Full Code Here

    Section section = sectionService.getSection(group.getSectionId());

    if (!section.getUrlName().equals(sectionName)
            || !group.getUrlName().equals(groupName)
            || page<0 ) {
      throw new MessageNotFoundException(msgid);
    }

    permissionService.checkView(group, topic, AuthUtil.getCurrentUser(), false);

    CommentList comments = commentService.getCommentList(topic, false);
View Full Code Here

      );

      if (!rs.next()) {
        rs = jdbcTemplate.queryForRowSet("SELECT postip, ua_id FROM comments WHERE id=?", msgid);
        if (!rs.next()) {
          throw new MessageNotFoundException(msgid);
        }
      }

      ip = rs.getString("postip");
      userAgentId = rs.getInt("ua_id");
View Full Code Here

TOP

Related Classes of ru.org.linux.site.MessageNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.