package com.chenyang.nse.bussiness.engine.infa.powercenter961.bakdata;

import com.chenyang.nse.bussiness.engine.infa.basic.xmlbean.FLATFILE;
import com.chenyang.nse.bussiness.engine.infa.basic.xmlbean.TABLEATTRIBUTE;
import com.chenyang.nse.bussiness.engine.infa.basic.xmlbean.TARGET;
import com.chenyang.nse.bussiness.engine.infa.basic.xmlbean.TARGETFIELD;
import com.chenyang.nse.bussiness.engine.infa.powercenter961.pubbean.TargetBean;
import java.util.ArrayList;
import java.util.List;

public class TargetUtil {
   public static TARGET getTatget(TargetBean tar_bean) {
      TARGET target = new TARGET();
      target.setBUSINESSNAME("");
      target.setCONSTRAINT("");
      target.setDESCRIPTION("");
      target.setNAME(tar_bean.getTar_name());
      target.setOBJECTVERSION("1");
      target.setTABLEOPTIONS("");
      target.setVERSIONNUMBER("1");
      if ("Flat File".equalsIgnoreCase(tar_bean.getDatabasetype())) {
         target.setDATABASETYPE("Flat File");
      } else if ("MSSQLSERVER".equalsIgnoreCase(tar_bean.getDatabasetype())) {
         target.setDATABASETYPE("Microsoft SQL Server");
      } else if ("INFORMIX".equalsIgnoreCase(tar_bean.getDatabasetype())) {
         target.setDATABASETYPE("Informix");
      } else if ("MYSQL".equalsIgnoreCase(tar_bean.getDatabasetype())) {
         target.setDATABASETYPE("ODBC");
      } else if ("AS400".equalsIgnoreCase(tar_bean.getDatabasetype())) {
         target.setDATABASETYPE("ODBC");
      } else if ("SYBASE".equalsIgnoreCase(tar_bean.getDatabasetype())) {
         target.setDATABASETYPE("Sybase");
      } else {
         target.setDATABASETYPE(tar_bean.getDatabasetype());
      }

      List<TARGETFIELD> targetfieldList = new ArrayList();
      if ("ORACLE".equalsIgnoreCase(tar_bean.getDatabasetype())) {
         targetfieldList = getOracleField(tar_bean);
      } else if ("DB2".equalsIgnoreCase(tar_bean.getDatabasetype())) {
         targetfieldList = getDb2Field(tar_bean);
      } else if ("INFORMIX".equalsIgnoreCase(tar_bean.getDatabasetype())) {
         targetfieldList = getInformixField(tar_bean);
      } else if ("MSSQLSERVER".equalsIgnoreCase(tar_bean.getDatabasetype())) {
         targetfieldList = getSqlserverField(tar_bean);
      } else if ("MYSQL".equalsIgnoreCase(tar_bean.getDatabasetype())) {
         targetfieldList = getMysqlField(tar_bean);
      } else if ("AS400".equalsIgnoreCase(tar_bean.getDatabasetype())) {
         targetfieldList = getASField(tar_bean);
      } else if ("SYBASE".equalsIgnoreCase(tar_bean.getDatabasetype())) {
         targetfieldList = getSybaseField(tar_bean);
      } else if ("Flat File".equalsIgnoreCase(tar_bean.getDatabasetype())) {
         FLATFILE flatfile = new FLATFILE();
         if ("1".equals(tar_bean.getFileparam())) {
            flatfile.setCODEPAGE(tar_bean.getFilebean().getCodepage());
            flatfile.setCONSECDELIMITERSASONE(tar_bean.getFilebean().getConsecdelimitersasone());
            flatfile.setDELIMITED(tar_bean.getFilebean().getDelimited());
            flatfile.setDELIMITERS(tar_bean.getFilebean().getDelimiters());
            flatfile.setESCAPECHARACTER(tar_bean.getFilebean().getEscape_character());
            flatfile.setKEEPESCAPECHAR(tar_bean.getFilebean().getKeepescapechar());
            flatfile.setLINESEQUENTIAL("NO");
            flatfile.setMULTIDELIMITERSASAND(tar_bean.getFilebean().getMultidelimitersasand());
            flatfile.setNULLCHARTYPE("ASCII");
            flatfile.setNULLCHARACTER("*");
            flatfile.setPADBYTES("1");
            flatfile.setQUOTECHARACTER(tar_bean.getFilebean().getQuote_character());
            flatfile.setREPEATABLE("NO");
            flatfile.setROWDELIMITER(tar_bean.getFilebean().getRowdelimiter());
            flatfile.setSKIPROWS("0");
            flatfile.setSTRIPTRAILINGBLANKS("NO");
         } else {
            flatfile.setCODEPAGE(tar_bean.getFilebean().getCodepage());
            flatfile.setCONSECDELIMITERSASONE("NO");
            flatfile.setDELIMITED("NO");
            flatfile.setDELIMITERS("NO");
            flatfile.setESCAPECHARACTER("");
            flatfile.setKEEPESCAPECHAR("DOUBLE");
            flatfile.setLINESEQUENTIAL(tar_bean.getFilebean().getLinesequential());
            flatfile.setMULTIDELIMITERSASAND("NO");
            flatfile.setNULLCHARTYPE(tar_bean.getFilebean().getNullchartype());
            flatfile.setNULLCHARACTER(tar_bean.getFilebean().getNull_character());
            flatfile.setPADBYTES(tar_bean.getFilebean().getPadbytes());
            flatfile.setQUOTECHARACTER("DOUBLE");
            flatfile.setREPEATABLE(tar_bean.getFilebean().getRepeatable());
            flatfile.setROWDELIMITER("0");
            flatfile.setSKIPROWS("0");
            flatfile.setSTRIPTRAILINGBLANKS(tar_bean.getFilebean().getStriptrailingblanks());
         }

         target.setFLATFILE(flatfile);
         if ("".equals(tar_bean.getDateformateparam()) || tar_bean.getDateformateparam() == null) {
            tar_bean.setDateformateparam("A  19 mm/dd/yyyy hh24:mi:ss");
         }

         String[] attributeStr = new String[]{"Datetime Format@" + tar_bean.getDateformateparam(), "Thousand Separator@None", "Decimal Separator@.", "Line Endings@System default"};
         String[] tmpAttr = null;
         TABLEATTRIBUTE[] attribute = new TABLEATTRIBUTE[attributeStr.length];

         for(int j = 0; j < attributeStr.length; ++j) {
            tmpAttr = attributeStr[j].split("@");
            attribute[j] = new TABLEATTRIBUTE();
            attribute[j].setNAME(tmpAttr[0]);
            if (tmpAttr.length > 1) {
               attribute[j].setVALUE(tmpAttr[1]);
            } else {
               attribute[j].setVALUE("");
            }

            target.getTABLEATTRIBUTE().add(attribute[j]);
         }

         targetfieldList = getFileField(tar_bean);
      }

      for(TARGETFIELD targetfield : targetfieldList) {
         target.getTARGETFIELD().add(targetfield);
      }

      return target;
   }

