navigationmgr.java

来自「一个用java编写的功能强大的OA系统」· Java 代码 · 共 129 行

JAVA
129
字号
package cn.js.fan.module.nav;import javax.servlet.http.HttpServletRequest;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());        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());        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();                                        while( ir.hasNext()) {                        Navigation n = getNav((String)ir.next());                        vt.addElement(n);                    }                                        rmCache.put(cachePrix, vt);                    return vt.iterator();                }            }            catch (Exception e) {                logger.error(e.getMessage());            }        }        return irnav;    }}

⌨️ 快捷键说明

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