usergroupprivdb.java

来自「cwbbs 云网论坛源码」· Java 代码 · 共 80 行

JAVA
80
字号
package cn.js.fan.module.cms.ext;import com.cloudwebsoft.framework.base.QObjectDb;import cn.js.fan.db.PrimaryKey;import com.cloudwebsoft.framework.db.JdbcTemplate;import cn.js.fan.util.ResKeyException;import cn.js.fan.module.cms.Config;import java.util.Iterator;import cn.js.fan.util.ErrMsgException;import com.cloudwebsoft.framework.util.LogUtil;import cn.js.fan.util.StrUtil;public class UserGroupPrivDb extends QObjectDb {    public static final String ALLDIR = "alldir";    public UserGroupPrivDb() {    }    public boolean init(String groupCode, String boardCode) {        Config cfg = new Config();                String attach_download = cfg.getProperty("cms.canUserDownloadAttach").                                 equals("true") ? "1" : "0";        String view_doc = cfg.getProperty("cms.canUserViewDoc").equals("true")?"1":"0";        boolean re = false;        try {            re = create(new JdbcTemplate(), new Object[] {groupCode,boardCode,"1",attach_download,"1",view_doc,"",new Integer(0)});        }        catch (ResKeyException e) {                        throw new IllegalAccessError(e.getMessage());        }        return re;    }        public void delUserGroupPrivOfDir(String dirCode) {        String sql = "select group_code, dir_code from " + getTable().getName() + " where dir_code=?";        Iterator ir = list(sql, new Object[]{dirCode}).iterator();        while (ir.hasNext()) {            UserGroupPrivDb ugpd = (UserGroupPrivDb)ir.next();            try {                ugpd.del();            }            catch (ResKeyException e) {                LogUtil.getLog(getClass()).error("delUserGroupPrivOfDir:" + StrUtil.trace(e));            }        }    }        public boolean isUserGropuPrivDbCreated(String groupCode, String dirCode) {        PrimaryKey pk = (PrimaryKey) primaryKey.clone();        pk.setKeyValue("group_code", groupCode);        pk.setKeyValue("dir_code", dirCode);        UserGroupPrivDb ugp = (UserGroupPrivDb) getQObjectDb(pk.getKeys());        if (ugp == null) {            return false;        } else            return true;    }        public UserGroupPrivDb getUserGroupPrivDb(String groupCode, String dirCode) {        PrimaryKey pk = (PrimaryKey)primaryKey.clone();        pk.setKeyValue("group_code", groupCode);        pk.setKeyValue("dir_code", dirCode);        UserGroupPrivDb ugp = (UserGroupPrivDb)getQObjectDb(pk.getKeys());                if (ugp==null) {            init(groupCode, dirCode);            return (UserGroupPrivDb)getQObjectDb(pk.getKeys());        }        else            return ugp;    }}

⌨️ 快捷键说明

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