Package org.nemesis.forum

Examples of org.nemesis.forum.Message


  public Forum getForum() {
    return forum;
  }

  public Message getMessage(int messageID) throws ForumMessageNotFoundException {
    Message message = factory.getMessage(messageID);

    //Apply filters to message.
    message = forum.applyFilters(message);
    return message;
  }
View Full Code Here


    //Recursively delete all children
    TreeWalker walker = treeWalker();
    int childCount = walker.getChildCount(message);
    for (int i = childCount - 1; i >= 0; i--) {
      Message childMessage = walker.getChild(message, i);
      if (childMessage == null) {
        log.error("child message was null -- index " + i);
      }
      deleteMessage(childMessage);
    }
View Full Code Here

    // Move the children of this message to the new thread
    TreeWalker walker = treeWalker();
    int childCount = walker.getChildCount(message);
    for (int i = 0; i < childCount; i++) {
      Message childMessage = walker.getChild(message, i);
      changeMessageThread(childMessage, newThread);
    }

    //Move the message to the new thread.
    changeMessageThread(message, newThread);
View Full Code Here

      log.error("",sqle);
    }

    // Add message back to search index and update modified date
    try {
      Message movedMessage = newThread.getMessage(key.intValue());
      //factory.getSearchIndexer().addToIndex(movedMessage);
      movedMessage.setModifiedDate(new Date());
    } catch (ForumMessageNotFoundException e) {
      log.error(
        "Error in DbForumThread:changeMessageThread()-"
          + "messageID="
          + key.intValue()
View Full Code Here

   * @param parent the parent message.
   * @param index the index of the child.
   * @returns the child of parent at index.
   */
  public Message getChild(Message parent, int index) {
    Message message = null;
    Connection con = null;
    PreparedStatement pstmt = null;
    try {
      con = DbConnectionManager.getConnection();
      if(filter){
View Full Code Here

  public int getRecursiveChildCount(Message parent) {
    int numChildren = 0;
    int num = getChildCount(parent);
    numChildren += num;
    for (int i = 0; i < num; i++) {
      Message child = getChild(parent, i);
      if (child != null) {
        numChildren += getRecursiveChildCount(child);
      }
    }
    return numChildren;
View Full Code Here

        tb.setApproved(currentThread.isApproved());
        tb.setNotApprovedMessages(currentThread.getMessageCount(false));
        tb.setReplies(currentThread.getMessageCount() - 1);
        tb.setTopic(currentThread.getName());

        Message rootMessage = currentThread.getRootMessage();
        MessageBean mb = new MessageBean();
        mb.setAnonymous(rootMessage.isAnonymous());
       
        UserBean ub = new UserBean();
        if(!rootMessage.isAnonymous()){
       
          User rootMessageUser = rootMessage.getUser();
          ub.setId(rootMessageUser.getID());
          ub.setUserName(rootMessageUser.getUsername());
          ub.setName(rootMessageUser.getName());
          ub.setEmail(rootMessageUser.getEmail());
         
        }else{
          //:NOTE: we suppose in front application : name & email message property for anonymous user
          ub.setUserName(rootMessage.getProperty("name"));
          ub.setEmail(rootMessage.getProperty("email"));
        }
       
        mb.setAuthor(ub);
        tb.setRootMessage(mb);
        tbs.add(tb);
View Full Code Here

        Forum forum = forumFactory.getForum(Integer.parseInt(request.getParameter("id")));
        //check permission
        checkPermission(request,OperationConstants.LIST_FORUM_CONTENT,forum);
       
        ForumThread t=forum.getThread(Integer.parseInt(request.getParameter("threadID")));
        Message m=t.getMessage(Integer.parseInt(request.getParameter("messageID")));
        m.setApproved(!m.isApproved());
        if (t.getRootMessage().getID()==m.getID()) t.setApproved(m.isApproved());
       
       
    } catch (Exception e) {
      String eid=this.getClass().getName()+"_"+System.currentTimeMillis();
      log.error("eid:"+eid +"\nsessionID" +request.getSession().getId(),e;     
View Full Code Here

  public MessageIteratorProxy(Iterator iterator, Authorization authorization, ForumPermissions permissions) {
    super(iterator, authorization, permissions);
  }

  public Object next() throws NoSuchElementException {
    Message message = (Message) iterator.next();
    return new MessageProxy(message, authorization, permissions);
  }
View Full Code Here

    this.authorization = authorization;
    this.permissions = permissions;
  }

  public Message getRoot() {
    Message message = treeWalker.getRoot();
    return new MessageProxy(message, authorization, permissions);
  }
View Full Code Here

TOP

Related Classes of org.nemesis.forum.Message

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.