Package org.jresearch.gossip.dao

Examples of org.jresearch.gossip.dao.ForumDAO


   */
  public ActionForward process(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws SystemException {
    ProcessTopicForm ptForm = (ProcessTopicForm) form;
    ForumDAO dao = ForumDAO.getInstance();
    UserDAO userdao = UserDAO.getInstance();
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
    int fid = Integer.parseInt(ptForm.getFid());
    int tid = Integer.parseInt(ptForm.getFid());
    try {
     
      Forum currForum = dao.getForumInfo(fid);
      //      check access rights if forum invisible
      if ((currForum.getLocked() == IConst.Forum.STATUS_INVISIBLE)
          && (user.getStatus() < Integer.parseInt(Configurator
              .getInstance().get(IConst.CONFIG.INVADER1)))) {
        return (mapping.findForward(IConst.TOKEN.DENIED));
      }
      request.setAttribute(IConst.REQUEST.CURR_FORUM, currForum);
      session.setAttribute(IConst.SESSION.CURR_FORUM, currForum);
      updateLastVisitTime((HashMap) session
          .getAttribute(IConst.SESSION.LAST_INTIME), ptForm.getTid(),
          dao.now());
      RecordsData recordsData = new RecordsData();
      Topic currThread = dao.getThreadInfo(tid);
      dao.fillMessagesList(user, recordsData, ptForm);
      Iterator it = recordsData.getRecords().iterator();
      boolean attachEnabled = Configurator.getInstance().getBoolean(
          IConst.CONFIG.ENABLE_FILE_UPLOAD);
      if (it.hasNext()) {
        Message mess = (Message) it.next();
        currThread.setSubject(mess.getHeading());
        mess.setSenderInfo(userdao.getSenderInfo(mess.getSender()));
        if (attachEnabled) {
          mess.setAttachments(dao.getAttachmentsInfo(mess.getId()));
        }
      } else {
        return (new ActionForward("/ShowForum.do?fid="
            + ptForm.getFid(), true));
      }
      while (it.hasNext()) {
        Message mess = (Message) it.next();
        mess.setSenderInfo(userdao.getSenderInfo(mess.getSender()));
        if (attachEnabled) {
          mess.setAttachments(dao.getAttachmentsInfo(mess.getId()));
        }
      }

      request.setAttribute(IConst.REQUEST.RECORDS_DATA, recordsData);
      request.setAttribute(IConst.REQUEST.CURR_THREAD, currThread);
      if (dao.checkMod(fid, user)) {
        request.setAttribute(IConst.REQUEST.MOD_FLAG,
            IConst.VALUES.TRUE);
      }
    } catch (SQLException sqle) {
      getServlet().log("Connection.process", sqle);
View Full Code Here


        HttpSession session = request.getSession();

        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);

        ListForm lform = (ListForm) form;
        ForumDAO dao = ForumDAO.getInstance();

        try {
           

            RecordsData recordsData = new RecordsData();
            dao.fillSubscriptionList(user, recordsData, lform.getBlock());
            request.setAttribute(IConst.REQUEST.RECORDS_DATA, recordsData);
        } catch (SQLException sqle) {
            getServlet().log("Connection.process", sqle);
            throw new SystemException(sqle);
        } catch (InstantiationException e) {
View Full Code Here

      HttpServletRequest request, HttpServletResponse response)
      throws SystemException {
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
    ProcessTopicForm ptForm = (ProcessTopicForm) form;
    ForumDAO dao = ForumDAO.getInstance();
    try {
      if (!dao.checkMod(Integer.parseInt(ptForm.getFid()), user)) {
        return (mapping.findForward(IConst.TOKEN.DENIED));
      }
     
      dao.deleteThread(ptForm.getTid(), true);
      log(request, "logs.LOG15", ptForm.getTid());
    } catch (SQLException sqle) {
      getServlet().log("Connection.process", sqle);
      throw new SystemException(sqle);
    }
View Full Code Here

        HttpServletRequest request, HttpServletResponse response)
        throws SystemException {
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        MessageResources messages = getResources(request);
        ForumDAO forumDAO = ForumDAO.getInstance();

        try {

            request.setAttribute(IConst.REQUEST.GROUPS_KEY,
                forumDAO.getGroups(user.getStatus(), true));
        } catch (SQLException sqle) {
            getServlet().log("Connection.process", sqle);
            throw new SystemException(sqle);
        }
View Full Code Here

public abstract class SaveRankAction extends BaseAction {

    protected ActionForward process(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws JGossipException {
        ForumDAO dao = ForumDAO.getInstance();
        RankForm rForm = (RankForm) form;
        try {
            int count = Integer.parseInt(rForm.getCount());
            int id = -1;
            try {
                id = Integer.parseInt(rForm.getId());
            } catch (NumberFormatException e) {
                id = -1;
            }
            List records = dao.getRankList();
            Iterator it = records.iterator();
            while (it.hasNext()) {
                RankInfoDTO curr = (RankInfoDTO) it.next();
                if (curr.getCount() == count && curr.getId() != id) {
                    ActionErrors errors = new ActionErrors();
View Full Code Here

   * @return DOCUMENT ME!
   */
  public ActionForward process(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws SystemException {
    ForumDAO dao = ForumDAO.getInstance();
    try {
     
      int[] wasDeleted = dao
          .dropOld(((DropOldMessForm) form).getIntime());
      log(request, "logs.LOG16");
      setStatusMessage(request, "mails.DONE", Integer
          .toString(wasDeleted[0]), Integer.toString(wasDeleted[1]));
    } catch (SQLException sqle) {
View Full Code Here

      HttpServletRequest request, HttpServletResponse response)
      throws SystemException {
    HttpSession session = request.getSession();
    MessageForm messageForm = new MessageForm();
    ProcessMessageForm pmForm = (ProcessMessageForm) form;
    ForumDAO dao = ForumDAO.getInstance();
    User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
    try {
     
      int fid = Integer.parseInt(pmForm.getFid());
      boolean isUserMod = dao.checkMod(fid, user);
      Forum currForum = dao.getForumInfo(fid);
      //      check access rights if forum invisible
      getServlet().log("check access rights if forum invisible");
      if ((currForum.getLocked() == IConst.Forum.STATUS_INVISIBLE)
          && (user.getStatus() < Integer.parseInt(Configurator
              .getInstance().get(IConst.CONFIG.INVADER1)))) {
        return (mapping.findForward(IConst.TOKEN.DENIED));
      }
      Topic currThread = dao.getThreadInfo(Integer.parseInt(pmForm
          .getTid()));
      // check user access rights if current topic or completely forum is
      // locked
      getServlet()
          .log(
              "check user access rights if current topic or completely forum is locked");
      if (((currThread.getLocked() == IConst.Topic.STATUS_LOCKED) || (currForum
          .getLocked() == IConst.Forum.STATUS_COMPLETELY_LOCKED))
          && (!isUserMod)) {
        return (mapping.findForward(IConst.TOKEN.DENIED));
      }
      session.setAttribute(IConst.REQUEST.CURR_THREAD, currThread);
      currThread.setSubject(dao.getThreadSubject(pmForm.getTid()));
      Message mess = dao.getMessage(pmForm.getMid());
      if (mess == null) {
        return (new ActionForward("/ShowThread.do?fid="
            + pmForm.getFid() + "&tid=" + pmForm.getTid()
            + "&block=" + pmForm.getBlock(), true));
      } else {
View Full Code Here

     * @return DOCUMENT ME!
     */
    public ActionForward process(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response)
        throws SystemException {
        ForumDAO dao = ForumDAO.getInstance();

        try {
           

            dao.addForum((ForumForm) form);

            log(request, "logs.LOG3", ((ForumForm) form).getForum_name());
        } catch (SQLException sqle) {
            getServlet().log("Connection.process", sqle);
            throw new SystemException(sqle);
View Full Code Here

      HttpServletRequest request, HttpServletResponse response)
      throws SystemException {
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
    ProcessTopicForm ptForm = (ProcessTopicForm) form;
    ForumDAO dao = ForumDAO.getInstance();
    try {
      if (!dao.checkMod(Integer.parseInt(ptForm.getFid()), user)) {
        return (mapping.findForward(IConst.TOKEN.DENIED));
      }
     
      dao.lockThread(ptForm.getTid());
      log(request, "logs.LOG21", ptForm.getTid());
    } catch (SQLException sqle) {
      getServlet().log("Connection.process", sqle);
      throw new SystemException(sqle);
    }
View Full Code Here

   *      javax.servlet.http.HttpServletResponse)
   */
  protected ActionForward process(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws JGossipException {
    ForumDAO dao = ForumDAO.getInstance();
    ProcessItemForm piForm = (ProcessItemForm) form;
    RankForm rForm;
    if (request.getAttribute("rankForm") == null) {
      try {
        RankInfoDTO info = dao.getRankInfo(Integer.parseInt(piForm
            .getId()));
        rForm = new RankForm();
        BeanUtils.copyProperties(rForm, info);
      } catch (SQLException e) {
        throw new SystemException(e);
View Full Code Here

TOP

Related Classes of org.jresearch.gossip.dao.ForumDAO

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.