Package org.nemesis.forum.webapp.admin.bean

Examples of org.nemesis.forum.webapp.admin.bean.MessageBean


        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);

      }
      request.setAttribute("tbs", tbs);
View Full Code Here


      checkPermission(request, OperationConstants.EDIT_MESSAGE,forum);

     
      //first, populate
      if (request.getParameter("messageBean.subject") == null) {
        MessageBean mb = new MessageBean();
        Message m =forum.getThread(Integer.parseInt(request.getParameter("threadID"))).getMessage(Integer.parseInt(request.getParameter("messageID")));

       
        mb.setForumID( Integer.parseInt(request.getParameter("id")));
        mb.setThreadID( Integer.parseInt(request.getParameter("threadID")));
        mb.setMessageID( m.getID());
        mb.setSubject( m.getSubject());
        mb.setContent( m.getBody());
       
        PropertyUtils.setProperty(form, "messageBean", mb);
        return mapping.findForward("view");
      }
     
      //save
      MessageBean mb = (MessageBean) PropertyUtils.getSimpleProperty(form, "messageBean");
      Message m =forum.getThread(mb.getThreadID()).getMessage(mb.getMessageID());
      m.setSubject(mb.getSubject());
      m.setBody(mb.getContent());
     

    } catch (NumberFormatException aee) {
      errors.add("general"new ActionError("editMessage.unauthorized"));
     
View Full Code Here

  /**
   * Recursive method to populate.
   */
  private void populate(TreeWalker walker, ThreadBean tb, Message message, int depth) {
   
    MessageBean mb=new MessageBean();
    mb.setDepth(depth);
    mb.setAnonymous(message.isAnonymous());
    mb.setApproved(message.isApproved());
    mb.setContent(message.getBody());
    mb.setCreationDate(message.getCreationDate());
    mb.setMessageID(message.getID());
    mb.setModifiedDate(message.getModifiedDate());
    mb.setSubject(message.getSubject());

   
    UserBean ub = new UserBean();
    if(!message.isAnonymous()){

      User messageUser = message.getUser();
      ub.setId(messageUser.getID());
      ub.setUserName(messageUser.getUsername());
      ub.setName(messageUser.getName());
      ub.setEmail(messageUser.getEmail());
 
    }else{
      //:NOTE: we suppose in front application : name & email message property for anonymous user
      ub.setUserName(message.getProperty("name"));
      ub.setEmail(message.getProperty("email"));
    }

    mb.setAuthor(ub);
    //add message
    tb.addMessagesTree(mb);
   
    //children
    for (int i = 0; i < walker.getChildCount(message); i++) {
View Full Code Here

TOP

Related Classes of org.nemesis.forum.webapp.admin.bean.MessageBean

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.