`

JAVA模式--看守者模式的小应用

    博客分类:
  • JAVA
阅读更多

      好久没写了,随便写点东西,不然脑袋都得大掉,还希望大家有空多讨论啊!!!

      对看守者模式,进行了简单的使用,结合工厂,管理工厂在内存中的使用

   ObjectKeeper.java

package com.legion.project.crmproject.common;

import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;

/**
 * 看守类的一个实现
 * @author dsy 
 * @date 2008-12-03
 */
public class ObjectKeeper extends Thread {
	private static final Logger log = Logger.getLogger(ObjectKeeper.class.getName());
	private static ObjectKeeper m_keeper = new ObjectKeeper();
	private static List m_keptObjects = new ArrayList();

	private ObjectKeeper() {
		new Thread(this).start();
	}

	public void run() {
		try {
			join();
		} catch (InterruptedException e) {
		}
	}

	/**
	 * 任何对象传递到看守方法,直到调用discardObject()方法
	 */
	public static void keepObject(Object myObject) {
		log.info("[ObjectKeeper]-[keepObject()] begin Total number of kept objects: "+ m_keptObjects.size());
		m_keptObjects.add(myObject);
		log.info("[ObjectKeeper]-[keepObject()] success Total number of kept objects: "+ m_keptObjects.size());
	}

	/**
	 * 清除当前被看守的对象
	 */
	public static void discardObject(Object myObject) {
		log.info("[ObjectKeeper]-[discardObject()] begin Total number of kept objects: " + m_keptObjects.size());
		m_keptObjects.remove(myObject);
		log.info("[ObjectKeeper]-[discardObject()] begin Total number of kept objects: " + m_keptObjects.size());
	}

}

 

UpdateBackServices.java

package com.legion.project.crmproject.common;

import java.util.List;

/**
 * <p>Title: 数据备份操作服务工具类</p>
 *
 * <p>Description: 用于备份数据查询,插入,删除操作</p>
 *
 * <p>Copyright: Copyright (c) 2008</p>
 *
 * <p>Company: Legion Technology</p>
 *
 * @author dsy
 * @version 1.0
 * @date 2008-12-04
 */
public class UpdateBackServices {
	
	/**
	 * 删除公用方法
	 * @param dto
	 * 			isJoinType = "DELETE"时,根据dto中的值,自动组装删除条件
	 * @param isJoinType 
	 * 			isJoinType = "DELETE"时,根据dto中参数是否有值来自动组装where
	 * 			isJoinType = ""时,删除全部数据
	 * @return boolean
	 */
	public static boolean deleteAllByType(TCrmUpdatebakDTO dto,String isJoinType) {
		ObjectKeeper.keepObject(UpdateBackDAO.getInstance());
		IUpdateBackDAO dao = UpdateBackDAO.getInstance();
		boolean deleteBool = dao.deleteAllByType(dto, isJoinType);
		ObjectKeeper.discardObject(UpdateBackDAO.getInstance());
		return deleteBool;
	}
	
	/**
	 * 查询公用方法
	 * @param dto
	 * 			isJoinType = "SELECT"时,根据dto中的值,自动组装查询条件
	 * @param isJoinType
	 * 			isJoinType = "SELECT"时,根据dto中参数是否有值来自动组装where
	 * 			isJoinType = ""时,查询全部数据
	 * @return List
	 */
	public static List searchAllByType(TCrmUpdatebakDTO dto,String isJoinType) {
		ObjectKeeper.keepObject(UpdateBackDAO.getInstance());
		IUpdateBackDAO dao = UpdateBackDAO.getInstance();
		List allValue = dao.searchAllByType(dto, isJoinType);
		ObjectKeeper.discardObject(UpdateBackDAO.getInstance());
		return allValue;
	}
	
	/**
	 * 插入公用方法
	 * @param dto
	 * 		以下值是不用设置的
	 * 		dto.setId();//序列自动生成
	 * 		dto.setBakdata();//自动根据dto.getBosid()备份模板外部表数据(XML)
	 * 		dto.setStat();	//默认为"STAR"
	 * @return
	 */
	public static boolean insertUpdateBAk(TCrmUpdatebakDTO dto) {
		
		ObjectKeeper.keepObject(UpdateBackDAO.getInstance());
		IUpdateBackDAO dao = UpdateBackDAO.getInstance();
		boolean insertBool = dao.insertUpdateBAk(dto);
		ObjectKeeper.discardObject(UpdateBackDAO.getInstance());
		return insertBool;
	}
	
	public static void main(String[] args) {
//		getTableTypeSql();
		TCrmUpdatebakDTO dto = new TCrmUpdatebakDTO();
		dto.setBosid("88994");
		dto.setBostype("test");
		dto.setTitle("UpdateBack");
		dto.setUpdatetype("UpdateBackDAO ADD");
		dto.setBakdate(new java.util.Date());
		dto.setStat("STAR");
		//System.out.println(insertUpdateBAk(dto));
		List testList = UpdateBackDAO.getInstance().searchAllByType(dto, "");
		for (int i = 0; i < testList.size(); i++) {
			dto = new TCrmUpdatebakDTO();
			dto = (TCrmUpdatebakDTO) testList.get(i);
			System.out.println(i + "=" +dto.getId());
		}
	}
}

 

 

    SqlStringUtil.java

package com.legion.project.crmproject.common;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;

import com.legion.jdbc.test.ConnectionDBImpl;

import common.dao.DAOFactory;

/**
 * <p>Title: 数据操作工具类</p>
 *
 * <p>Description: 用于当前表字段组装,返回String</p>
 *
 * <p>Copyright: Copyright (c) 2008</p>
 *
 * <p>Company: Legion Technology</p>
 *
 * @author dsy
 * @version 1.0
 * @date 2008-12-04
 */
public class SqlStringUtil {
	private static final Logger log = Logger.getLogger(SqlStringUtil.class.getName());
	
	protected static Connection getConnection() {
		Connection conn = null;
		try {
			//conn =  DAOFactory.getInstance().getCrmConnection();
			conn =  ConnectionDBImpl.getConnection();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return conn;
	}
	
	/**
	 * @desc: 用于查询当前实例[bosid]所关联模板数据的外部数据表工具方法
	 * @return
	 */
	public static String getBomSql(String bosid) {
		log.info("[SqlStringUtil].[getBomSql()] begin..................");
		Connection conn = null;
		PreparedStatement pstmt = null;
		ResultSet rs = null;
		String packageSql = "";
		try {
			conn = getConnection();
			pstmt = conn.prepareStatement(getSqlKey("BOMEXTTBL","",bosid));
			rs = pstmt.executeQuery();
			while(rs.next()) {
				String extTable = rs.getString(1);
				packageSql = getSqlKey("PACKAGETBL", extTable, bosid);
			}
		} catch (SQLException e) {
			log.error("[SqlStringUtil].[getBomSql()]={"+e.getMessage()+"}");
		} finally {
			close(conn,pstmt);
		}
		log.info("[SqlStringUtil].[getBomSql()] success..................");
		return packageSql;
	}
	
	protected static void close(Connection conn,PreparedStatement pstmt) {
			try {
				if(conn != null) {
					conn.close();
					conn = null;
				}
				if(pstmt != null) {
					pstmt.close();
					pstmt = null;
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
	}
	
	//TODO:BOMEXTTBL=获取模板外数据表名
	//TODO:PACKAGETBL=需要打包的sql
	private static String getSqlKey(String key,String extTable, String bosid) {
		Map sqlValue = new HashMap();
		StringBuffer bomExtTable = new StringBuffer();
		bomExtTable.append("SELECT EXTTBL ").append("\n")
				   .append("FROM T_BB_CBOBASE t, T_BB_BOMDES d").append("\n")
				   .append("WHERE t.bosid = '").append(bosid).append("'").append("\n")
				   .append("AND t.bomid = d.bomid").append("\n");
		//TODO:此sql不能换行
		StringBuffer packTable = new StringBuffer();
		packTable.append("dbms_xmlquery.getXML('")
				 .append("SELECT *  ")//.append("\n")
			     .append("FROM ").append(extTable).append(" T ")//.append("\n")
			     .append("WHERE t.bosid = ''").append(bosid).append("''")
			     .append("')");//.append("\n");
		sqlValue.put("BOMEXTTBL", bomExtTable.toString());
		sqlValue.put("PACKAGETBL", packTable.toString());
		return (String)sqlValue.get(key);
	}
	
	public static void main(String[] args) {
		getBomSql("88994");
	}
}

 

 

   IUpdateBackDAO.java

package com.legion.project.crmproject.common;

import java.util.List;

/**
 * <p>Title: 数据备份操作接口类</p>
 *
 * <p>Description: 用于备份数据查询,插入,删除操作</p>
 *
 * <p>Copyright: Copyright (c) 2008</p>
 *
 * <p>Company: Legion Technology</p>
 *
 * @author dsy
 * @version 1.0
 * @date 2008-12-04
 */
public interface IUpdateBackDAO {
	
	/**
	 * 插入公用方法
	 * @param dto
	 * 		以下值是不用设置的
	 * 		dto.setId();//序列自动生成
	 * 		dto.setBakdata();//自动根据dto.getBosid()备份模板外部表数据(XML)
	 * 		dto.setStat();	//默认为"STAR"
	 * @return
	 */
	public abstract boolean insertUpdateBAk(TCrmUpdatebakDTO dto);
	
	/**
	 * 查询公用方法
	 * @param dto
	 * 			isJoinType = "SELECT"时,根据dto中的值,自动组装查询条件
	 * @param isJoinType
	 * 			isJoinType = "SELECT"时,根据dto中参数是否有值来自动组装where
	 * 			isJoinType = ""时,查询全部数据
	 * @return List
	 */
	public abstract List searchAllByType(TCrmUpdatebakDTO dto, String isJoinType);
	
	/**
	 * 删除公用方法
	 * @param dto
	 * 			isJoinType = "DELETE"时,根据dto中的值,自动组装删除条件
	 * @param isJoinType 
	 * 			isJoinType = "DELETE"时,根据dto中参数是否有值来自动组装where
	 * 			isJoinType = ""时,删除全部数据
	 * @return boolean
	 */
	public abstract boolean deleteAllByType(TCrmUpdatebakDTO dto,
			String isJoinType);
	
}

 

UpdateBackDAO.java

package com.legion.project.crmproject.common;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import com.legion.project.crmproject.common.BaseDao;

/**
 * <p>Title: 数据备份操作工具实现类</p>
 *
 * <p>Description: 用于备份数据查询,插入,删除操作</p>
 *
 * <p>Copyright: Copyright (c) 2008</p>
 *
 * <p>Company: Legion Technology</p>
 *
 * @author dsy
 * @version 1.0
 * @date 2008-12-04
 */
public class UpdateBackDAO implements IUpdateBackDAO {
	
	private static final Logger log = Logger.getLogger(UpdateBackDAO.class.getName());
	private static IUpdateBackDAO dao = null;
	
	public static IUpdateBackDAO getInstance() {
		if(dao == null) {
			dao = new UpdateBackDAO();
		}
		return dao;
	}
	
	private static Connection getConnection() {
		Connection conn = null;
		try {
			//conn =  DAOFactory.getInstance().getCrmConnection();
			conn =  SqlStringUtil.getConnection();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return conn;
	}
	
	/* (non-Javadoc)
	 * @see com.legion.backup.IUpdateBackDAO#insertUpdateBAk(com.legion.backup.TCrmUpdatebakDTO)
	 */
	public boolean insertUpdateBAk(TCrmUpdatebakDTO dto) {
		log.info("[UpdateBackDAO].[insertUpdateBAk()] begin..............");
		boolean insertBool = false;
		Connection conn = null;
		PreparedStatement pstmt = null;
		
		String sql = genTableSql("INSERT",dto,"");
		conn = getConnection();
		try {
			pstmt = conn.prepareStatement(sql);
			pstmt.setString(1, dto.getBosid());
			pstmt.setString(2, dto.getBostype());
			pstmt.setString(3, dto.getTitle());
			pstmt.setString(4, dto.getUpdatetype());
			pstmt.setDate(5, new java.sql.Date(dto.getBakdate().getTime()));
			pstmt.setString(6, "system");
			pstmt.setString(7, "");
			pstmt.setString(8, "");
			pstmt.setString(9, "STAR");
			insertBool = pstmt.executeUpdate() > 0 ? true : false;
			log.info("[UpdateBackDAO].[insertUpdateBAk()]={"+dto.getBosid()+"={"+SqlStringUtil.getBomSql(dto.getBosid())+"}}");
		} catch (SQLException e) {
			log.error("[UpdateBackDAO].[insertUpdateBAk()]={"+dto.getBosid()+"={"+SqlStringUtil.getBomSql(dto.getBosid())+"}}");
			try {
				conn.rollback();
			} catch (SQLException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
			log.error("[UpdateBackDAO].[insertUpdateBAk()]" + e.getMessage());
		} finally {
			close(conn,pstmt);
		}
		log.info("[UpdateBackDAO].[insertUpdateBAk()] success..............");
		return insertBool;
	}
	
	/* (non-Javadoc)
	 * @see com.legion.backup.IUpdateBackDAO#searchAllByType(com.legion.backup.TCrmUpdatebakDTO, java.lang.String)
	 */
	public List searchAllByType(TCrmUpdatebakDTO dto,String isJoinType) {
		log.info("[UpdateBackDAO].[searchAllByType()] begin..............");
		List allValue = new ArrayList();
		boolean insertBool = false;
		Connection conn = null;
		PreparedStatement pstmt = null;
		ResultSet rs = null;
		
		TCrmUpdatebakDTO setDto = null;
		
		String sql = genTableSql("SELECT",dto,isJoinType);
		try {
			conn = getConnection();
			pstmt = conn.prepareStatement(sql);
			rs = pstmt.executeQuery();
			log.info("[TCrmUpdatebakDTO].[setDTO()] begin..................");
			while(rs.next()) {
				setDto = new TCrmUpdatebakDTO();
				setDto.setDTO(rs);
				allValue.add(setDto);
			}
			log.info("[TCrmUpdatebakDTO].[setDTO()] success..................");
		} catch (SQLException e) {
			log.info("[UpdateBackDAO].[searchAllByType()]={"+e.getMessage()+"}");
		} finally {
			close(conn,pstmt);
		}
		log.info("[UpdateBackDAO].[searchAllByType()] success..............");
		return allValue;
	}
	
	/* (non-Javadoc)
	 * @see com.legion.backup.IUpdateBackDAO#deleteAllByType(com.legion.backup.TCrmUpdatebakDTO, java.lang.String)
	 */
	public boolean deleteAllByType(TCrmUpdatebakDTO dto,String isJoinType) {
		log.info("[UpdateBackDAO].[deleteAllByType()] begin..............");
		List allValue = new ArrayList();
		boolean deleteBool = false;
		Connection conn = null;
		PreparedStatement pstmt = null;
		
		String sql = genTableSql("DELETE",dto,isJoinType);
		try {
			conn = getConnection();
			pstmt = conn.prepareStatement(sql);
			deleteBool = pstmt.executeUpdate() > 0 ? true : false;
		} catch (SQLException e) {
			log.info("[UpdateBackDAO].[deleteAllByType()]={"+e.getMessage()+"}");
		} finally {
			close(conn,pstmt);
		}
		log.info("[UpdateBackDAO].[deleteAllByType()] success..............");
		return deleteBool;
	}
	/*
	private static java.sql.Date transDate(java.util.Date utilDate) {
		java.sql.Date transDate = new java.sql.Date(utilDate.getTime());
		return transDate;
	}*/
	
	/*
	 * 用于查询当前实例所有字段方法,并按一定的数据结构进行存储
 	 * Object[0] = ID	          [NUMBER  ]=ID
	 * Object[1] = BOSID	      [VARCHAR2]=备份实例ID
	 * Object[2] = BOSTYPE	    [VARCHAR2]=实例类型
	 * Object[3] = TITLE	      [VARCHAR2]=备份标题
	 * Object[4] = UPDATETYPE	  [VARCHAR2]=修改类型
	 * Object[5] = BAKDATA	    [CLOB    ]=备份数据
	 * Object[6] = BAKDATE	    [DATE    ]=备份日期
	 * Object[7] = BAKEMPID	    [VARCHAR2]=备份人
	 * Object[8] = SRESERVED1	  [VARCHAR2]=字符预留1
	 * Object[9] = SRESERVED2	  [VARCHAR2]=字符预留2
	 * Object[10] = STAT	      [VARCHAR2]=状态
	 */
	private static Object[] getTableColumnSql() {
		List colValue = new ArrayList();
		Connection conn = null;
		PreparedStatement pstmt = null;
		ResultSet rs = null;
		String sql = "SELECT COLUMN_NAME FROM User_Tab_Cols WHERE table_name = 'T_CRM_UPDATEBAK'";
		
		conn = getConnection();
		try {
			pstmt = conn.prepareStatement(sql);
			rs = pstmt.executeQuery();
			while(rs.next()) {
				colValue.add(rs.getString(1));
			}
		} catch (SQLException e) {
			//not happen
		} finally {
			close(conn, pstmt);
		}
		return (Object[])colValue.toArray();
	}
	
	private static String genTableSql(String sqlType, TCrmUpdatebakDTO dto,String isJoinType) {
		Map sqlGen = new HashMap();
		Object[] value = null;
		if(sqlType.equals("SELECT")||sqlType.equals("INSERT")) {
			value = getTableColumnSql();
			sqlGen.put("SELECT", getSelectSql(value,dto,isJoinType));
			sqlGen.put("INSERT", getInsertSql(value,dto.getBosid()));
		} 
		if(sqlType.equals("DELETE")) {
			sqlGen.put("DELETE", getDeleteSql(dto,isJoinType));
		}
		return (String) sqlGen.get(sqlType);
	}
	
//	TODO:拼装sql-->delete查询
	private static String getDeleteSql(TCrmUpdatebakDTO dto, String isJoinType) {
		StringBuffer selectSql = new StringBuffer();
		selectSql.append("DELETE FROM T_CRM_UPDATEBAK ");
		if(!isJoinType.equalsIgnoreCase("delete")) {
			return selectSql.toString();
		} else {
			getWhereJoin(selectSql, "ID", dto.getId());
			getWhereJoin(selectSql, "BOSID", dto.getBosid());
			getWhereJoin(selectSql, "BOSTYPE", dto.getBostype());
			getWhereJoin(selectSql, "TITLE", dto.getTitle());
			getWhereJoin(selectSql, "BAKDATE", dto.getBakdate());
			getWhereJoin(selectSql, "BAKEMPID", dto.getBakempid());
			getWhereJoin(selectSql, "STAT", dto.getStat());
		}
		return selectSql.toString();
	}
	
	//TODO:拼装sql-->select查询
	private static String getSelectSql(Object[] value, TCrmUpdatebakDTO dto, String isJoinType) {
		StringBuffer selectSql = new StringBuffer();
		selectSql.append("SELECT ");
		for (int i = 0; i < value.length; i++) {
			if(i == 0) {
				selectSql.append(value[i]);
			} else {
				selectSql.append(",").append(value[i]);
			}
		}
		selectSql.append(" FROM T_CRM_UPDATEBAK ");
		if(!isJoinType.equalsIgnoreCase("query")) {
			return selectSql.toString();
		} else {
			getWhereJoin(selectSql, "ID", dto.getId());
			getWhereJoin(selectSql, "BOSID", dto.getBosid());
			getWhereJoin(selectSql, "BOSTYPE", dto.getBostype());
			getWhereJoin(selectSql, "TITLE", dto.getTitle());
			getWhereJoin(selectSql, "BAKDATE", dto.getBakdate());
			getWhereJoin(selectSql, "BAKEMPID", dto.getBakempid());
			getWhereJoin(selectSql, "STAT", dto.getStat());
		}
		return selectSql.toString();
	}
	
	/**
	 * String类型重载
	 * @param whereSql
	 * @param columnName
	 * @param whereKey
	 */
	private static void getWhereJoin(StringBuffer whereSql, String columnName, String whereKey) {
		if(whereKey != null&&!"".equals(whereKey) ) {
			checkWhereKey(whereSql);
			whereSql.append(columnName)
					.append("='")
					.append(whereKey)
					.append("' ").append("\n");
		}
	}
	
	/**
	 * Date关键字类型重载
	 * @param whereSql
	 * @param columnName
	 * @param whereKey
	 */
	private static void getWhereJoin(StringBuffer whereSql, String columnName, Date whereKey) {
		SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
		if(whereKey != null) {
			checkWhereKey(whereSql);
			whereSql.append("to_char(")
					.append(columnName)
					.append(",'yyyyMMdd')")
					.append("='")
					.append(format.format(whereKey))
					.append("' ").append("\n");
		}
	}
	
	
	/**
	 * Long关键字类型重载
	 * @param whereSql
	 * @param columnName
	 * @param whereKey
	 */
	private static void getWhereJoin(StringBuffer whereSql, String columnName, Long whereKey) {
		if(whereKey != null) {
			checkWhereKey(whereSql);
			whereSql.append(columnName)
					.append("='")
					.append(whereKey)
					.append("' ").append("\n");
		}
	}
	
	/**
	 * 检测sql中是否有where关键,有则组装And
	 * @param whereSql
	 */
	private static void checkWhereKey(StringBuffer whereSql) {
		if(whereSql.indexOf("WHERE") == -1) {
			whereSql.append("\n").append(" WHERE ");
		} else {
			whereSql.append(" AND ");
		}
	}
	
//	TODO:拼装sql-->Insert查询
	private static String getInsertSql(Object[] value,String bosid) {
		StringBuffer insertSql = new StringBuffer();
		insertSql.append("INSERT INTO  T_CRM_UPDATEBAK(");
		StringBuffer splitSql = new StringBuffer();
		for (int i = 0; i < value.length; i++) {
			if(i == 0) {
				insertSql.append(value[i]);
				splitSql.append("SEQ_T_COM_SYSLOGNUMB.nextval");
			} else {
				String backData = (String) value[i];
				if(backData.equalsIgnoreCase("BAKDATA")) {
					insertSql.append(",").append(value[i]);
					splitSql.append(",").append(SqlStringUtil.getBomSql(bosid));
				} else {
					insertSql.append(",").append(value[i]);
					splitSql.append(",").append("?");
				}
			}
		}
		insertSql.append(") ")
				 .append("VALUES(")
				 .append(splitSql.toString())
				 .append(")");
		return insertSql.toString();
	}
	
	protected static void close(Connection conn, PreparedStatement pstmt) {
		SqlStringUtil.close(conn, pstmt);
	}
	
	
	public static void main(String[] args) {
		//getTableTypeSql();
		TCrmUpdatebakDTO dto = new TCrmUpdatebakDTO();
		dto.setBosid("88994");
		dto.setBostype("UpdateBackDAO test");
		dto.setTitle("UpdateBackDAO");
		dto.setUpdatetype("UpdateBackDAO ADD");
		dto.setBakdate(new java.util.Date());
		dto.setStat("STAR");
		//System.out.println(insertUpdateBAk(dto));
		UpdateBackDAO.getInstance().deleteAllByType(dto,"");
//		List testList = UpdateBackDAO.getInstance().searchAllByType(dto, "");
//		for (int i = 0; i < testList.size(); i++) {
//			dto = new TCrmUpdatebakDTO();
//			dto = (TCrmUpdatebakDTO) testList.get(i);
//			System.out.println(i + "=" +dto.getId());
//		}
		System.out.println();
	}
}

 

TCrmUpdatebakDTO.java

package com.legion.project.crmproject.common;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

import org.apache.log4j.Logger;

/**
 * <p>Title: TCrmUpdatebak entity.</p>
 *
 * <p>Description: 当前实例备份表</p>
 *
 * <p>Copyright: Copyright (c) 2008</p>
 *
 * <p>Company: Legion Technology</p>
 *
 * @author dsy
 * @version 1.0
 * @date 2008-12-04
 */
public class TCrmUpdatebakDTO implements java.io.Serializable {

	private static final Logger log = Logger.getLogger(TCrmUpdatebakDTO.class.getName());

	private Long id;
	private String bosid = "";
	private String bostype = "";
	private String title = "";
	private String updatetype = "";
	private String bakdata = "";
	private Date bakdate;
	private String bakempid = "";
	private String sreserved1 = "";
	private String sreserved2 = "";
	private String stat = "";

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getBosid() {
		return this.bosid;
	}

	public void setBosid(String bosid) {
		this.bosid = bosid;
	}

	public String getBostype() {
		return this.bostype;
	}

	public void setBostype(String bostype) {
		this.bostype = bostype;
	}

	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getUpdatetype() {
		return this.updatetype;
	}

	public void setUpdatetype(String updatetype) {
		this.updatetype = updatetype;
	}

	public String getBakdata() {
		return this.bakdata;
	}

	public void setBakdata(String bakdata) {
		this.bakdata = bakdata;
	}

	public Date getBakdate() {
		return this.bakdate;
	}

	public void setBakdate(Date bakdate) {
		this.bakdate = bakdate;
	}

	public String getBakempid() {
		return this.bakempid;
	}

	public void setBakempid(String bakempid) {
		this.bakempid = bakempid;
	}

	public String getSreserved1() {
		return this.sreserved1;
	}

	public void setSreserved1(String sreserved1) {
		this.sreserved1 = sreserved1;
	}

	public String getSreserved2() {
		return this.sreserved2;
	}

	public void setSreserved2(String sreserved2) {
		this.sreserved2 = sreserved2;
	}

	public String getStat() {
		return this.stat;
	}

	public void setStat(String stat) {
		this.stat = stat;
	}
	
	/*
	 * 用于查询当前实例所有字段方法,并按一定的数据结构进行存储
 	 * Object[0] = ID	          [NUMBER  ]=ID
	 * Object[1] = BOSID	      [VARCHAR2]=备份实例ID
	 * Object[2] = BOSTYPE	    [VARCHAR2]=实例类型
	 * Object[3] = TITLE	      [VARCHAR2]=备份标题
	 * Object[4] = UPDATETYPE	  [VARCHAR2]=修改类型
	 * Object[5] = BAKDATA	    [CLOB    ]=备份数据
	 * Object[6] = BAKDATE	    [DATE    ]=备份日期
	 * Object[7] = BAKEMPID	    [VARCHAR2]=备份人
	 * Object[8] = SRESERVED1	  [VARCHAR2]=字符预留1
	 * Object[9] = SRESERVED2	  [VARCHAR2]=字符预留2
	 * Object[10] = STAT	      [VARCHAR2]=状态
	 */
	public void setDTO(ResultSet rs) {
		try {
			this.setId(new Long(rs.getLong("ID")));
			this.setBosid(rs.getString("BOSID"));
			this.setBostype(rs.getString("BOSTYPE"));
			this.setTitle(rs.getString("TITLE"));
			this.setUpdatetype(rs.getString("UPDATETYPE"));
			this.setBakdate(rs.getDate("BAKDATE"));
			this.setBakempid(rs.getString("BAKEMPID"));
			this.setStat(rs.getString("STAT"));
		} catch (SQLException e) {
			log.error("[TCrmUpdatebakDTO].[setDTO()]={"+e.getMessage()+"}");
		}
	}
}

 

分享到:
评论

相关推荐

    电子政务-自行车电子看守装置.zip

    电子政务,作为现代信息技术在公共管理领域的应用,已经成为提升政府服务效率、促进社会信息化发展的重要手段。在这个领域中,自行车电子看守装置是其中的一个重要组成部分,它利用先进的物联网技术,实现了对公共...

    --智慧看守所智慧监管信息化管控平台综合建设解决方案.doc

    智慧看守所智慧监管信息化管控平台综合建设解决方案 智慧看守所智慧监管信息化管控平台综合建设解决方案是指利用信息化技术和智能化手段对看守所的监管工作进行智能化升级,提高监管效率和质量,实现看守所的智能化...

    --智慧看守所智能化监管信息化管控系统建设整体解决方案.doc

    智慧看守所智能化监管信息化管控系统的建设是当前警务工作现代化的重要组成部分,旨在提高监管效率,保障监所安全,实现管理的精细化和智能化。本解决方案详细阐述了系统的设计目标、原则,以及各个关键组件的构建。...

    建筑施工组织2021-南召县看守所迁建工程.doc

    建筑施工组织2021-南召县看守所迁建工程.doc

    --智慧看守所智慧监管信息化管控平台综合解决方案.doc

    "智慧看守所智慧监管信息化管控平台综合解决方案" 本解决方案旨在提供一个全面的智慧看守所智慧监管信息化管控平台综合解决方案,旨在提高看守所的管理效率和安全性。本解决方案包括总体说明、设计目标、设计原则、...

    精选施工方案范例模板-南召县看守所迁建工程

    "精选施工方案范例模板-南召县看守所迁建工程"是一个具体的施工方案实例,主要关注的是南召县看守所的迁移与重建工作。下面我们将深入探讨该施工方案可能涉及的多个知识点。 1. **前期规划**:施工方案的制定始于...

    C++23种设计模式一点就通

    - **例子**:“看守者”的比喻形象地解释了观察者模式的作用。在安全监控系统中,一旦被监控的目标发生变化,监控系统就会立即作出响应,这就相当于通过观察者模式实现了对象之间的关联。 **19. 状态模式 (STATE)**...

    JGJ127-2000看守所建筑设计规范[整理].pdf

    JGJ127-2000看守所建筑设计规范[整理].pdf

    与林冲有关的歇后语-林冲看守草料场参考.doc

    与林冲有关的歇后语-林冲看守草料场参考.doc

    智慧看守所信息化系统建设及应用方案.ppt

    通过这些技术的集成应用,智慧看守所能够实现高效、安全、智能的管理模式,提升监管工作的现代化水平。例如,分布式综合管理系统可以整合多个会议室的音视频信号,便于控制中心统一调度;交互式无纸化系统则在应急...

    算法中的皇宫看守问题求解

    算法中的皇宫看守问题求解

    watcher-tools:看守工具

    看守工具 您将在该项目中找到剧本和模板文件,以帮助您在计算机上部署和链。 使用Ansible进行部署 请参阅[ansible / README.md] 使用Docker部署 请参阅[docker / README.md]

    与林冲有关的歇后语-林冲看守草料场精选.doc

    这部分内容没有直接涉及“林冲看守草料场”的歇后语,但提到了林冲在《水浒传》中的一个经典情节——林冲被派去看守草料场,遭遇火灾,最终促使他走上梁山的故事。 1. 错别字检查:题目考察学生对汉字的准确识别,...

    基于windwos服务的看守进程

    看守进程(Watchdog Process)的概念源于嵌入式系统,这里被应用到Windows环境,用于确保关键进程的稳定运行。当被看守的进程出现问题,如意外退出或崩溃时,看守进程可以检测到这一情况并采取相应的恢复措施,如...

    智慧看守所智慧监管信息化管理平台建设方案.pptx

    4. 虚拟现实技术应用:应用虚拟现实技术,实现看守所人员的模拟实训,解决看守所人员的培训和教育问题。 看守所智能监管信息化管理平台的主要功能包括: 1. 智能安防系统:通过多模态智能安防系统对看守所内区域...

    Java-Sales:Java项目存储库

    项目利用了Java的强大特性和Maven的依赖管理能力,同时引入了WatchService(看守人)来监控文件系统的变动,实现动态响应和数据更新。 ### Java核心概念 1. **面向对象编程**:Java是一种典型的面向对象编程语言,...

    05 海康(看守所摄像头).zip

    在IT行业中,摄像头的开发是监控系统不可或缺的一部分,特别是对于海康这样的知名品牌,其产品广泛应用于各种场所,如看守所、企事业单位等。本文将深入探讨如何使用Java和C++进行海康摄像头的开发,以及相关的教程...

    信息化系统管理模式.doc

    信息化系统管理模式是现代企业或组织在信息技术应用中的关键组成部分,其目标是有效地管理和优化信息流,提高工作效率,降低成本。在本文档中,信息化系统管理模式主要围绕产品目标、管理模式、开发模式、发展目标、...

    进程看守程序

    进程看守程序是一种重要的系统工具,它主要用于监控和管理计算机中的进程,确保它们稳定运行。在IT领域,尤其是在服务器管理和自动化运维中,进程看守程序扮演着不可或缺的角色。当一个程序意外终止或出现故障时,...

Global site tag (gtag.js) - Google Analytics