⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 navigationmgr.java

📁 源码/软件简介: 云网论坛1.1RC国际版是采用JSP开发的集论坛、CMS(网站内容管理系统)、博客、聊天室、商城、交友、语音灌水等于一体的门户式社区。拥有CWBBS ( Cloud Web BBS
💻 JAVA
字号:
package cn.js.fan.module.nav;

import javax.servlet.http.HttpServletRequest;
import cn.js.fan.module.pvg.UserCheck;
import cn.js.fan.module.pvg.UserMgr;
import cn.js.fan.util.ErrMsgException;
import org.apache.log4j.Logger;
import cn.js.fan.security.SecurityUtil;
import cn.js.fan.util.ParamUtil;
import java.util.Iterator;
import cn.js.fan.db.ResultIterator;
import java.util.Vector;
import cn.js.fan.cache.jcs.*;

public class NavigationMgr {
    Logger logger = Logger.getLogger(NavigationMgr.class.getName());
    RMCache rmCache;
    String cachePrix = "nav";

    public NavigationMgr() {
        rmCache = RMCache.getInstance();
    }

    public boolean add(HttpServletRequest request) throws ErrMsgException {
        NavigationCheck uc = new NavigationCheck();
        uc.checkAdd(request);

        Navigation nav = new Navigation();
        boolean re = nav.insert(uc.getName(), uc.getLink(), uc.getColor(), uc.getTarget());
        if (re) {
            try {
                rmCache.remove(cachePrix);
            }
            catch (Exception e) {
                logger.error(e.getMessage());
            }
        }
        return re;
    }

    public boolean del(HttpServletRequest request) throws ErrMsgException {
        NavigationCheck uc = new NavigationCheck();
        uc.checkDel(request);

        Navigation nav = new Navigation(uc.getName());
        boolean re = nav.del();
        if (re) {
            try {
                rmCache.remove(cachePrix);
            }
            catch (Exception e) {
                logger.error(e.getMessage());
            }
        }
        return re;
    }

    public boolean move(HttpServletRequest request) throws ErrMsgException {
        NavigationCheck uc = new NavigationCheck();
        uc.checkMove(request);

        Navigation nav = new Navigation(uc.getName());
        boolean re = nav.move(uc.getDirection());
        if (re) {
            try {
                rmCache.remove(cachePrix);
            }
            catch (Exception e) {
                logger.error(e.getMessage());
            }
        }
        return re;
    }

    public boolean update(HttpServletRequest request) throws ErrMsgException {
        NavigationCheck uc = new NavigationCheck();
        uc.checkUpdate(request);

        Navigation nav = new Navigation();
        nav.setName(uc.getName());
        nav.setLink(uc.getLink());
        nav.setNewName(uc.getNewName());
        nav.setColor(uc.getColor());
        nav.setTarget(uc.getTarget());
        boolean re = nav.store();
        if (re) {
            try {
                rmCache.remove(cachePrix);
            }
            catch (Exception e) {
                logger.error(e.getMessage());
            }
        }
        return re;
    }

    public Navigation getNav(String name) {
        return new Navigation(name);
    }

    public Iterator getAllNav() {
        Vector navlist = (Vector)rmCache.get(cachePrix);
        Iterator irnav = null;
        if (navlist!=null)
            irnav = navlist.iterator();
        if (irnav == null) {
            Navigation nav = new Navigation();
            // 取得所有导航条栏目名称
            Vector v = nav.getAllNavName();
            try {
                if (v != null) {
                    Vector vt = new Vector();
                    Iterator ir = v.iterator();
                    // 取得所有栏目置入vt
                    while( ir.hasNext()) {
                        Navigation n = getNav((String)ir.next());
                        vt.addElement(n);
                    }
                    // 将vt置于缓存
                    rmCache.put(cachePrix, vt);
                    return vt.iterator();
                }
            }
            catch (Exception e) {
                logger.error(e.getMessage());
            }
        }
        return irnav;
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -