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

📄 logexportimpl.java

📁 具备多表组合查询组件功能。通过将表字段与表间关系映射到对象关系及属性
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package cn.edu.buaa.ieguam.logmanage;

import java.text.DateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import cn.edu.buaa.ieguam.logmanage.LogTreeImpl;
import cn.edu.buaa.ieguam.logmanage.MBean;
import cn.edu.buaa.ieguam.logmanage.pojos.AppLog;
import cn.edu.buaa.ieguam.logmanage.pojos.AuditInfo;
import cn.edu.buaa.ieguam.logmanage.pojos.AuditType;
import cn.edu.buaa.ieguam.logmanage.pojos.EventId;
import cn.edu.buaa.ieguam.logmanage.pojos.EventType;
import cn.edu.buaa.ieguam.logmanage.pojos.LinuxLog;
import cn.edu.buaa.ieguam.logmanage.pojos.MySqlLog;
import cn.edu.buaa.ieguam.logmanage.pojos.Operation;
import cn.edu.buaa.ieguam.logmanage.pojos.OracleLog;
import cn.edu.buaa.ieguam.logmanage.pojos.SqlServerLog;
import cn.edu.buaa.ieguam.logmanage.pojos.TomcatLog;
import cn.edu.buaa.ieguam.logmanage.pojos.WinLog;

/**
 * 实现日志的导出备份功能
 * @author tongxiaodong
 * Creation time:Apr 23, 2007 10:41:59 PM
 */

public class LogExportImpl 
{

	private LogQueryImpl logQueryImpl = null;
	private DBConnection dbCon = null;
	private MBeanPage mBeanPage = null;
	
	private AuditInfo auditInfo = new AuditInfo();
	private AuditType auditType = new AuditType();
	private EventId eventId = new EventId();
	private EventType eventType = new EventType();
	private WinLog winLog = new WinLog();
	private LinuxLog linuxLog = new LinuxLog();
	private TomcatLog tomcatLog = new TomcatLog();
	private MySqlLog mySqlLog = new MySqlLog();
	private OracleLog oracleLog = new OracleLog();
	private SqlServerLog sqlServerLog = new SqlServerLog();
	private AppLog appLog = new AppLog();
	private Operation operation = new Operation(); 
	
	public LogExportImpl(DBConnection dbCon)
	{	
		this.logQueryImpl = new LogQueryImpl(new LogSqlDef());//设置读取树节点的实现类	
		this.dbCon = dbCon;
	}
	public LogExportImpl(DBConnection dbCon,LogSqlDef readingDef)
	{	
		this.logQueryImpl = new LogQueryImpl(readingDef);//设置读取树节点的实现类
		this.dbCon = dbCon;
	}
	
	public LogQueryImpl getLogQueryImpl()
    {
    	return this.logQueryImpl;
    }
	public void setLogQueryImpl(LogQueryImpl logQueryImpl)
    {
    	this.logQueryImpl = logQueryImpl;
    }
	
