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

📄 idgenerationfactory.java

📁 旅游自助系统
💻 JAVA
字号:
/**
 * 
 */
package org.tshs.core;

import java.sql.SQLException;

import org.tshs.core.Constant.ObjectType;
import org.tshs.exception.DBTableFullException;
import org.tshs.storage.rdbms.DbManager;

/**
 * @author Administrator
 *
 */
public class IdGenerationFactory {
	
	/**
	 * This class generate database ids .
	 * The id ranges is configured in tshs.cfg file
	 * 
	 * @param type
	 * @return
	 * @throws SQLException 
	 * @throws DBTableFullException 
	 */
	public static Long generateId(ObjectType type) throws SQLException, DBTableFullException{
		
		Long newId = null;
		
		if(type.equals(ObjectType.CLIENT)){
			
			newId = DbManager.getNewId("client");
			
		}else if(type.equals(ObjectType.CORP)){
			
			newId = DbManager.getNewId("travelcorp");
			
		}else if(type.equals(ObjectType.DEPT)){
			
			newId = DbManager.getNewId("traveldept");
			
		}else if(type.equals(ObjectType.SIGHTSPOT)){
			
			newId = DbManager.getNewId("sightspot");
			
		}else if(type.equals(ObjectType.GROUP)){
			
			newId = DbManager.getNewId("travelgroup");
			
		}
		
		return newId;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}

⌨️ 快捷键说明

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