Package org.jresearch.gossip.dao

Examples of org.jresearch.gossip.dao.ForumDAO


    protected ActionForward process(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws JGossipException {
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        ForumDAO dao = ForumDAO.getInstance();
        AttachmentInfoForm aiForm = (AttachmentInfoForm) form;
       
        try {
            boolean isUserMod = dao.checkMod(Integer.parseInt(aiForm.getFid()),
                    user);
            //          check user access rights
            getServlet().log("check user access rights ");
            if (isUserMod) {
                FileDataInfo fInfo = new FileDataInfo();
                BeanUtils.copyProperties(fInfo, aiForm);
                dao.updateAttachmentInfo(fInfo);
            } else {
                return (mapping.findForward(IConst.TOKEN.DENIED));
            }

        } catch (NumberFormatException e) {
View Full Code Here


        HttpServletRequest request, HttpServletResponse response)
        throws SystemException {
        HttpSession session = request.getSession();
        MessageForm messageForm = (MessageForm) form;
        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        ForumDAO dao = ForumDAO.getInstance();

        try {
           

            boolean isUserMod = dao.checkMod(Integer.parseInt(
                        messageForm.getFid()), user);
            Forum currForum = dao.getForumInfo(Integer.parseInt(
                        messageForm.getFid()));

            //      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(
                        messageForm.getTid()));

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

            Message mess = dao.getMessage(messageForm.getMid());
            session.removeAttribute(IConst.REQUEST.CURR_THREAD);

            if (mess == null) {
                return (new ActionForward("/ShowThread.do?fid=" +
                    messageForm.getFid() + "&tid=" + messageForm.getTid() +
                    "&block=" + messageForm.getBlock(), true));
            } else {
                // check user access rights
                if (dao.checkMod(Integer.parseInt(messageForm.getFid()), user) ||
                        (user.getName().equals(mess.getSender()) &&
                        (currThread.getLocked() == IConst.Topic.STATUS_UNLOCKED))) {
                    dao.updateMessage(messageForm);

                    //subscribe user to e-mail from this thread...
                    if (IConst.VALUES.TRUE.equals(messageForm.getSubscribe())) {
                        dao.subscribe(messageForm.getTid(),
                            user.getInfo().getEmail(), user.getName());
                    }

                    log(request, "logs.LOG28",
                        " mid=" + messageForm.getMid() + " tid=" +
View Full Code Here

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

        if (((ForumForm) form).getForumid().equals("")) {
            errors.add(ActionErrors.GLOBAL_ERROR,
                new ActionError("errors.required", "forum ID"));
        }

        if (!errors.isEmpty()) {
            saveErrors(request, errors);

            return (mapping.getInputForward());
        }

        try {
           

            dao.updateForum((ForumForm) form);

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

    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        ForumDAO dao = ForumDAO.getInstance();
        ProcessAttachForm paForm = (ProcessAttachForm) form;
        if (Configurator.getInstance().getBoolean(
                IConst.CONFIG.ENABLE_FILE_UPLOAD)) {
            FileData fData = dao
                    .getAttachment(Integer.parseInt(paForm.getId()));
            String mime = fData.getInfo().getContentType();
            response.setContentType(mime);
            if (!(IConst.JSP.JPG_CONTENT_TYPE.equals(mime)
                    || IConst.JSP.GIF_CONTENT_TYPE.equals(mime) || IConst.JSP.PNG_CONTENT_TYPE
View Full Code Here

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

                if (user != null) {
                    //  check that this user(or session) was not kicked by admin
                    ForumDAO dao = ForumDAO.getInstance();

                    try {

                        if (!dao.isEntryExist(session.getId())) {
                            application.log("AutoLoginFilter: Entry for login="
                                    + user.getName()
                                    + " not found - User is removed  ");
                            session.removeAttribute(IConst.SESSION.USER_KEY);
                            user = null;
View Full Code Here

    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        ForumDAO dao = ForumDAO.getInstance();
        ProcessAttachForm paForm = (ProcessAttachForm) form;
       
        try {
            boolean isUserMod = dao.checkMod(Integer.parseInt(paForm.getFid()),
                    user);
            //          check user access rights
            getServlet().log("check user access rights ");
            if (isUserMod) {
                dao.removeAttachment(Integer.parseInt(paForm.getId()));
            } else {
                return (mapping.findForward(IConst.TOKEN.DENIED));
            }

        } catch (NumberFormatException e) {
View Full Code Here

    public ActionForward process(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response)
        throws SystemException {
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        ForumDAO dao = ForumDAO.getInstance();
        RecordsData recordsData = new RecordsData();
        UserDAO userdao = UserDAO.getInstance();

        try {
            dao.processSearch((SearchForm) form, recordsData,
                user.getStatus() > 7);

            Iterator it = recordsData.getRecords().iterator();

            while (it.hasNext()) {
View Full Code Here

    protected ActionForward process(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws JGossipException {
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        ForumDAO dao = ForumDAO.getInstance();
        ProcessAttachForm paForm = (ProcessAttachForm) form;
       
        try {
            boolean isUserMod = dao.checkMod(Integer.parseInt(paForm.getFid()),
                    user);
            //          check user access rights
            getServlet().log("check user access rights ");
            if (isUserMod) {
                if(request.getAttribute("attachmentInfoForm")!=null){
                    return mapping.findForward(IConst.TOKEN.PAGE);
                }
                FileDataInfo fInfo = dao.getAttachmentInfo(Integer
                        .parseInt(paForm.getId()));
                if (fInfo == null) {
                    StringBuffer forward = new StringBuffer();
                    forward.append("/ShowMessage.do?fid=");
                    forward.append(paForm.getFid());
View Full Code Here

     * @see org.jresearch.gossip.actions.BaseAction#process(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    public ActionForward process(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response)
        throws SystemException {
        ForumDAO dao = ForumDAO.getInstance();

        try {
           
            request.setAttribute(IConst.REQUEST.RECORDS_DATA, dao.getEntryList());
        } catch (SQLException sqle) {
            getServlet().log("Connection.process", sqle);
            throw new SystemException(sqle);
        }

View Full Code Here

  public ActionForward process(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws SystemException {
    HttpSession session = request.getSession();
    MessageForm messageForm = new MessageForm();
    ForumDAO dao = ForumDAO.getInstance();
    User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
    ProcessMessageForm pmForm = (ProcessMessageForm) form;
    try {
     
      int fid = Integer.parseInt(pmForm.getFid());
      boolean isUserMod = dao.checkMod(fid, user);
      Topic currThread = dao.getThreadInfo(Integer.parseInt(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

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.