   public static List<TARGETFIELD> getOracleField(TargetBean tar_bean) {
      List<TARGETFIELD> targetFieldList = new ArrayList();

      for(int i = 0; i < tar_bean.getCb().getNameList().size(); ++i) {
         TARGETFIELD targetfield = new TARGETFIELD();
         targetfield.setBUSINESSNAME("");
         if ("VARCHAR2".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("varchar2");
         } else if ("NUMBER".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("15");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("number");
         } else if ("DATE".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("19");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("date");
         } else if ("CLOB".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4000");
            targetfield.setDATATYPE("clob");
         } else if ("BLOB".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4000");
            targetfield.setDATATYPE("blob");
         } else if ("BFILE".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4000");
            targetfield.setDATATYPE("long raw");
         } else if ("BINARY_DOUBLE".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("15");
            targetfield.setDATATYPE("number");
         } else if ("BINARY_FLOAT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("15");
            targetfield.setDATATYPE("number");
         } else if ("CHAR".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("1");
            targetfield.setDATATYPE("char");
         } else if ("number(p,s)".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("38");
            targetfield.setDATATYPE("number(p,s)");
         } else if ("number(p,s)".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("38");
            targetfield.setDATATYPE("number(p,s)");
         } else if ("INTERVAL DAY(2) TO SECOND(6)".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("0");
            targetfield.setDATATYPE("varchar2");
         } else if ("INTERVAL YEAR(2) TO MONTH".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("0");
            targetfield.setDATATYPE("varchar2");
         } else if ("LONG".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4000");
            targetfield.setDATATYPE("long");
         } else if ("NCHAR".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("1");
            targetfield.setDATATYPE("varchar2");
         } else if ("NVARCHAR2".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("20");
            targetfield.setDATATYPE("varchar2");
         } else if ("NCLOB".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("0");
            targetfield.setDATATYPE("varchar2");
         } else if ("RAW".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("20");
            targetfield.setDATATYPE("raw");
         } else if ("ROWID".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("0");
            targetfield.setDATATYPE("varchar2");
         } else if ("TIMESTAMP(6)".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("6");
            targetfield.setPRECISION("26");
            targetfield.setDATATYPE("timestamp");
         } else if ("UROWID".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("0");
            targetfield.setDATATYPE("varchar2");
         } else if ("FLOAT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION("15");
            targetfield.setDATATYPE("number");
         } else {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE((String)tar_bean.getCb().getTypeList().get(i));
         }

         targetfield.setDESCRIPTION("");
         targetfield.setFIELDNUMBER("" + (i + 1));
         targetfield.setKEYTYPE((String)tar_bean.getCb().getKeytype().get(i));
         targetfield.setNAME((String)tar_bean.getCb().getNameList().get(i));
         if ("PRIMARY KEY".equals(tar_bean.getCb().getKeytype().get(i))) {
            targetfield.setNULLABLE("NOTNULL");
         } else {
            targetfield.setNULLABLE("NULL");
         }

         targetfield.setPICTURETEXT("");
         targetFieldList.add(targetfield);
      }

      return targetFieldList;
   }

