package com.vci.server.omd.biztype.resource;
|
|
import java.util.ArrayList;
|
|
import com.vci.corba.omd.attribpool.AttribItem;
|
import com.vci.server.base.utility.AttributeHelper;
|
|
/**
|
* 提供一些常用的功能
|
* @author Administrator
|
*
|
*/
|
public class BtmTool {
|
private static BtmTool btmTool = null;
|
private BtmTool(){
|
|
}
|
public static BtmTool getInstance(){
|
if(btmTool == null){
|
btmTool = new BtmTool();
|
}
|
return btmTool;
|
}
|
|
|
/**
|
* Array ----> ArrayList
|
* @param array
|
* @return
|
*/
|
// public ArrayList<String> convertArrayToList(String[] array){
|
// ArrayList<String> list = new ArrayList<String>();
|
// for(int i = 0; i < array.length; i++){
|
// list.add(array[i]);
|
// }
|
// return list;
|
// }
|
|
/**
|
* 获取属性字段的sql语句
|
* @param array
|
* @return
|
*/
|
// public String getAbSql(AttribItem abItem){
|
// String sql = "";
|
// if(abItem == null){
|
// return sql;
|
// }
|
// String abName = abItem.name;
|
// String vtType = abItem.vtDataType;
|
// String other = abItem.other;
|
// String defValue = abItem.defValue;
|
//
|
// if(vtType.equals("VTString")){
|
// int length = 50;
|
// String lengthStr = AttributeHelper.getOtherValueByType(other, "length");
|
// if(lengthStr != null && !lengthStr.equals("")){
|
// length = Integer.valueOf(lengthStr);
|
// }
|
// sql += abName.toUpperCase() + " VARCHAR2(" + length + ")";
|
// if(!defValue.equals("")){
|
// sql += " default '" + defValue + "'";
|
// }
|
// sql += ",\n\t";
|
// }else if(vtType.equals("VTInteger") || vtType.equals("VTLong")){
|
// sql += abName.toUpperCase() + " NUMBER";
|
// if(!defValue.equals("")){
|
// sql += " default " + defValue;
|
// }
|
// sql += ",\n\t";
|
// }else if(vtType.equals("VTDouble")){
|
// int length = 20;
|
// String lengthStr = AttributeHelper.getOtherValueByType(other, "length");
|
// if(lengthStr != null && !lengthStr.equals("")){
|
// length = Integer.valueOf(lengthStr);
|
// }
|
//
|
// int accuracy = 2;
|
// String accuracyStr = AttributeHelper.getOtherValueByType(other, "accuracy");
|
// if(accuracyStr != null && !accuracyStr.equals("")){
|
// accuracy = Integer.valueOf(accuracyStr);
|
// }
|
// sql += abName.toUpperCase() + " NUMBER(" + length + ", " + accuracy +")";
|
// if(!defValue.equals("")){
|
// sql += " default " + defValue;
|
// }
|
// sql += ",\n\t";
|
// }else if(vtType.equals("VTBoolean")){
|
// sql += abName.toUpperCase() + " VARCHAR2(8)";
|
// if(!defValue.equals("")){
|
// sql += " default '" + defValue + "'";
|
// }
|
// sql += ",\n\t";
|
// }else if(vtType.equals("VTImage")){
|
// sql += abName.toUpperCase() + " VARCHAR2(255)";
|
// sql += ",\n\t";
|
// }else if(vtType.equals("VTDate")){
|
// sql += abName.toUpperCase() + " DATE";
|
// sql += ",\n\t";
|
// }else if(vtType.equals("VTTime")){
|
// sql += abName.toUpperCase() + " TIMESTAMP";
|
// sql += ",\n\t";
|
// }else if(vtType.equals("VTDateTime")){
|
// sql += abName.toUpperCase() + " TIMESTAMP";
|
// sql += ",\n\t";
|
// }else if(vtType.equals("VTNote")){
|
// sql += abName.toUpperCase() + " VARCHAR2(255)";
|
// sql += ",\n\t";
|
// }else if(vtType.equals("VTFilePath")){
|
// sql += abName.toUpperCase() + " VARCHAR2(255)";
|
// sql += ",\n\t";
|
// }else if(vtType.equals("VTClob")){
|
// sql += abName.toUpperCase() + " CLOB";
|
// sql += ",\n\t";
|
// }
|
//
|
// return sql;
|
// }
|
|
/**
|
* 获取属性other中type的值
|
* @param other
|
* @param type
|
* @return
|
*/
|
// public String getOtherValueByType(String other, String type){
|
// String[] otherArray = other.split(";");
|
// for(int i = 0; i < otherArray.length; i++){
|
// String otherValue = otherArray[i];
|
// if(otherValue.contains(type)){
|
// return otherValue.substring(otherValue.indexOf("=") + 2, otherValue.length());
|
// }
|
// }
|
// return null;
|
//
|
// }
|
}
|