leaf.java
来自「cwbbs 云网论坛源码」· Java 代码 · 共 1,053 行 · 第 1/3 页
JAVA
1,053 行
package com.redmoon.forum;import java.io.*;import java.sql.*;import java.sql.Date;import java.util.*;import javax.servlet.*;import javax.servlet.http.*;import cn.js.fan.base.*;import cn.js.fan.cache.jcs.*;import cn.js.fan.db.*;import cn.js.fan.security.*;import cn.js.fan.util.*;import cn.js.fan.web.*;import com.redmoon.forum.person.*;import com.redmoon.forum.plugin.*;import com.redmoon.forum.plugin2.*;import com.redmoon.forum.ui.*;import org.apache.log4j.*;public class Leaf implements Serializable, ITagSupport { public static String CODE_BLOG = "blog"; public static String CODE_ROOT = "root"; public static final int TYPE_DOMAIN = 0; public static final int TYPE_BOARD = 1; public static final int WEBEDIT_ALLOW_TYPE_UBB = 1; public static final int WEBEDIT_ALLOW_TYPE_UBB_NORMAL = 2; public static final int WEBEDIT_ALLOW_TYPE_UBB_NORMAL_REDMOON = 3; public static final int WEBEDIT_ALLOW_TYPE_REDMOON_FIRST = 4; public static final int CHECK_NOT = 0; public static final int CHECK_TOPIC = 1; public static final int CHECK_TOPIC_REPLY = 2; public static final int DEL_DUSTBIN = 0; public static final int DEL_FOREVER = 1; public static final int DISPLAY_STYLE_VERTICAL = 0; public static final int DISPALY_STYLE_HORIZON = 1; transient RMCache rmCache = RMCache.getInstance(); String connname = ""; public transient Logger logger = Logger.getLogger(Leaf.class.getName()); long addId; private String code = "", name = "", description = "", parent_code = "-1", root_code = "", add_date = ""; private int orders = 1, layer = 1, child_count = 0; final String LOAD = "select code,name,description,parent_code,root_code,orders,layer,child_count,add_date,islocked,type,isHome,add_id,logo,today_count,today_date,topic_count,post_count,theme,skin,boardRule,color,webeditAllowType,plugin2Code,check_msg,del_mode,display_style,is_bold from sq_board where code=?"; boolean isHome = false; final String dirCache = "BOARD_"; public void renew() { if (logger == null) { logger = Logger.getLogger(Leaf.class.getName()); } if (rmCache == null) { rmCache = RMCache.getInstance(); } } public String get(String field) { if (field.equals("code")) return getCode(); else if (field.equals("name")) return getName(); else if (field.equals("desc")) return getDescription(); else if (field.equals("parent_code")) return getParentCode(); else if (field.equals("root_code")) return getRootCode(); else if (field.equals("layer")) return "" + getLayer(); else return ""; } public Leaf() { connname = Global.defaultDB; if (connname.equals("")) logger.info("Leaf:connname is empty"); } public Leaf(String code) { connname = Global.defaultDB; if (connname.equals("")) logger.info("Leaf:connname is empty"); this.code = code; loadFromDb(); } public void loadFromDb() { ResultSet rs = null; Conn conn = new Conn(connname); PreparedStatement ps = null; try { ps = conn.prepareStatement(LOAD); ps.setString(1, code); rs = conn.executePreQuery(); if (rs != null && rs.next()) { this.code = rs.getString(1); name = rs.getString(2); description = StrUtil.getNullStr(rs.getString(3)); parent_code = rs.getString(4); root_code = rs.getString(5); orders = rs.getInt(6); layer = rs.getInt(7); child_count = rs.getInt(8); add_date = DateUtil.format(DateUtil.parse(rs.getString(9)), "yyyy-MM-dd HH:mm:ss"); locked = rs.getInt(10) == 1 ? true : false; type = rs.getInt(11); isHome = rs.getInt(12) > 0 ? true : false; addId = rs.getInt(13); logo = rs.getString(14); todayCount = rs.getInt(15); todayDate = DateUtil.parse(rs.getString(16)); topicCount = rs.getInt(17); postCount = rs.getInt(18); theme = StrUtil.getNullStr(rs.getString(19)); skin = StrUtil.getNullStr(rs.getString(20)); boardRule = StrUtil.getNullString(rs.getString(21)); color = StrUtil.getNullString(rs.getString(22)); webeditAllowType = rs.getInt(23); plugin2Code = StrUtil.getNullStr(rs.getString(24)); checkMsg = rs.getInt(25); delMode = rs.getInt(26); displayStyle = rs.getInt(27); bold = rs.getInt(28)==1; loaded = true; } } catch (SQLException e) { logger.error("load: code= " + code + " " + e.getMessage()); } finally { if (rs != null) { try { rs.close(); } catch (Exception e) {} rs = null; } if (ps != null) { try { ps.close(); } catch (Exception e) {} ps = null; } if (conn != null) { conn.close(); conn = null; } } } public long getAddId() { return addId; } public void setAddId(long d) { this.addId = d; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getName() { return name; } public void setRootCode(String c) { this.root_code = c; } public void setType(int t) { this.type = t; } public void setName(String n) { this.name = n; } public void setDescription(String desc) { this.description = desc; } public int getOrders() { return orders; } public boolean getIsHome() { return isHome; } public void setParentCode(String p) { this.parent_code = p; } public String getParentCode() { return this.parent_code; } public void setIsHome(boolean b) { this.isHome = b; } public void setLogo(String logo) { this.logo = logo; } public void setTodayCount(int todayCount) { this.todayCount = todayCount; } public void setTodayDate(Date todayDate) { this.todayDate = todayDate; } public void setTopicCount(int topicCount) { this.topicCount = topicCount; } public void setPostCount(int postCount) { this.postCount = postCount; } public void setTheme(String theme) { this.theme = theme; } public void setSkin(String skin) { this.skin = skin; } public void setLoaded(boolean loaded) { this.loaded = loaded; } public String getRootCode() { return root_code; } public int getLayer() { return layer; } public String getDescription() { return description; } public int getType() { return type; } public String getLogo() { return logo; } public int getTodayCount() { if (todayCount != 0) { if (!DateUtil.isSameDay(todayDate, new java.util.Date())) { todayCount = 0; todayDate = new java.util.Date(); update(); } } return todayCount; } public java.util.Date getTodayDate() { return todayDate; } public int getTopicCount() { return topicCount; } public int getPostCount() { return postCount; } public String getTheme() { return theme; } public String getSkin() { return skin; } public boolean isLoaded() { return loaded; } public boolean isLocked() { return locked; } public String getBoardRule() { return boardRule; } public String getColor() { return color; } public int getWebeditAllowType() { return webeditAllowType; } public String getPlugin2Code() { return plugin2Code; } public int getCheckMsg() { return checkMsg; } public int getDelMode() { return delMode; } public int getDisplayStyle() { return displayStyle; } public boolean isBold() { return bold; } public int getChildCount() { return child_count; } public Vector getChildren() { Vector v = new Vector(); String sql = "select code from sq_board where parent_code=? order by orders";
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?