All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tsc9526.monalisa.orm.generator.DBExchange Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
/*******************************************************************************************
 *	Copyright (c) 2016, zzg.zhou([email protected])
 * 
 *  Monalisa is free software: you can redistribute it and/or modify
 *	it under the terms of the GNU Lesser General Public License as published by
 *	the Free Software Foundation, either version 3 of the License, or
 *	(at your option) any later version.

 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU Lesser General Public License for more details.

 *	You should have received a copy of the GNU Lesser General Public License
 *	along with this program.  If not, see .
 *******************************************************************************************/
package com.tsc9526.monalisa.orm.generator;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;

import com.tsc9526.monalisa.orm.meta.MetaTable;

/**
 * 
 * @author zzg.zhou([email protected])
 */
public class DBExchange implements Serializable {
	private static final long serialVersionUID = 5069827028195702115L;

	private static ThreadLocal localExchange = new ThreadLocal();

	public static void setExchange(DBExchange exchange) {
		localExchange.set(exchange);
	}

	public static DBExchange getExchange(boolean remove) {
		DBExchange exchange = localExchange.get();
		if (remove && exchange != null) {
			localExchange.remove();
		}
		return exchange;
	}

	public static void setExchange(int index) {
		DBExchange exchange = new DBExchange();
		exchange.setIndex(index);
		setExchange(exchange);
	}

	private int index;

	private MetaTable table;

	private String sql;

	private String errorString = "NOT RUN!";

	private String dbKey;

	private Map tags = new LinkedHashMap();

	public MetaTable getTable() {
		return table;
	}

	public void setTable(MetaTable table) {
		this.table = table;
	}
	
	public void putTag(String tag,Object value){
		tags.put(tag, value);
	}
	
	public Object getTag(String tag){
		return tags.get(tag);
	}

	public String getSql() {
		return sql;
	}

	public void setSql(String sql) {
		this.sql = sql;
	}

	public String getErrorString() {
		return errorString;
	}

	public void setErrorString(String errorString) {
		this.errorString = errorString;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public String getDbKey() {
		return dbKey;
	}

	public void setDbKey(String dbKey) {
		this.dbKey = dbKey;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy