Package ru.org.linux.topic

Examples of ru.org.linux.topic.Topic


   * @throws MessageNotFoundException если нет сообещния
   * @throws URIException если url неправильный
   */
  public String formatJump(TopicDao messageDao, boolean secure) throws MessageNotFoundException, URIException {
    if(_topic_id != -1) {
      Topic message = messageDao.getById(_topic_id);

      Group group = messageDao.getGroup(message);

      String scheme;
      if(secure) {
View Full Code Here


          @Nonnull StringBuilder out,
          @Nonnull LorURL url,
          @Nullable String linkText
  ) throws URIException {
    try {
      Topic message = messageDao.getById(url.getMessageId());

      boolean deleted = message.isDeleted();

      if (!deleted && url.isCommentUrl()) {
        Comment comment = commentService.getById(url.getCommentId());

        deleted = comment.isDeleted();
      }

      String urlTitle = linkText!=null?simpleFormat(linkText):StringUtil.escapeHtml(message.getTitle());

      String newUrlHref = url.formatJump(messageDao, secure);
      String fixedUrlBody = url.formatUrlBody(maxLength);

      if (deleted) {
View Full Code Here

})
  public ModelAndView showEditInfo(
    HttpServletRequest request,
    @PathVariable("id") int msgid
  ) throws Exception {
    Topic message = messageDao.getById(msgid);
    Template tmpl = Template.getTemplate(request);
    Group group = groupDao.getGroup(message.getGroupId());

    topicPermissionService.checkView(group, message, tmpl.getCurrentUser(), false);

    List<PreparedEditHistory> editHistories = editHistoryService.prepareEditInfo(message, request.isSecure());
View Full Code Here

  public ModelAndView showCommentEditInfo(
    HttpServletRequest request,
    @PathVariable("id") int msgid,
    @PathVariable("commentid") int commentId
  ) throws Exception {
    Topic message = messageDao.getById(msgid);
    Comment comment =  commentService.getById(commentId);

    List<PreparedEditHistory> editHistories = editHistoryService.prepareEditInfo(comment, request.isSecure());

    ModelAndView modelAndView = new ModelAndView("history");
View Full Code Here

    return !msg.isDeleted() && !msg.isDraft();
  }

  private void reindexMessage(int msgid, boolean withComments) throws MessageNotFoundException {
    Topic msg = topicDao.getById(msgid);

    if (isTopicVisible(msg)) {
      updateMessage(msg);

      if (withComments) {
        CommentList commentList = commentService.getCommentList(msg, true);

        reindexComments(msg, commentList);
      }
    } else {
      client
              .prepareDelete(MESSAGES_INDEX, MESSAGES_TYPE, Integer.toString(msg.getId()))
              .execute()
              .actionGet();

      if (withComments) {
        ImmutableList<Comment> comments = commentService.getCommentList(msg, true).getList();
View Full Code Here

      Comment comment = commentService.getById(msgid);

      // комментарии могут быть из разного топика в функция массового удаления
      // возможно для скорости нужен какой-то кеш топиков, т.к. чаще бывает что все
      // комментарии из одного топика
      Topic topic = topicDao.getById(comment.getTopicId());

      if (!isTopicVisible(topic) || comment.isDeleted()) {
        logger.info("Deleting comment " + comment.getId());
        bulkRequest.add(client.prepareDelete(MESSAGES_INDEX, MESSAGES_TYPE, Integer.toString(comment.getId())));
      } else {
View Full Code Here

  public void init() throws Exception {

    URI mainURI = new URI("http://www.linux.org.ru/", true, "UTF-8");

    TopicDao messageDao = mock(TopicDao.class);
    Topic message1 = mock(Topic.class);
    Group group1 = mock(Group.class);
    Topic message2 = mock(Topic.class);
    Group group2 = mock(Group.class);
    Topic message3 = mock(Topic.class);
    Group group3 = mock(Group.class);
    Topic message12 = mock(Topic.class);
    Group group12 = mock(Group.class);
    Topic message15 = mock(Topic.class);
    Group group15 = mock(Group.class);
    Topic messageHistory = mock(Topic.class);
    Group groupHistory = mock(Group.class);
    CommentService commentService = mock(CommentService.class);

    Comment comment = mock(Comment.class);

    when(message1.getTitle()).thenReturn("привет1");
    when(message2.getTitle()).thenReturn("привет2");
    when(message3.getTitle()).thenReturn("привет3");
    when(message12.getTitle()).thenReturn("привет12");
    when(message15.getTitle()).thenReturn("привет15");
    when(messageHistory.getTitle()).thenReturn("привет история");
    when(group1.getUrl()).thenReturn("/news/debian/");
    when(group2.getUrl()).thenReturn("/forum/talks/");
    when(group3.getUrl()).thenReturn("/forum/general/");
    when(group12.getUrl()).thenReturn("/forum/security/");
    when(group15.getUrl()).thenReturn("/forum/linux-org-ru/");
View Full Code Here

   * TODO пару тройку ResultSet для разных классов и сами классы
   */
  @Test
  public void prepareMessageTest() {
    ImmutableList<String> tags = ImmutableList.of("one", "two");
    Topic message = mock(Topic.class);

    PollDao pollDao = mock(PollDao.class);
    GroupDao groupDao = mock(GroupDao.class);
    UserDao userDao = mock(UserDao.class);
    SectionDao sectionDao = mock(SectionDaoImpl.class);
    DeleteInfoDao deleteInfoDao = mock(DeleteInfoDao.class);
    TopicDao messageDao = mock(TopicDao.class);
    UserAgentDao userAgentDao = mock(UserAgentDao.class);

    when(message.getGroupId()).thenReturn(13); // group id 13

  }
View Full Code Here

TOP

Related Classes of ru.org.linux.topic.Topic

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.