   public static List<TARGETFIELD> getDb2Field(TargetBean tar_bean) {
      List<TARGETFIELD> targetFieldList = new ArrayList();

      for(int i = 0; i < tar_bean.getCb().getNameList().size(); ++i) {
         TARGETFIELD targetfield = new TARGETFIELD();
         targetfield.setBUSINESSNAME("");
         if ("blob".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("4000");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("Byte");
         } else if ("boolean".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("5");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("SmallInt");
         } else if ("byte".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("4000");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("Byte");
         } else if ("varchar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("varchar");
         } else if ("char".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("Char");
         } else if ("clob".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4000");
            targetfield.setDATATYPE("Text");
         } else if ("date".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("10");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("Date");
         } else if ("datetime".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("25");
            targetfield.setSCALE("5");
            targetfield.setDATATYPE("Datetime year to fraction(5)");
         } else if ("float".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("15");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("Float");
         } else if ("int8".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("19");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("Int8");
         } else if ("int".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("10");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("Integer");
         } else if ("money".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("16");
            targetfield.setSCALE("2");
            targetfield.setDATATYPE("Money");
         } else if ("nchar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("char");
         } else if ("nvarchar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("NVarchar");
         } else if ("lvarchar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("varchar");
         } else if ("serial".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("10");
            targetfield.setDATATYPE("Serial");
         } else if ("serial8".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("19");
            targetfield.setDATATYPE("Int8");
         } else if ("smallfloat".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("7");
            targetfield.setDATATYPE("SmallFloat");
         } else if ("smallint".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("5");
            targetfield.setDATATYPE("SmallInt");
         } else if ("decimal".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("Decimal");
         } else if ("INTEGER".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("integer");
         } else if ("DECFLOAT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION("15");
            targetfield.setDATATYPE("float");
         } else if ("double".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION("15");
            targetfield.setDATATYPE("Decimal");
         } else {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE((String)tar_bean.getCb().getTypeList().get(i));
         }

         targetfield.setDESCRIPTION("");
         targetfield.setFIELDNUMBER("" + (i + 1));
         targetfield.setKEYTYPE((String)tar_bean.getCb().getKeytype().get(i));
         targetfield.setNAME((String)tar_bean.getCb().getNameList().get(i));
         if ("PRIMARY KEY".equals(tar_bean.getCb().getKeytype().get(i))) {
            targetfield.setNULLABLE("NOTNULL");
         } else {
            targetfield.setNULLABLE("NULL");
         }

         targetfield.setPICTURETEXT("");
         targetFieldList.add(targetfield);
      }

      return targetFieldList;
   }

   public static List<TARGETFIELD> getSqlserverField(TargetBean tar_bean) {
      List<TARGETFIELD> targetFieldList = new ArrayList();

      for(int i = 0; i < tar_bean.getCb().getNameList().size(); ++i) {
         TARGETFIELD targetfield = new TARGETFIELD();
         targetfield.setBUSINESSNAME("");
         if ("bigint".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("19");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("bigint");
         } else if ("binary".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("binary");
         } else if ("bit".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("1");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("bit");
         } else if ("char".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("char");
         } else if ("date".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("3");
            targetfield.setPRECISION("23");
            targetfield.setDATATYPE("datetime");
         } else if ("datetime".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("3");
            targetfield.setPRECISION("23");
            targetfield.setDATATYPE("datetime");
         } else if ("datetime2".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("27");
            targetfield.setSCALE("7");
            targetfield.setDATATYPE("datetime2");
         } else if ("datetimeoffset".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("34");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("nvarchar");
         } else if ("decimal".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("decimal");
         } else if ("real".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("7");
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setDATATYPE("real");
         } else if ("geography".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("varchar");
         } else if ("geometry".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("varchar");
         } else if ("hierarchyid".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("892");
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("varchar");
         } else if ("image".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4000");
            targetfield.setDATATYPE("image");
         } else if ("int".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("10");
            targetfield.setDATATYPE("int");
         } else if ("money".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("4");
            targetfield.setPRECISION("19");
            targetfield.setDATATYPE("money");
         } else if ("nchar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("nchar");
         } else if ("ntext".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("104857600");
            targetfield.setDATATYPE("ntext");
         } else if ("numeric".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("numeric");
         } else if ("nvarchar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("nvarchar");
         } else if ("smalldatetime".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION("19");
            targetfield.setDATATYPE("smalldatetime");
         } else if ("smallint".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION("5");
            targetfield.setDATATYPE("smallint");
         } else if ("smallmoney".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("4");
            targetfield.setPRECISION("10");
            targetfield.setDATATYPE("smallmoney");
         } else if ("sql_variant".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("4");
            targetfield.setPRECISION("8000");
            targetfield.setDATATYPE("varchar");
         } else if ("sysname".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("128");
            targetfield.setDATATYPE("nvarchar");
         } else if ("text".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4000");
            targetfield.setDATATYPE("text");
         } else if ("time".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("3");
            targetfield.setPRECISION("23");
            targetfield.setDATATYPE("datetime");
         } else if ("timestamp".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("8");
            targetfield.setDATATYPE("timestamp");
         } else if ("tinyint".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("3");
            targetfield.setDATATYPE("tinyint");
         } else if ("uniqueidentifier".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("38");
            targetfield.setDATATYPE("varchar");
         } else if ("float".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION("15");
            targetfield.setDATATYPE("float");
         } else if ("varbinary".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("varchar");
         } else if ("varchar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("varchar");
         } else {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE((String)tar_bean.getCb().getTypeList().get(i));
         }

         targetfield.setDESCRIPTION("");
         targetfield.setFIELDNUMBER("" + (i + 1));
         targetfield.setKEYTYPE((String)tar_bean.getCb().getKeytype().get(i));
         targetfield.setNAME((String)tar_bean.getCb().getNameList().get(i));
         targetfield.setPICTURETEXT("");
         if ("PRIMARY KEY".equals(tar_bean.getCb().getKeytype().get(i))) {
            targetfield.setNULLABLE("NOTNULL");
         } else {
            targetfield.setNULLABLE("NULL");
         }

         targetFieldList.add(targetfield);
      }

      return targetFieldList;
   }

