📄 confighand.java
字号:
package com.sure.util;
import java.util.Properties;
import java.io.InputStream;
import java.io.IOException;
import java.io.File;
import java.io.FileInputStream;
import java.io.BufferedInputStream;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.SQLException;
import com.sure.dataabstraction.DBManager;
import com.sure.dataabstraction.DBPoolException;
import com.sure.businesslogic.NotFoundException;
/**
* 配置文件操作助手
* @author 宁玉斌
* @since 2004.10.21
*
*
*/
public class ConfigHand {
private ConfigHand() {
}
private static Properties prop = null;
//所有列表表头颜色的配置项
//public static String ORANGE = "0876E7";
public static String BLUE = "3964BD";
public static String ORANGE = "3964BD";
/**
* 取得配置文件的所有参数
* @return java.util.Properties
* @author 宁玉斌
* @since 2004.10.22 18:29
*/
public synchronized static Properties getConfigParams() {
if (prop == null) {
prop = new Properties();
String configFile = "./conf/oc.conf";
File file = new File(configFile);
if (!file.exists()) {
throw new RuntimeException(configFile + " file not found");
}
try {
prop.load(new BufferedInputStream(new FileInputStream(file)));
} catch (IOException ex) {
System.err.println(ex.getMessage());
}
}
return prop;
}
/**
* 取得配置文件某个参数值
* @param paramName 配置文件的参数名
* @return 参数值
* @author 宁玉斌
* @since 2004.10.22 18:27
*/
public static String getValue(String paramName) {
String value = null;
value = getConfigParams().getProperty(paramName).trim();
//System.out.println("返回值:"+value);
return value;
}
/**
* Constructor for uploadpath
*/
public static void initPath(String path) {
String initpath = getValue("UploadPath");
File file_dir = new File(initpath + path);
if (!file_dir.exists()) {
file_dir.mkdirs();
}
}
public static void SystemInit() throws DBPoolException, SQLException ,NotFoundException{
Connection cn=DBManager.getConnection();
Statement stmt = cn.createStatement();
String where="";
cn.setAutoCommit(false);
try{
where = "delete from AddressGroup";
stmt.execute(where);
where = "delete from attachment";
stmt.execute(where);
where = "delete from ccUnit";
stmt.execute(where);
where = "delete from checkUser";
stmt.execute(where);
where = "delete from editor";
stmt.execute(where);
where = "delete from gdfile";
stmt.execute(where);
where = "delete from GuiDocForm";
stmt.execute(where);
where = "delete from idTable";
stmt.execute(where);
where = "delete from inputUser";
stmt.execute(where);
where = "delete from mainDealUnit";
stmt.execute(where);
where = "delete from oaswitch";
stmt.execute(where);
where = "delete from printUnit";
stmt.execute(where);
where = "delete from publishUser";
stmt.execute(where);
where = "delete from RecvDocForm";
stmt.execute(where);
where = "delete from RecvDocLog";
stmt.execute(where);
where = "delete from RecvPermission";
stmt.execute(where);
where = "delete from role";
stmt.execute(where);
where = "delete from sealAdmin";
stmt.execute(where);
where = "delete from SendDocForm";
stmt.execute(where);
where = "delete from SendDocLog";
stmt.execute(where);
where = "delete from sendUnit";
stmt.execute(where);
where = "delete from Subject";
stmt.execute(where);
where = "delete from switchfile";
stmt.execute(where);
where = "delete from systemConfig";
stmt.execute(where);
where = "delete from Unit";
stmt.execute(where);
where = "delete from Users";
stmt.execute(where);
where = "delete from usersRight";
stmt.execute(where);
cn.commit();
}
catch(Exception e)
{
cn.rollback();
e.printStackTrace();
}
finally{
cn.setAutoCommit(true);
cn.close();
}
}
public static void main(String args[]){
System.out.println(getValue("UploadPath"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -