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

📄 publicdata.java

📁 “JSP数据库项目案例导航”一书从第一章到第十一章各章实例的源程序文件以及数据库文件。 注意: 1. 本书中的案例提供的数据库环境不同
💻 JAVA
字号:
/**********************************************************
Copyright (C),2004-3-27, Beijing  USTB.
All rights reserved.
Filename: PublicData.java
Author: 
Version 1.0
Date:2004-3-27
Description:公用静态信息
Other:
Variable List:

v_flow
v_right
v_conf
v_FlowTable 
v_RightTable
s_FlowDefault 
s_RightDefault
v_Buttons

Function List:
void	rebuildFlowTable();
void	rebuildFlowVector();
void	rebuildRightTable();
void	rebuildRightVector();
void	rebuildFlowDefault();
void	rebuildRightDefault();
void    rebuildButtonTable();
History:

***********************************************************/
package oa.bean;

import java.text.*;
import java.util.*;
import java.lang.*;
import java.io.*;
import java.sql.*;
import javax.swing.tree.*;
import oa.main.*;

public class PublicData extends Object// implements Runnable
{
	private static DealString ds = new DealString();
	public static Vector v_flow = null;
	public static Vector v_right = null;
	public static Vector v_FlowTable = null;
	public static Vector v_RightTable = null;
	public static Vector v_Buttons = null;
	public static String s_FlowDefault = null;
	public static String s_RightDefault = null; 


	public static void rebuildButtonTable()
	{
		ParentBean pb = null;
		if(v_Buttons == null)
			v_Buttons = new Vector();
		else
			v_Buttons.clear();
		System.gc();
		try{
			pb = new ParentBean();
			v_Buttons = pb.getDataBySql("select ID,MKMC,ANMC,MRCZ from CODE_ANCZQXB where SYZT=0 order by MKBH,ANXH");
		}catch (Exception e){
			System.out.println("出错了:"+e);
		}
		finally{
			if(pb!=null)
				pb.closeConn();
		}
	}


	public static void rebuildFlowTable()
	{
		if(v_FlowTable==null)
			v_FlowTable = new Vector();
		else
			v_FlowTable.clear();
		System.gc();
		ParentBean pb = null;
		try{
			pb = new ParentBean();
			v_FlowTable = pb.getDataBySql("select ZGBH,A.BMBH,A.ZWBH,A.LCQX from ZZ_ZWB A,ZZ_ZGZWB B where A.BMBH=B.BMBH and A.ZWBH=B.ZWBH and A.ZWZT=0 and B.LCQX is null and A.LCQX is not null union select B.ZGBH,B.BMBH,B.ZWBH,B.LCQX from ZZ_ZWB A,ZZ_ZGZWB B where A.BMBH=B.BMBH and A.ZWBH=B.ZWBH and A.ZWZT=0 and B.LCQX is not null order by ZGBH");
		}
		catch (Exception e){
			System.out.println("出错了:"+e);
		}
		finally{
			if(pb!=null)
				pb.closeConn();
		}
	}
	public static void rebuildRightTable()
	{
		if(v_RightTable==null)
			v_RightTable = new Vector();
		else
			v_RightTable.clear();
		System.gc();
		ParentBean pb = null;
		try
		{
			pb = new ParentBean();
			v_RightTable = pb.getDataBySql("select ZGBH,A.BMBH,A.ZWBH,A.CZQX from ZZ_ZWB A,ZZ_ZGZWB B where A.BMBH=B.BMBH and A.ZWBH=B.ZWBH and A.ZWZT=0  and B.CZQX is null and A.CZQX is not null union select B.ZGBH,B.BMBH,B.ZWBH,B.CZQX from ZZ_ZWB A,ZZ_ZGZWB B where A.BMBH=B.BMBH and A.ZWBH=B.ZWBH and A.ZWZT=0 and  B.CZQX is not null order by ZGBH");
		}
		catch (Exception e)
		{
			System.out.println("出错了:"+e);
		}
		finally
		{
			if(pb!=null)
				pb.closeConn();
		}
	}
	public static void rebuildFlowVector()
	{
		if(v_flow==null)
			v_flow = new Vector();
		else
			v_flow.clear();
		System.gc();
		rebuildFlowTable();
		int k=v_FlowTable.size();
		String strCurrentID = "0";
		String strCurrentFlow = "";
		for(int i=0;i<k;i++)
		{
			Hashtable hash = (Hashtable)v_FlowTable.get(i);
			String strID = (String)hash.get("ZGBH");
			String strFlow = (String)hash.get("LCQX");
			if(strID.equals(strCurrentID))
			{
				strFlow +=","+(String)v_flow.remove(v_flow.size()-1);
				strFlow = ds.strDistinct(strFlow);
				v_flow.add(strFlow);
			}
			else
			{
				strCurrentID = strID;
				strCurrentFlow = strFlow;
				v_flow.add(strCurrentID);
				v_flow.add(strCurrentFlow);
			}
		}
	}
	public static void rebuildRightVector()
	{
		if(v_right==null)
			v_right = new Vector();
		else
			v_right.clear();
		System.gc();
		rebuildRightTable();
		int k=v_RightTable.size();
		String strCurrentID = "0";
		String strCurrentRight = "";
		for(int i=0;i<k;i++)
		{
			Hashtable hash = (Hashtable)v_RightTable.get(i);
			String strID = (String)hash.get("ZGBH");
			String strRight = ds.toString((String)hash.get("CZQX"));
			if(strID.equals(strCurrentID))
			{
				strRight +=","+(String)v_right.remove(v_right.size()-1);
				strRight = ds.strDistinct(strRight);
				v_right.add(strRight);
			}
			else
			{
				strCurrentID = strID;
				strCurrentRight = strRight;
				v_right.add(strCurrentID);
				v_right.add(strCurrentRight);
			}
		}
	}
	public static void	rebuildFlowDefault()
	{
		s_FlowDefault = "";
		System.gc();
		ParentBean pb = null;
		ResultSet rs = null;
		Statement stm = null;
		try
		{
			pb = new ParentBean();
			rs = pb.selectRecord("select MKBH from CODE_LCQXB where SYZT=0  and MRCZ=1 order by JBXH");
			stm = rs.getStatement();
			while(rs.next())
			{
				String str = rs.getString(1);
				if(s_FlowDefault.equals(""))
					s_FlowDefault = str;
				else s_FlowDefault += "," + str;
			}
		}
		catch (Exception e)
		{
			System.out.println("出错了:"+e);
		}
		finally
		{
			if(rs!=null)
				try{rs.close();	}
				catch(Exception e)
				{System.out.println("关闭rs时出错:"+e);	}
			if(stm!=null)
				try{stm.close();}
				catch(Exception e)
				{System.out.println("关闭statement时出错:"+e);	}
			if(pb!=null)
				pb.closeConn();
		}
	}