	/**
	 * Implementation
	 */
	public void initTree()
	{
        //设置MBean
		this.logQueryImpl.assignMBean("auditInfo", "AUDITINFO", this.auditInfo);
		//this.logQueryImpl.assignMBean("auditType", "AUDITTYPE", this.auditType);
		//this.logQueryImpl.assignMBean("eventId", "EVENTID", this.eventId);
		//this.logQueryImpl.assignMBean("eventType", "EVENTTYPE", this.eventType);
		this.logQueryImpl.assignMBean("winLog", "WINLOG", this.winLog);
		this.logQueryImpl.assignMBean("linuxLog", "LINUXLOG", this.linuxLog);
		this.logQueryImpl.assignMBean("tomcatLog", "TOMCATLOG", this.tomcatLog);
		this.logQueryImpl.assignMBean("mySqlLog", "MYSQLLOG", this.mySqlLog);
		this.logQueryImpl.assignMBean("oracleLog", "ORACLELOG", this.oracleLog);
		this.logQueryImpl.assignMBean("sqlServerLog", "SQLSERVERLOG", this.sqlServerLog);
		this.logQueryImpl.assignMBean("appLog", "APPLOG", this.appLog);
		this.logQueryImpl.assignMBean("operation", "OPERATION", this.operation);
		
		//设置主键属性
		this.logQueryImpl.createPkm("auditInfo", "id");
		//this.logQueryImpl.createPkm("auditType", "id");
		//this.logQueryImpl.createPkm("eventId", "id");
		//this.logQueryImpl.createPkm("eventType", "id");
		this.logQueryImpl.createPkm("winLog", "id");
		this.logQueryImpl.createPkm("linuxLog", "id");
		this.logQueryImpl.createPkm("tomcatLog", "id");
		this.logQueryImpl.createPkm("mySqlLog", "id");
		this.logQueryImpl.createPkm("oracleLog", "id");
		this.logQueryImpl.createPkm("sqlServerLog", "id");
		this.logQueryImpl.createPkm("appLog", "id");
		this.logQueryImpl.createPkm("operation", "id");
		
        //设置对象-关系映射
		this.logQueryImpl.createOrmMap("auditInfo", "id", "AUDITINFO.ID");
		this.logQueryImpl.createOrmMap("auditInfo", "auditDate", "AUDITINFO.AUDITDATE");
		this.logQueryImpl.createOrmMap("auditInfo", "eventId", "AUDITINFO.EVENTID");
		this.logQueryImpl.createOrmMap("auditInfo", "eventType", "AUDITINFO.EVENTTYPE");
		this.logQueryImpl.createOrmMap("auditInfo", "ipAddr", "AUDITINFO.IPADDR");
		this.logQueryImpl.createOrmMap("auditInfo", "hostName", "AUDITINFO.HOSTNAME");
		this.logQueryImpl.createOrmMap("auditInfo", "auditType", "AUDITINFO.AUDITTYPE");
		this.logQueryImpl.createOrmMap("auditInfo", "markTime", "AUDITINFO.MARKTIME");

	/*
		this.logQueryImpl.createOrmMap("auditType", "id", "AUDITTYPE.ID");
		this.logQueryImpl.createOrmMap("auditType", "tableIndex", "AUDITTYPE.TABLEINDEX");
		this.logQueryImpl.createOrmMap("auditType", "typeName", "AUDITTYPE.TYPENAME");
		this.logQueryImpl.createOrmMap("auditType", "description", "AUDITTYPE.DESCRIPTION");
		
		this.logQueryImpl.createOrmMap("eventId", "id", "EVENTID.ID");
		this.logQueryImpl.createOrmMap("eventId", "eventName", "EVENTID.EVENTNAME");
		this.logQueryImpl.createOrmMap("eventId", "eventShort", "EVENTID.EVENTSHORT");
		this.logQueryImpl.createOrmMap("eventId", "description", "EVENTID.DESCRIPTION");
		
		this.logQueryImpl.createOrmMap("eventType", "id", "EVENTTYPE.ID");
		this.logQueryImpl.createOrmMap("eventType", "eTypeName", "EVENTTYPE.ETYPENAME");
		this.logQueryImpl.createOrmMap("eventType", "description", "EVENTTYPE.DESCRIPTION");		
	*/
		this.logQueryImpl.createOrmMap("winLog", "id", "WINLOG.ID");
		this.logQueryImpl.createOrmMap("winLog", "auditId", "WINLOG.AUDITID");
		this.logQueryImpl.createOrmMap("winLog", "oneSource", "WINLOG.ONESOURCE");
		this.logQueryImpl.createOrmMap("winLog", "secondSource", "WINLOG.SECONDSOURCE");
		this.logQueryImpl.createOrmMap("winLog", "category", "WINLOG.CATEGORY");
		this.logQueryImpl.createOrmMap("winLog", "usr", "WINLOG.USR");
		this.logQueryImpl.createOrmMap("winLog", "description", "WINLOG.DESCRIPTION");
		
		this.logQueryImpl.createOrmMap("linuxLog", "id", "LINUXLOG.ID");
		this.logQueryImpl.createOrmMap("linuxLog", "auditId", "LINUXLOG.AUDITID");
		this.logQueryImpl.createOrmMap("linuxLog", "description", "LINUXLOG.DESCRIPTION");
		
		this.logQueryImpl.createOrmMap("tomcatLog", "id", "TOMCATLOG.ID");
		this.logQueryImpl.createOrmMap("tomcatLog", "auditId", "TOMCATLOG.AUDITID");
		this.logQueryImpl.createOrmMap("tomcatLog", "remoteIp", "TOMCATLOG.REMOTEIP");
		this.logQueryImpl.createOrmMap("tomcatLog", "locIp", "TOMCATLOG.LOCIP");
		this.logQueryImpl.createOrmMap("tomcatLog", "byteSent", "TOMCATLOG.BYTESENT");
		this.logQueryImpl.createOrmMap("tomcatLog", "ReHostName", "TOMCATLOG.REHOSTNAME");
		this.logQueryImpl.createOrmMap("tomcatLog", "reqMethod", "TOMCATLOG.REQMETHOD");
		this.logQueryImpl.createOrmMap("tomcatLog", "locPort", "TOMCATLOG.LOCPORT");
		this.logQueryImpl.createOrmMap("tomcatLog", "queryStr", "TOMCATLOG.QUERYSTR");
		this.logQueryImpl.createOrmMap("tomcatLog", "firstLineReq", "TOMCATLOG.FIRSTLINEREQ");
		this.logQueryImpl.createOrmMap("tomcatLog", "httpStatus", "TOMCATLOG.HTTPSTATUS");
		this.logQueryImpl.createOrmMap("tomcatLog", "usrSessId", "TOMCATLOG.USRSESSID");
		this.logQueryImpl.createOrmMap("tomcatLog", "autherReUsr", "TOMCATLOG.AUTHERREUSR");
		this.logQueryImpl.createOrmMap("tomcatLog", "reqUrl", "TOMCATLOG.REQURL");
		this.logQueryImpl.createOrmMap("tomcatLog", "locSerName", "TOMCATLOG.LOCSERNAME");
		this.logQueryImpl.createOrmMap("tomcatLog", "proTime", "TOMCATLOG.PROTIME");
		this.logQueryImpl.createOrmMap("tomcatLog", "reQuProtocol", "TOMCATLOG.REQUPROTOCOL");
		this.logQueryImpl.createOrmMap("tomcatLog", "reUsrName", "TOMCATLOG.REUSRNAME");
		
		this.logQueryImpl.createOrmMap("sqlServerLog", "id", "SQLSERVERLOG.ID");
		this.logQueryImpl.createOrmMap("sqlServerLog", "auditId", "SQLSERVERLOG.AUDITID");
		this.logQueryImpl.createOrmMap("sqlServerLog", "process", "SQLSERVERLOG.PROCESS");
		this.logQueryImpl.createOrmMap("sqlServerLog", "description", "SQLSERVERLOG.DESCRIPTION");
		
		this.logQueryImpl.createOrmMap("mySqlLog", "id", "MYSQLLOG.ID");
		this.logQueryImpl.createOrmMap("mySqlLog", "auditId", "MYSQLLOG.AUDITID");
		this.logQueryImpl.createOrmMap("mySqlLog", "process", "MYSQLLOG.PROCESS");
		this.logQueryImpl.createOrmMap("mySqlLog", "description", "MYSQLLOG.DESCRIPTION");
		
		this.logQueryImpl.createOrmMap("oracleLog", "id", "ORACLELOG.ID");
		this.logQueryImpl.createOrmMap("oracleLog", "auditId", "ORACLELOG.AUDITID");
		this.logQueryImpl.createOrmMap("oracleLog", "process", "ORACLELOG.PROCESS");
		this.logQueryImpl.createOrmMap("oracleLog", "description", "ORACLELOG.DESCRIPTION");
		
		this.logQueryImpl.createOrmMap("appLog", "id", "APPLOG.ID");
		this.logQueryImpl.createOrmMap("appLog", "auditId", "APPLOG.AUDITID");
		this.logQueryImpl.createOrmMap("appLog", "sql", "APPLOG.SQL");
		this.logQueryImpl.createOrmMap("appLog", "tableName", "APPLOG.TABLENAME");
		this.logQueryImpl.createOrmMap("appLog", "opType", "APPLOG.OPTYPE");
		this.logQueryImpl.createOrmMap("appLog", "operatorId", "APPLOG.OPERATORID");
		this.logQueryImpl.createOrmMap("appLog", "beOperatedId", "APPLOG.BEOPERATEDID");
		
		this.logQueryImpl.createOrmMap("operation", "id", "OPERATION.ID");
		this.logQueryImpl.createOrmMap("operation", "appId", "OPERATION.APPID");
		this.logQueryImpl.createOrmMap("operation", "columnName", "OPERATION.COLUMNNAME");
		this.logQueryImpl.createOrmMap("operation", "newValue", "OPERATION.NEWVALUE");
		this.logQueryImpl.createOrmMap("operation", "oldValue", "OPERATION.OLDVALUE");
		
		
        //设置外键映射
		//this.logQueryImpl.createFkmMap("auditInfo", "eventType", "eventType", "id");
		//this.logQueryImpl.createFkmMap("auditInfo", "eventId", "eventId", "id");
		//this.logQueryImpl.createFkmMap("auditInfo", "auditType", "auditType", "id");
		
		this.logQueryImpl.createFkmMap("winLog", "auditId", "auditInfo", "id");
		this.logQueryImpl.createFkmMap("linuxLog", "auditId", "auditInfo", "id");
		this.logQueryImpl.createFkmMap("tomcatLog", "auditId", "auditInfo", "id");
		this.logQueryImpl.createFkmMap("sqlServerLog", "auditId", "auditInfo", "id");
		this.logQueryImpl.createFkmMap("mySqlLog", "auditId", "auditInfo", "id");
		this.logQueryImpl.createFkmMap("oracleLog", "auditId", "auditInfo", "id");
		this.logQueryImpl.createFkmMap("appLog", "auditId", "auditInfo", "id");
		
		this.logQueryImpl.createFkmMap("operation", "appId", "appLog", "id");
		
        //定义树中节点的父子关系
		//this.logQueryImpl.setMBeanRelation("auditInfo", "left", "auditType");
		//this.logQueryImpl.setMBeanRelation("auditInfo", "left", "eventType");
		//this.logQueryImpl.setMBeanRelation("auditInfo", "left", "eventId");
		

⌨️ 快捷键说明

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