   public static List<TARGETFIELD> getMysqlField(TargetBean tar_bean) {
      List<TARGETFIELD> targetFieldList = new ArrayList();

      for(int i = 0; i < tar_bean.getCb().getNameList().size(); ++i) {
         TARGETFIELD targetfield = new TARGETFIELD();
         targetfield.setBUSINESSNAME("");
         if ("TINYINT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("3");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("tinyint");
         } else if ("SMALLINT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("5");
            targetfield.setDATATYPE("smallint");
         } else if ("MEDIUMINT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("integer");
         } else if ("INT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("integer");
         } else if ("BIGINT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("bigint");
         } else if ("BIT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("1");
            targetfield.setDATATYPE("bit");
         } else if ("DOUBLE".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("15");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("double");
         } else if ("FLOAT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("7");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("real");
         } else if ("DECIMAL".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("decimal");
         } else if ("CHAR".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("255");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("nchar");
         } else if ("VARCHAR".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("nvarchar");
         } else if ("DATE".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("10");
            targetfield.setDATATYPE("date");
         } else if ("TIME".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("8");
            targetfield.setDATATYPE("time");
         } else if ("YEAR".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("5");
            targetfield.setDATATYPE("smallint");
         } else if ("TIMESTAMP".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("9");
            targetfield.setPRECISION("29");
            targetfield.setDATATYPE("timestamp");
         } else if ("DATETIME".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("9");
            targetfield.setPRECISION("29");
            targetfield.setDATATYPE("timestamp");
         } else if ("TINYBLOB".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("255");
            targetfield.setDATATYPE("longvarbinary");
         } else if ("BLOB".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("65535");
            targetfield.setDATATYPE("longvarbinary");
         } else if ("MEDIUMBLOB".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("16777215");
            targetfield.setDATATYPE("longvarbinary");
         } else if ("LONGBLOB".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4294967295");
            targetfield.setDATATYPE("longvarbinary");
         } else if ("TINYTEXT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("255");
            targetfield.setDATATYPE("ntext");
         } else if ("TEXT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("65535");
            targetfield.setDATATYPE("ntext");
         } else if ("MEDIUMTEXT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("16777215");
            targetfield.setDATATYPE("ntext");
         } else if ("LONGTEXT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4294967295");
            targetfield.setDATATYPE("ntext");
         } else if ("ENUM".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("nchar");
         } else if ("SET".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("nchar");
         } else if ("BINARY".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("255");
            targetfield.setDATATYPE("binary");
         } else if ("VARBINARY".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("255");
            targetfield.setDATATYPE("varbinary");
         } else if ("POINT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4294967294");
            targetfield.setDATATYPE("longvarbinary");
         } else if ("LINESTRING".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4294967294");
            targetfield.setDATATYPE("longvarbinary");
         } else if ("POLYGON".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4294967294");
            targetfield.setDATATYPE("longvarbinary");
         } else if ("GEOMETRY".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4294967294");
            targetfield.setDATATYPE("longvarbinary");
         } else if ("MULTIPOINT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4294967294");
            targetfield.setDATATYPE("longvarbinary");
         } else if ("MULTILINESTRING".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4294967294");
            targetfield.setDATATYPE("longvarbinary");
         } else if ("MULTIPOLYGON".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4294967294");
            targetfield.setDATATYPE("longvarbinary");
         } else if ("GEOMETRYCOLLECTION".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4294967294");
            targetfield.setDATATYPE("longvarbinary");
         } else {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE((String)tar_bean.getCb().getTypeList().get(i));
         }

         targetfield.setDESCRIPTION("");
         targetfield.setFIELDNUMBER("" + (i + 1));
         targetfield.setKEYTYPE((String)tar_bean.getCb().getKeytype().get(i));
         targetfield.setNAME((String)tar_bean.getCb().getNameList().get(i));
         targetfield.setPICTURETEXT("");
         if ("PRIMARY KEY".equals(tar_bean.getCb().getKeytype().get(i))) {
            targetfield.setNULLABLE("NOTNULL");
         } else {
            targetfield.setNULLABLE("NULL");
         }

         targetFieldList.add(targetfield);
      }

      return targetFieldList;
   }

   public static List<TARGETFIELD> getASField(TargetBean tar_bean) {
      List<TARGETFIELD> targetFieldList = new ArrayList();

      for(int i = 0; i < tar_bean.getCb().getNameList().size(); ++i) {
         TARGETFIELD targetfield = new TARGETFIELD();
         targetfield.setBUSINESSNAME("");
         if ("BIGINT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("19");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("bigint");
         } else if ("BLOB".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("1048576");
            targetfield.setDATATYPE("longvarbinary");
         } else if ("CHAR".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("5");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("char");
         } else if ("CHAR () FOR BIT DATA".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("5");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("binary");
         } else if ("CLOB".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("1048576");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("text");
         } else if ("DATE".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("10");
            targetfield.setDATATYPE("date");
         } else if ("DBCLOB".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("1048576");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("ntext");
         } else if ("DECFLOAT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("15");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("double");
         } else if ("DECIMAL".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("decimal");
         } else if ("DOUBLE".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("double");
         } else if ("GRAPHIC".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("nchar");
         } else if ("INTEGER".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("10");
            targetfield.setDATATYPE("integer");
         } else if ("LONG VARCHAR".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("32700");
            targetfield.setDATATYPE("text");
         } else if ("LONG VARGRAPHIC".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("16350");
            targetfield.setDATATYPE("ntext");
         } else if ("REAL".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION("15");
            targetfield.setDATATYPE("double");
         } else if ("SMALLINT".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("5");
            targetfield.setDATATYPE("smallint");
         } else if ("TIME".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("8");
            targetfield.setDATATYPE("time");
         } else if ("TIMESTAMP".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("9");
            targetfield.setPRECISION("29");
            targetfield.setDATATYPE("timestamp");
         } else if ("VARCHAR".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("varchar");
         } else if ("VARCHAR () FOR BIT DATA".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("varbinary");
         } else if ("VARGRAPHIC".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("nvarchar");
         } else if ("XML".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4000");
            targetfield.setDATATYPE("ntext");
         } else {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE((String)tar_bean.getCb().getTypeList().get(i));
         }

         targetfield.setDESCRIPTION("");
         targetfield.setFIELDNUMBER("" + (i + 1));
         targetfield.setKEYTYPE((String)tar_bean.getCb().getKeytype().get(i));
         targetfield.setNAME((String)tar_bean.getCb().getNameList().get(i));
         targetfield.setPICTURETEXT("");
         if ("PRIMARY KEY".equals(tar_bean.getCb().getKeytype().get(i))) {
            targetfield.setNULLABLE("NOTNULL");
         } else {
            targetfield.setNULLABLE("NULL");
         }

         targetFieldList.add(targetfield);
      }

      return targetFieldList;
   }

   public static List<TARGETFIELD> getSybaseField(TargetBean tar_bean) {
      List<TARGETFIELD> targetFieldList = new ArrayList();

      for(int i = 0; i < tar_bean.getCb().getNameList().size(); ++i) {
         TARGETFIELD targetfield = new TARGETFIELD();
         targetfield.setBUSINESSNAME("");
         if ("bigint".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("19");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("bigint");
         } else if ("binary".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("binary");
         } else if ("bit".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("bit");
         } else if ("char".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("char");
         } else if ("date".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("23");
            targetfield.setSCALE("3");
            targetfield.setDATATYPE("datetime");
         } else if ("datetime".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("23");
            targetfield.setSCALE("3");
            targetfield.setDATATYPE("datetime");
         } else if ("decimal".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setDATATYPE("decimal");
         } else if ("float".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setDATATYPE("float");
         } else if ("image".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4000");
            targetfield.setDATATYPE("decimal");
         } else if ("int".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setDATATYPE("int");
         } else if ("varchar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("varchar");
         } else if ("nchar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("nchar");
         } else if ("nvarchar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("nvarchar");
         } else if ("money".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("4");
            targetfield.setPRECISION("19");
            targetfield.setDATATYPE("money");
         } else if ("real".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("7");
            targetfield.setDATATYPE("real");
         } else if ("smalldatetime".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("19");
            targetfield.setDATATYPE("smalldatetime");
         } else if ("smallint".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("5");
            targetfield.setDATATYPE("smallint");
         } else if ("smallmoney".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("4");
            targetfield.setPRECISION("10");
            targetfield.setDATATYPE("smallmoney");
         } else if ("longsysname".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setDATATYPE("varchar");
         } else if ("sysname".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("100");
            targetfield.setDATATYPE("varchar");
         } else if ("text".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4000");
            targetfield.setDATATYPE("text");
         } else if ("time".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("3");
            targetfield.setPRECISION("23");
            targetfield.setDATATYPE("datetime");
         } else if ("timestamp".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("8");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("varbinary");
         } else if ("tinyint".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setDATATYPE("tinyint");
         } else if ("unichar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("200");
            targetfield.setDATATYPE("nchar");
         } else if ("unitext".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4000");
            targetfield.setDATATYPE("nvarchar");
         } else if ("univarchar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("200");
            targetfield.setDATATYPE("nvarchar");
         } else if ("unsigned bigint".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setDATATYPE("bigint");
         } else if ("unsigned int".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("int");
         } else if ("unsigned smallint".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("5");
            targetfield.setDATATYPE("smallint");
         } else {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE((String)tar_bean.getCb().getTypeList().get(i));
         }

         targetfield.setDESCRIPTION("");
         targetfield.setFIELDNUMBER("" + (i + 1));
         targetfield.setKEYTYPE((String)tar_bean.getCb().getKeytype().get(i));
         targetfield.setNAME((String)tar_bean.getCb().getNameList().get(i));
         targetfield.setPICTURETEXT("");
         if ("PRIMARY KEY".equals(tar_bean.getCb().getKeytype().get(i))) {
            targetfield.setNULLABLE("NOTNULL");
         } else {
            targetfield.setNULLABLE("NULL");
         }

         targetFieldList.add(targetfield);
      }

      return targetFieldList;
   }

   public static List<TARGETFIELD> getInformixField(TargetBean tar_bean) {
      List<TARGETFIELD> targetFieldList = new ArrayList();

      for(int i = 0; i < tar_bean.getCb().getNameList().size(); ++i) {
         TARGETFIELD targetfield = new TARGETFIELD();
         targetfield.setBUSINESSNAME("");
         if ("blob".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("4000");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("Byte");
         } else if ("boolean".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("5");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("SmallInt");
         } else if ("byte".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("4000");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("Byte");
         } else if ("varchar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("varchar");
         } else if ("char".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("Char");
         } else if ("clob".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("4000");
            targetfield.setDATATYPE("Text");
         } else if ("date".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("19");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("Date");
         } else if ("datetime".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("25");
            targetfield.setSCALE("5");
            targetfield.setDATATYPE("Datetime year to fraction(5)");
         } else if ("float".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("15");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("Float");
         } else if ("int8".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("19");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("Int8");
         } else if ("int".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("10");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE("Integer");
         } else if ("money".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("16");
            targetfield.setSCALE("2");
            targetfield.setDATATYPE("Money");
         } else if ("nchar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("char");
         } else if ("nvarchar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("NVarchar");
         } else if ("lvarchar".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("varchar");
         } else if ("serial".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("10");
            targetfield.setDATATYPE("Serial");
         } else if ("serial8".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("19");
            targetfield.setDATATYPE("Int8");
         } else if ("smallfloat".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("7");
            targetfield.setDATATYPE("SmallFloat");
         } else if ("smallint".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE("0");
            targetfield.setPRECISION("5");
            targetfield.setDATATYPE("SmallInt");
         } else if ("decimal".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE("Decimal");
         } else {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE((String)tar_bean.getCb().getTypeList().get(i));
         }

         targetfield.setDESCRIPTION("");
         targetfield.setFIELDNUMBER("" + (i + 1));
         targetfield.setKEYTYPE((String)tar_bean.getCb().getKeytype().get(i));
         targetfield.setNAME((String)tar_bean.getCb().getNameList().get(i));
         targetfield.setPICTURETEXT("");
         if ("PRIMARY KEY".equals(tar_bean.getCb().getKeytype().get(i))) {
            targetfield.setNULLABLE("NOTNULL");
         } else {
            targetfield.setNULLABLE("NULL");
         }

         targetFieldList.add(targetfield);
      }

      return targetFieldList;
   }

   public static List<TARGETFIELD> getFileField(TargetBean tar_bean) {
      List<TARGETFIELD> targetFieldList = new ArrayList();

      for(int i = 0; i < tar_bean.getCb().getNameList().size(); ++i) {
         TARGETFIELD targetfield = new TARGETFIELD();
         targetfield.setBUSINESSNAME("");
         if ("datetime".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("29");
            targetfield.setSCALE("9");
            targetfield.setDATATYPE((String)tar_bean.getCb().getTypeList().get(i));
            targetfield.setPICTURETEXT("");
         } else if ("bigint".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("19");
            targetfield.setSCALE("0");
            targetfield.setDATATYPE((String)tar_bean.getCb().getTypeList().get(i));
            targetfield.setPICTURETEXT("");
         } else if ("NUMBER".equalsIgnoreCase((String)tar_bean.getCb().getTypeList().get(i))) {
            targetfield.setPRECISION("15");
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setDATATYPE("number");
            targetfield.setPICTURETEXT("");
         } else {
            targetfield.setSCALE((String)tar_bean.getCb().getScalelist().get(i));
            targetfield.setPRECISION((String)tar_bean.getCb().getPrecisionList().get(i));
            targetfield.setDATATYPE((String)tar_bean.getCb().getTypeList().get(i));
            targetfield.setPICTURETEXT("");
         }

         targetfield.setDESCRIPTION("");
         targetfield.setFIELDNUMBER("" + (i + 1));
         targetfield.setKEYTYPE((String)tar_bean.getCb().getKeytype().get(i));
         targetfield.setNAME((String)tar_bean.getCb().getNameList().get(i));
         targetfield.setNULLABLE("NULL");
         targetFieldList.add(targetfield);
      }

      return targetFieldList;
   }
}
