idgenerationfactory.java
来自「旅游自助系统」· Java 代码 · 共 65 行
JAVA
65 行
/**
*
*/
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 + =
减小字号Ctrl + -
显示快捷键?