📄 directory.java
字号:
package cn.js.fan.module.netdisk;
import java.sql.*;
import javax.servlet.http.*;
import cn.js.fan.db.*;
import cn.js.fan.security.*;
import cn.js.fan.util.*;
import cn.js.fan.web.*;
import org.apache.log4j.*;
import java.util.Vector;
import java.util.Iterator;
/**
*
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
* ╋ 女性话题 一级目录
* ├『花样年华』 二级目录
* ├『花样年华』
* ╋ 女性话题 二级目录
* ├『花样年华』 三级目录
* @author not attributable
* @version 1.0
*/
public class Directory {
String connname = "";
Logger logger = Logger.getLogger(Directory.class.getName());
public Directory() {
connname = Global.defaultDB;
if (connname.equals(""))
logger.info("Directory:默认数据库名不能为空");
}
public boolean AddChild(HttpServletRequest request) throws
ErrMsgException {
//取出被回复的贴子的有关信息
int child_count = 0, orders = 1, parent_orders = 1,
islocked = 0;
String root_code = "", name = "", code = "", parent_code = "";
name = ParamUtil.get(request, "name").trim();
if (name == null || name.equals(""))
throw new ErrMsgException("名称不能为空!");
code = ParamUtil.get(request, "code").trim();
if (code.equals(""))
throw new ErrMsgException("编码不能为空!");
parent_code = ParamUtil.get(request, "parent_code").trim();
if (parent_code.equals(""))
throw new ErrMsgException("父结点不能为空!");
String description = ParamUtil.get(request, "description");
int type = ParamUtil.getInt(request, "type");
String userName = ParamUtil.get(request, "userName");
if (userName.equals(""))
throw new ErrMsgException("用户名不能为空!");
Leaf lf = new Leaf();
lf = lf.getLeaf(code);
if (lf!=null && lf.isLoaded())
throw new ErrMsgException("已存在相同编码的节点:" + lf.getName());
lf = new Leaf();
lf.setName(name);
lf.setCode(code);
lf.setParentCode(parent_code);
lf.setDescription(description);
lf.setType(type);
lf.setUserName(userName);
Leaf leaf = getLeaf(parent_code);
return leaf.AddChild(lf);
}
public void del(String delcode) throws ErrMsgException {
Leaf lf = getLeaf(delcode);
lf.del(lf);
}
public synchronized boolean update(HttpServletRequest request) throws
ErrMsgException {
String code = ParamUtil.get(request, "code", false);
String name = ParamUtil.get(request, "name", false);
String description = ParamUtil.get(request, "description");
int type = ParamUtil.getInt(request, "type");
if (code == null || name == null) {
throw new ErrMsgException("code与name项必填!");
}
String parentCode = ParamUtil.get(request, "parentCode");
Leaf leaf = getLeaf(code);//new Leaf();
leaf.setName(name);
leaf.setDescription(description);
leaf.setType(type);
boolean re = false;
if (parentCode.equals(leaf.getParentCode()))
re = leaf.update();
else
re = leaf.update(parentCode);
return re;
}
public synchronized boolean move(HttpServletRequest request) throws
ErrMsgException {
String code = ParamUtil.get(request, "code", false);
String direction = ParamUtil.get(request, "direction", false);
if (code == null || direction == null) {
throw new ErrMsgException("编码与方向项必填!");
}
Leaf lf = new Leaf(code);
return lf.move(direction);
}
public Leaf getLeaf(String code) {
Leaf leaf = new Leaf();
return leaf.getLeaf(code);
}
public Leaf getBrother(String code, String direction) throws
ErrMsgException {
Leaf lf = getLeaf(code);
return lf.getBrother(direction);
}
public Vector getChildren(String code) throws ErrMsgException {
Leaf leaf = getLeaf(code);
return leaf.getChildren();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -