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

📄 globalutil.java

📁 博克后台的开发,有很多使用的方法和例子可以提供给大家学习
💻 JAVA
字号:
/*
 * description: 保存全局变量
 * 
 * Created on 2005-7-14
 * @author WuQiaoYun
 * 
 */

package com.common.util;

import java.io.File;
/**
 * 设置和处理全局变量
 * @author WuQiaoYun 
 */
public class GlobalUtil
{
	private static int mailLimit = 20;    //邮件的个人空间最大限制,单位是兆
    private static int mailVIPLimit = 40; //邮件的VIP个人空间最大限制,单位是兆
    private static int formHeight = 0;    //表单的高度,单位是象素
    private static int pageSize = 0;      //每页的记录数
    private static int spaceLimit = 20;   //个人资料上传的最大限制,单位是兆

    //取得根目录路径
    private static String rootRealPath = PropertyLoader.getPptValue("pathinfo", "rootpath"); 
    //取得配置文件所在路径
    private static String configPath = PropertyLoader.getPptValue("pathinfo", "configpath");
    //取得模板存放路径
    private static String templatePath = PropertyLoader.getPptValue("pathinfo", "templatepath");
    //取得上传文件存放路径
    private static String uploadPath = PropertyLoader.getPptValue("pathinfo", "uploadpath");
    //license的目录
    private static String licenseDir = null;

    public GlobalUtil()
    {
    }
    
    public static class UI
    {

        public static final int BASE_IFRAME_HEIGHT = 550;

        public UI()
        {
        }
    }
    
    /**
     * 通过传入的全局设置的值对象,更新此缓存
     * 
     * @param rwVOs:
     */
   /* public static void refresh(Res_wholesetVO rwVOs[])
    {
        if(rwVOs == null || rwVOs.length == 0)
            return;
        for(int i = 0; i < rwVOs.length; i++)
        {
            String wh_no = rwVOs[i].getHtmlWh_no();
            if(wh_no.equals("01"))
            {
                formHeight = Integer.parseInt(rwVOs[i].getWh_value1());
                pageSize = Integer.parseInt(rwVOs[i].getWh_value2());
                continue;
            }
            if(wh_no.equals("02"))
            {
                spaceLimit = Integer.parseInt(rwVOs[i].getWh_value1());
                continue;
            }
            if(wh_no.equals("03"))
            {
                mailLimit = Integer.parseInt(rwVOs[i].getWh_value1());
                mailVIPLimit = Integer.parseInt(rwVOs[i].getWh_value2());
                continue;
            }
            if(!wh_no.equals("04"))
                continue;
            String testRunFlag = rwVOs[i].getWh_value1();
            if(testRunFlag.trim().equals("0"))
                isTestRun = true;
            else
                isTestRun = false;
        }

    }
*/
    /**
     * 调用此方法将从数据库中重新更新缓存的内容
     *
     */
   /* public static void init()
    {
        Connection conn = null;
        Res_wholeset bw = null;
        Page pg = null;
        try
        {
            conn = DatabaseUtil.getConnection();
            bw = new Res_wholeset();
            bw.setConn(conn);
            bw.initRst("");
            bw.setPageNo(1);
            bw.setPageSize(bw.getRowCount());
            pg = bw.getPage();
        }
        catch(Exception e)
        {
            e.printStackTrace();
            throw new IllegalArgumentException("初始化全局设置时发生异常");
        }
        finally
        {
            try
            {
                if(bw != null)
                    bw.close();
            }
            catch(SQLException e) { }
            try
            {
                if(conn != null)
                    conn.close();
            }
            catch(SQLException e) { }
        }
        List li = pg.getList();
        refresh((Res_wholesetVO[])li.toArray(new Res_wholesetVO[0]));
    }
    */    
    
    /**
     * 得到全局变量:表单的高度,单位是象素
     * 
     * @return 返回表单的高度,单位是象素
     */
    public static int getFormHeight()
    {
        return formHeight;
    }

    /**
     * 得到全局变量:每页显示的行数
     * 
     * @return 返回每页显示的行数
     */
    public static int getPageSize()
    {
        return pageSize;
    }

    /**
     * 得到全局变量:个人资料上传的最大限制,单位是兆
     * 
     * @return 得到个人资料上传的最大限制,单位是兆
     */
    public static int getSpaceLimit()
    {
        return spaceLimit;
    }

    /**
     * 得到全局变量:内部邮件的个人空间最大限制,单位是兆
     * 
     * @return 返回内部邮件的个人空间最大限制,单位是兆
     */
    public static int getMailLimit()
    {
        return mailLimit;
    }

    /**
     * 得到全局变量:内部邮件的VIP个人空间最大限制,单位是兆
     * 
     * @return 返回内部邮件的VIP个人空间最大限制,单位是兆
     */
    public static int getMailVIPLimit()
    {
        return mailVIPLimit;
    }

    /**
     * 得到全局变量:得到服务器根的实际路径
     * 
     * @return 得到服务器根的实际路径
     */
    public static String getRootRealPath()
    {
        return rootRealPath;
    }


    /**
     * 得到全局变量:license文件的目录路径
     * 
     * @return 返回license文件的目录路径
     */
    public static String getLicenseDir()
    {
        if(licenseDir != null)
        {
            return licenseDir;
        } else
        {
        	//取得根目录路径          
            String rootRealPath = PropertyLoader.getPptValue("pathinfo", "rootpath");
            File file = new File((new File(rootRealPath)).getParentFile().getParentFile(), "LICENSE");
            return file.getPath();
        }
    }

    /**
     * 得到全局变量:得到配置文件存放的目录路径
     * 
     * @return 返回配置文件存放的目录路径
     */
    public static String getConfigPath()
    {
        return configPath;
    }

    /**
     * 得到全局变量:得到模板文件存放的目录路径
     * 
     * @return 得到模板文件存放的目录路径
     */
    public static String getTemplatePath()
    {
        return templatePath;
    }

    /**
     * 得到全局变量:得到上传文件存放的目录路径
     * 
     * @return 得到上传文件存放的目录路径
     */
    public static String getUploadPath()
    {
        return uploadPath;
    }
    
  
}

⌨️ 快捷键说明

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