	public static void	rebuildRightDefault()
	{

		s_RightDefault = "";
		System.gc();
/*从数据库读取默认操作
		ParentBean pb = null;
		ResultSet rs = null;
		Statement stm = null;
		try
		{
			pb = new ParentBean();
			rs = pb.selectRecord("select ID from CODE_ANCZQXB where SYZT=0 and MRCZ=1 order by MKBH,ANXH");
			stm = rs.getStatement();
			while(rs.next())
			{
				String str = rs.getString(1);
				if(s_RightDefault.equals(""))
					s_RightDefault = str;
				else s_RightDefault += "," + str;
			}
		}
		catch (Exception e)
		{
			System.out.println("出错了:"+e);
		}
		finally
		{
			if(rs!=null)
				try{rs.close();	}
				catch(Exception e)
				{System.out.println("关闭rs时出错:"+e);	}
			if(stm!=null)
				try{stm.close();}
				catch(Exception e)
				{System.out.println("关闭statement时出错:"+e);	}
			if(pb!=null)
				try{pb.closeConn();}
				catch(Exception e)
				{System.out.println("释放连接时出错:"+e);}
		}
*/
//从已有的静态表中取得默认操作
		if(v_Buttons == null)
			rebuildButtonTable();
		Hashtable hash = null;
		String str = null;
		String str_mrcz = null;
		int k = v_Buttons.size();
		for(int i=0;i<k;i++)
		{
			hash = (Hashtable)v_Buttons.get(i);
			if(((String)hash.get("MRCZ")).equals("1")){
				str = (String)hash.get("ID");
				if(s_RightDefault.equals(""))
						s_RightDefault = str;
				else s_RightDefault += "," + str;
			}
		}
	}
/*	public void run()
	{
		long i=0;
		for(;;i++)
		{
			System.gc();
			float m = (float)Runtime.getRuntime().totalMemory()/1024/1024;
			System.out.print("\r垃圾收集线程正在运行..."+i+";虚拟机使用内存:"+m+"M");
			try{
				Thread.sleep(1000);
			}catch(Exception e){}
		}
	}
	*/
}

⌨️ 快捷键说明

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