Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
Nse
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
吴超
Nse
Commits
cba938dc
Commit
cba938dc
authored
Aug 19, 2025
by
wuchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新版本
parent
2b0c5343
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
1201 行增加
和
0 行删除
+1201
-0
src/main/java/com/chenyang/nse/bussiness/ccoresdf/impl/CCoreSDFTestServiceImpl.java
+161
-0
src/main/java/com/chenyang/nse/bussiness/engine/infa/powercenter961/subsetdata/ChildMappletTargetUtil.java
+972
-0
src/main/java/com/chenyang/nse/bussiness/tools/string/BinaryConversion.java
+68
-0
没有找到文件。
src/main/java/com/chenyang/nse/bussiness/ccoresdf/impl/CCoreSDFTestServiceImpl.java
0 → 100644
View file @
cba938dc
package
com
.
chenyang
.
nse
.
bussiness
.
ccoresdf
.
impl
;
import
com.chenyang.nse.bussiness.ccoresdf.CcoreSDFUtil
;
import
com.chenyang.nse.bussiness.dao.table.core.scheduler.TCoreSchedulerKmLogDao
;
import
com.chenyang.nse.bussiness.dao.table.core.scheduler.TCoreSchedulerKmRulesDao
;
import
com.chenyang.nse.bussiness.entity.orm.table.core.scheduler.TCoreSchedulerKmLog
;
import
com.chenyang.nse.bussiness.entity.orm.table.core.scheduler.TCoreSchedulerKmRules
;
import
com.chenyang.nse.bussiness.local.service.TestService
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.UUID
;
import
org.apache.shiro.codec.Hex
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
@Service
public
class
CCoreSDFTestServiceImpl
implements
TestService
{
@Autowired
private
TCoreSchedulerKmRulesDao
tCoreSchedulerKmRulesDao
;
@Autowired
private
TCoreSchedulerKmLogDao
tCoreSchedulerKmLogDao
;
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
CCoreSDFTestServiceImpl
.
class
);
@Autowired
protected
JdbcTemplate
jdbcTemplate
;
private
static
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
public
void
test
()
{
try
{
TestResult
result
=
this
.
testCCoreSDF
();
this
.
saveTestResult
(
result
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
.
getMessage
(),
e
);
}
}
public
void
initSecretKey
()
{
}
private
void
saveTestResult
(
TestResult
result
)
{
TCoreSchedulerKmLog
tCoreSchedulerKmLog
=
new
TCoreSchedulerKmLog
();
tCoreSchedulerKmLog
.
setId
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
tCoreSchedulerKmLog
.
setCreatetime
(
new
Date
());
tCoreSchedulerKmLog
.
setTestTime
(
new
Date
());
List
<
TCoreSchedulerKmRules
>
tCoreSchedulerKmRulesList
=
this
.
tCoreSchedulerKmRulesDao
.
queryAll
();
if
(
null
!=
tCoreSchedulerKmRulesList
&&
tCoreSchedulerKmRulesList
.
size
()
>
0
)
{
tCoreSchedulerKmLog
.
setRulestype
(((
TCoreSchedulerKmRules
)
tCoreSchedulerKmRulesList
.
get
(
0
)).
getRulestype
());
if
(((
TCoreSchedulerKmRules
)
tCoreSchedulerKmRulesList
.
get
(
0
)).
getHowtime
().
equals
(
""
))
{
tCoreSchedulerKmLog
.
setPollingRule
(
"每天"
);
}
else
{
String
[]
arr1
=
((
TCoreSchedulerKmRules
)
tCoreSchedulerKmRulesList
.
get
(
0
)).
getHowtime
().
split
(
","
);
StringBuilder
logBuilder
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
arr1
.
length
;
++
i
)
{
if
(
"1"
.
equals
(
arr1
[
i
]))
{
logBuilder
.
append
(
"周一"
);
}
if
(
"2"
.
equals
(
arr1
[
i
]))
{
logBuilder
.
append
(
"周二"
);
}
if
(
"3"
.
equals
(
arr1
[
i
]))
{
logBuilder
.
append
(
"周三"
);
}
if
(
"4"
.
equals
(
arr1
[
i
]))
{
logBuilder
.
append
(
"周四"
);
}
if
(
"5"
.
equals
(
arr1
[
i
]))
{
logBuilder
.
append
(
"周五"
);
}
if
(
"6"
.
equals
(
arr1
[
i
]))
{
logBuilder
.
append
(
"周六"
);
}
if
(
"7"
.
equals
(
arr1
[
i
]))
{
logBuilder
.
append
(
"周日"
);
}
}
String
pollingRule
=
""
;
if
(
null
!=
logBuilder
&&
!
""
.
equals
(
logBuilder
))
{
pollingRule
=
logBuilder
.
toString
();
tCoreSchedulerKmLog
.
setPollingRule
(
pollingRule
);
}
}
}
else
{
tCoreSchedulerKmLog
.
setPollingRule
(
"每天"
);
tCoreSchedulerKmLog
.
setRulestype
(
"0"
);
}
if
(
result
.
success
)
{
tCoreSchedulerKmLog
.
setTestResult
(
"1"
);
}
else
{
tCoreSchedulerKmLog
.
setTestResult
(
"0"
);
}
if
(
null
!=
result
.
message
&&
!
""
.
equals
(
result
.
message
.
toString
()))
{
tCoreSchedulerKmLog
.
setTestDetail
(
result
.
message
.
toString
());
}
this
.
tCoreSchedulerKmLogDao
.
save
(
tCoreSchedulerKmLog
);
}
private
TestResult
testCCoreSDF
()
{
TestResult
result
=
new
TestResult
();
Boolean
testBool
=
this
.
testDecryptKey
(
result
.
message
);
if
(
testBool
)
{
result
.
success
=
true
;
}
return
result
;
}
private
Boolean
testDecryptKey
(
StringBuffer
sb
)
{
sb
.
append
(
sdf
.
format
(
new
Date
())
+
" INFO - 开始执行加密卡加密校验:\r\n"
);
try
{
byte
[]
pucRandom
=
CcoreSDFUtil
.
getPucRandom
(
16
);
String
encrypt
=
CcoreSDFUtil
.
getEncrypt
(
pucRandom
);
if
(
null
!=
encrypt
&&
encrypt
.
length
()
>
0
)
{
sb
.
append
(
sdf
.
format
(
new
Date
())
+
" INFO - 加密卡加密成功。\r\n"
);
}
byte
[]
endData
=
Hex
.
decode
(
encrypt
);
sb
.
append
(
sdf
.
format
(
new
Date
())
+
" INFO - 开始执行加密卡解密校验:\r\n"
);
String
decrypt
=
CcoreSDFUtil
.
getDecrypt
(
endData
);
if
(
null
!=
decrypt
&&
decrypt
.
length
()
>
0
)
{
sb
.
append
(
sdf
.
format
(
new
Date
())
+
" INFO - 加密卡解密成功。\r\n"
);
}
}
catch
(
Exception
e
)
{
if
(
sb
.
toString
().
contains
(
"加密卡加密成功"
))
{
sb
.
append
(
sdf
.
format
(
new
Date
())
+
" ERR - 校验加密卡解密失败,异常为:"
);
}
else
{
sb
.
append
(
sdf
.
format
(
new
Date
())
+
" ERR - 校验加密卡加密失败,异常为:"
);
}
this
.
printException
(
sb
,
e
);
sb
.
append
(
"。\r\n"
);
return
false
;
}
return
true
;
}
private
void
printException
(
StringBuffer
sb
,
Exception
exception
)
{
sb
.
append
(
exception
.
toString
());
}
static
class
TestResult
{
boolean
success
=
false
;
StringBuffer
message
=
new
StringBuffer
();
}
}
src/main/java/com/chenyang/nse/bussiness/engine/infa/powercenter961/subsetdata/ChildMappletTargetUtil.java
0 → 100644
View file @
cba938dc
package
com
.
chenyang
.
nse
.
bussiness
.
engine
.
infa
.
powercenter961
.
subsetdata
;
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
ChildMappletTargetUtil
{
public
List
<
TARGET
>
getChildTarget
(
List
<
TargetBean
>
tb
)
{
List
<
TARGET
>
tar_list
=
new
ArrayList
();
if
(
tb
!=
null
&&
tb
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
tb
.
size
();
++
i
)
{
TARGET
target
=
new
TARGET
();
target
.
setBUSINESSNAME
(
""
);
target
.
setCONSTRAINT
(
""
);
if
(
"MSSQLSERVER"
.
equalsIgnoreCase
(((
TargetBean
)
tb
.
get
(
i
)).
getDatabasetype
()))
{
target
.
setDATABASETYPE
(
"Microsoft SQL Server"
);
}
else
{
target
.
setDATABASETYPE
(((
TargetBean
)
tb
.
get
(
i
)).
getDatabasetype
());
}
target
.
setDESCRIPTION
(
""
);
target
.
setNAME
(((
TargetBean
)
tb
.
get
(
i
)).
getTar_name
());
target
.
setOBJECTVERSION
(
"1"
);
target
.
setTABLEOPTIONS
(
""
);
target
.
setVERSIONNUMBER
(
"1"
);
for
(
TARGETFIELD
targetfield
:
getConvertTableInfoToTARGETFIELD
(((
TargetBean
)
tb
.
get
(
i
)).
getCb
().
getKeytype
(),
((
TargetBean
)
tb
.
get
(
i
)).
getCb
().
getNameList
(),
((
TargetBean
)
tb
.
get
(
i
)).
getCb
().
getTypeList
(),
((
TargetBean
)
tb
.
get
(
i
)).
getCb
().
getLengthList
(),
((
TargetBean
)
tb
.
get
(
i
)).
getCb
().
getScalelist
(),
((
TargetBean
)
tb
.
get
(
i
)).
getCb
().
getPrecisionList
(),
((
TargetBean
)
tb
.
get
(
i
)).
getDatabasetype
()))
{
target
.
getTARGETFIELD
().
add
(
targetfield
);
}
tar_list
.
add
(
target
);
}
}
return
tar_list
;
}
public
static
List
<
TARGETFIELD
>
getConvertTableInfoToTARGETFIELD
(
List
<
String
>
keytype
,
List
<
String
>
nameList
,
List
<
String
>
typeList
,
List
<
String
>
lengthList
,
List
<
String
>
scalelist
,
List
<
String
>
precisionlist
,
String
dbtype
)
{
List
targetFieldList
=
new
ArrayList
();
String
[]
targetFieldInfoStr
=
null
;
if
(
"DB2"
.
equalsIgnoreCase
(
dbtype
))
{
for
(
int
i
=
0
;
i
<
nameList
.
size
();
++
i
)
{
TARGETFIELD
targetfield
=
new
TARGETFIELD
();
targetfield
.
setBUSINESSNAME
(
""
);
if
(
"blob"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"4000"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"Byte"
);
}
else
if
(
"boolean"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"5"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"SmallInt"
);
}
else
if
(
"byte"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"4000"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"Byte"
);
}
else
if
(
"varchar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"Varchar"
);
}
else
if
(
"char"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"Char"
);
}
else
if
(
"clob"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4000"
);
targetfield
.
setDATATYPE
(
"Text"
);
}
else
if
(
"date"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"10"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"Date"
);
}
else
if
(
"datetime"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"25"
);
targetfield
.
setSCALE
(
"5"
);
targetfield
.
setDATATYPE
(
"Datetime year to fraction(5)"
);
}
else
if
(
"float"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"15"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"Float"
);
}
else
if
(
"int8"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"19"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"Int8"
);
}
else
if
(
"int"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"10"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"Integer"
);
}
else
if
(
"money"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"16"
);
targetfield
.
setSCALE
(
"2"
);
targetfield
.
setDATATYPE
(
"Money"
);
}
else
if
(
"nchar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"char"
);
}
else
if
(
"nvarchar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"NVarchar"
);
}
else
if
(
"lvarchar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"varchar"
);
}
else
if
(
"serial"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"10"
);
targetfield
.
setDATATYPE
(
"Serial"
);
}
else
if
(
"serial8"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"19"
);
targetfield
.
setDATATYPE
(
"Int8"
);
}
else
if
(
"smallfloat"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"7"
);
targetfield
.
setDATATYPE
(
"SmallFloat"
);
}
else
if
(
"smallint"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"5"
);
targetfield
.
setDATATYPE
(
"SmallInt"
);
}
else
if
(
"decimal"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"Decimal"
);
}
else
if
(
"INTEGER"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"integer"
);
}
else
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
((
String
)
typeList
.
get
(
i
));
}
targetfield
.
setDESCRIPTION
(
""
);
targetfield
.
setFIELDNUMBER
(
""
+
(
i
+
1
));
targetfield
.
setKEYTYPE
((
String
)
keytype
.
get
(
i
));
targetfield
.
setNAME
((
String
)
nameList
.
get
(
i
));
if
(
"PRIMARY KEY"
.
equals
(
keytype
.
get
(
i
)))
{
targetfield
.
setNULLABLE
(
"NOTNULL"
);
}
else
{
targetfield
.
setNULLABLE
(
"NULL"
);
}
targetfield
.
setPICTURETEXT
(
""
);
targetFieldList
.
add
(
targetfield
);
}
}
else
if
(
"ORACLE"
.
equalsIgnoreCase
(
dbtype
))
{
for
(
int
i
=
0
;
i
<
nameList
.
size
();
++
i
)
{
TARGETFIELD
targetfield
=
new
TARGETFIELD
();
targetfield
.
setBUSINESSNAME
(
""
);
if
(
"VARCHAR2"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
lengthList
.
get
(
i
));
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"varchar2"
);
}
else
if
(
"NUMBER"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"15"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"number"
);
}
else
if
(
"DATE"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"19"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"date"
);
}
else
if
(
"CLOB"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4000"
);
targetfield
.
setDATATYPE
(
"clob"
);
}
else
if
(
"BLOB"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4000"
);
targetfield
.
setDATATYPE
(
"blob"
);
}
else
if
(
"BFILE"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4000"
);
targetfield
.
setDATATYPE
(
"long raw"
);
}
else
if
(
"BINARY_DOUBLE"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"15"
);
targetfield
.
setDATATYPE
(
"number"
);
}
else
if
(
"BINARY_FLOAT"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"15"
);
targetfield
.
setDATATYPE
(
"number"
);
}
else
if
(
"CHAR"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"1"
);
targetfield
.
setDATATYPE
(
"char"
);
}
else
if
(
"number(p,s)"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"38"
);
targetfield
.
setDATATYPE
(
"number(p,s)"
);
}
else
if
(
"number(p,s)"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"38"
);
targetfield
.
setDATATYPE
(
"number(p,s)"
);
}
else
if
(
"INTERVAL DAY(2) TO SECOND(6)"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"0"
);
targetfield
.
setDATATYPE
(
"varchar2"
);
}
else
if
(
"INTERVAL YEAR(2) TO MONTH"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"0"
);
targetfield
.
setDATATYPE
(
"varchar2"
);
}
else
if
(
"LONG"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4000"
);
targetfield
.
setDATATYPE
(
"long"
);
}
else
if
(
"NCHAR"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"1"
);
targetfield
.
setDATATYPE
(
"varchar2"
);
}
else
if
(
"NVARCHAR2"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"20"
);
targetfield
.
setDATATYPE
(
"varchar2"
);
}
else
if
(
"NCLOB"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"0"
);
targetfield
.
setDATATYPE
(
"varchar2"
);
}
else
if
(
"RAW"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"20"
);
targetfield
.
setDATATYPE
(
"raw"
);
}
else
if
(
"ROWID"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"0"
);
targetfield
.
setDATATYPE
(
"varchar2"
);
}
else
if
(
"TIMESTAMP(6)"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"6"
);
targetfield
.
setPRECISION
(
"26"
);
targetfield
.
setDATATYPE
(
"timestamp"
);
}
else
if
(
"UROWID"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"0"
);
targetfield
.
setDATATYPE
(
"varchar2"
);
}
else
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
((
String
)
typeList
.
get
(
i
));
}
targetfield
.
setDESCRIPTION
(
""
);
targetfield
.
setFIELDNUMBER
(
""
+
(
i
+
1
));
targetfield
.
setKEYTYPE
((
String
)
keytype
.
get
(
i
));
targetfield
.
setNAME
((
String
)
nameList
.
get
(
i
));
if
(
"PRIMARY KEY"
.
equals
(
keytype
.
get
(
i
)))
{
targetfield
.
setNULLABLE
(
"NOTNULL"
);
}
else
{
targetfield
.
setNULLABLE
(
"NULL"
);
}
targetfield
.
setPICTURETEXT
(
""
);
targetFieldList
.
add
(
targetfield
);
}
}
else
if
(
"MSSQLSERVER"
.
equalsIgnoreCase
(
dbtype
))
{
for
(
int
i
=
0
;
i
<
nameList
.
size
();
++
i
)
{
TARGETFIELD
targetfield
=
new
TARGETFIELD
();
targetfield
.
setBUSINESSNAME
(
""
);
if
(
"bigint"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"19"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"bigint"
);
}
else
if
(
"binary"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"binary"
);
}
else
if
(
"bit"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"1"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"bit"
);
}
else
if
(
"char"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"char"
);
}
else
if
(
"date"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"3"
);
targetfield
.
setPRECISION
(
"23"
);
targetfield
.
setDATATYPE
(
"datetime"
);
}
else
if
(
"datetime"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"3"
);
targetfield
.
setPRECISION
(
"23"
);
targetfield
.
setDATATYPE
(
"datetime"
);
}
else
if
(
"datetime2"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"27"
);
targetfield
.
setSCALE
(
"7"
);
targetfield
.
setDATATYPE
(
"datetime2"
);
}
else
if
(
"datetimeoffset"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"34"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"nvarchar"
);
}
else
if
(
"decimal"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"decimal"
);
}
else
if
(
"real"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"7"
);
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"real"
);
}
else
if
(
"geography"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"varchar"
);
}
else
if
(
"geometry"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"varchar"
);
}
else
if
(
"hierarchyid"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"892"
);
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"varchar"
);
}
else
if
(
"image"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4000"
);
targetfield
.
setDATATYPE
(
"image"
);
}
else
if
(
"int"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"10"
);
targetfield
.
setDATATYPE
(
"int"
);
}
else
if
(
"money"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"4"
);
targetfield
.
setPRECISION
(
"19"
);
targetfield
.
setDATATYPE
(
"money"
);
}
else
if
(
"nchar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"nchar"
);
}
else
if
(
"ntext"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"104857600"
);
targetfield
.
setDATATYPE
(
"ntext"
);
}
else
if
(
"numeric"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"numeric"
);
}
else
if
(
"nvarchar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"nvarchar"
);
}
else
if
(
"smalldatetime"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
(
"19"
);
targetfield
.
setDATATYPE
(
"smalldatetime"
);
}
else
if
(
"smallint"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
(
"5"
);
targetfield
.
setDATATYPE
(
"smallint"
);
}
else
if
(
"smallmoney"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"4"
);
targetfield
.
setPRECISION
(
"10"
);
targetfield
.
setDATATYPE
(
"smallmoney"
);
}
else
if
(
"sql_variant"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"4"
);
targetfield
.
setPRECISION
(
"8000"
);
targetfield
.
setDATATYPE
(
"varchar"
);
}
else
if
(
"sysname"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"128"
);
targetfield
.
setDATATYPE
(
"nvarchar"
);
}
else
if
(
"text"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4000"
);
targetfield
.
setDATATYPE
(
"text"
);
}
else
if
(
"time"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"23"
);
targetfield
.
setDATATYPE
(
"datetime"
);
}
else
if
(
"timestamp"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"8"
);
targetfield
.
setDATATYPE
(
"timestamp"
);
}
else
if
(
"tinyint"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"3"
);
targetfield
.
setDATATYPE
(
"tinyint"
);
}
else
if
(
"uniqueidentifier"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"38"
);
targetfield
.
setDATATYPE
(
"varchar"
);
}
else
if
(
"varbinary"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"varchar"
);
}
else
if
(
"varchar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"varchar"
);
}
else
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
((
String
)
typeList
.
get
(
i
));
}
targetfield
.
setDESCRIPTION
(
""
);
targetfield
.
setFIELDNUMBER
(
""
+
(
i
+
1
));
targetfield
.
setKEYTYPE
((
String
)
keytype
.
get
(
i
));
targetfield
.
setNAME
((
String
)
nameList
.
get
(
i
));
if
(
"PRIMARY KEY"
.
equals
(
keytype
.
get
(
i
)))
{
targetfield
.
setNULLABLE
(
"NOTNULL"
);
}
else
{
targetfield
.
setNULLABLE
(
"NULL"
);
}
targetfield
.
setPICTURETEXT
(
""
);
targetFieldList
.
add
(
targetfield
);
}
}
else
if
(
"INFORMIX"
.
equalsIgnoreCase
(
dbtype
))
{
for
(
int
i
=
0
;
i
<
nameList
.
size
();
++
i
)
{
TARGETFIELD
targetfield
=
new
TARGETFIELD
();
targetfield
.
setBUSINESSNAME
(
""
);
if
(
"blob"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"4000"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"Byte"
);
}
else
if
(
"boolean"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"5"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"SmallInt"
);
}
else
if
(
"byte"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"4000"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"Byte"
);
}
else
if
(
"varchar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"Varchar"
);
}
else
if
(
"char"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"Char"
);
}
else
if
(
"clob"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4000"
);
targetfield
.
setDATATYPE
(
"Text"
);
}
else
if
(
"date"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"19"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"Date"
);
}
else
if
(
"datetime"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"25"
);
targetfield
.
setSCALE
(
"5"
);
targetfield
.
setDATATYPE
(
"Datetime year to fraction(5)"
);
}
else
if
(
"float"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"15"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"Float"
);
}
else
if
(
"int8"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"19"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"Int8"
);
}
else
if
(
"int"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"10"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"Integer"
);
}
else
if
(
"money"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"16"
);
targetfield
.
setSCALE
(
"2"
);
targetfield
.
setDATATYPE
(
"Money"
);
}
else
if
(
"nchar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"char"
);
}
else
if
(
"nvarchar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"NVarchar"
);
}
else
if
(
"lvarchar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"varchar"
);
}
else
if
(
"serial"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"10"
);
targetfield
.
setDATATYPE
(
"Serial"
);
}
else
if
(
"serial8"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"19"
);
targetfield
.
setDATATYPE
(
"Int8"
);
}
else
if
(
"smallfloat"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"7"
);
targetfield
.
setDATATYPE
(
"SmallFloat"
);
}
else
if
(
"smallint"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"5"
);
targetfield
.
setDATATYPE
(
"SmallInt"
);
}
else
if
(
"decimal"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"Decimal"
);
}
else
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
((
String
)
typeList
.
get
(
i
));
}
targetfield
.
setDESCRIPTION
(
""
);
targetfield
.
setFIELDNUMBER
(
""
+
(
i
+
1
));
targetfield
.
setKEYTYPE
((
String
)
keytype
.
get
(
i
));
targetfield
.
setNAME
((
String
)
nameList
.
get
(
i
));
if
(
"PRIMARY KEY"
.
equals
(
keytype
.
get
(
i
)))
{
targetfield
.
setNULLABLE
(
"NOTNULL"
);
}
else
{
targetfield
.
setNULLABLE
(
"NULL"
);
}
targetfield
.
setPICTURETEXT
(
""
);
targetFieldList
.
add
(
targetfield
);
}
}
else
if
(
"MYSQL"
.
equalsIgnoreCase
(
dbtype
))
{
for
(
int
i
=
0
;
i
<
nameList
.
size
();
++
i
)
{
TARGETFIELD
targetfield
=
new
TARGETFIELD
();
targetfield
.
setBUSINESSNAME
(
""
);
if
(
"TINYINT"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"3"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"tinyint"
);
}
else
if
(
"SMALLINT"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"5"
);
targetfield
.
setDATATYPE
(
"smallint"
);
}
else
if
(
"MEDIUMINT"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"integer"
);
}
else
if
(
"INT"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"integer"
);
}
else
if
(
"BIGINT"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"bigint"
);
}
else
if
(
"BIT"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"1"
);
targetfield
.
setDATATYPE
(
"bit"
);
}
else
if
(
"DOUBLE"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"double"
);
}
else
if
(
"FLOAT"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"real"
);
}
else
if
(
"DECIMAL"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"decimal"
);
}
else
if
(
"CHAR"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"255"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"nchar"
);
}
else
if
(
"VARCHAR"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"nvarchar"
);
}
else
if
(
"DATE"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"10"
);
targetfield
.
setDATATYPE
(
"date"
);
}
else
if
(
"TIME"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"8"
);
targetfield
.
setDATATYPE
(
"time"
);
}
else
if
(
"YEAR"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"5"
);
targetfield
.
setDATATYPE
(
"smallint"
);
}
else
if
(
"TIMESTAMP"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"9"
);
targetfield
.
setPRECISION
(
"29"
);
targetfield
.
setDATATYPE
(
"timestamp"
);
}
else
if
(
"DATETIME"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"9"
);
targetfield
.
setPRECISION
(
"29"
);
targetfield
.
setDATATYPE
(
"timestamp"
);
}
else
if
(
"TINYBLOB"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"255"
);
targetfield
.
setDATATYPE
(
"longvarbinary"
);
}
else
if
(
"BLOB"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"65535"
);
targetfield
.
setDATATYPE
(
"longvarbinary"
);
}
else
if
(
"MEDIUMBLOB"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"16777215"
);
targetfield
.
setDATATYPE
(
"longvarbinary"
);
}
else
if
(
"LONGBLOB"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4294967295"
);
targetfield
.
setDATATYPE
(
"longvarbinary"
);
}
else
if
(
"TINYTEXT"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"255"
);
targetfield
.
setDATATYPE
(
"ntext"
);
}
else
if
(
"TEXT"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"65535"
);
targetfield
.
setDATATYPE
(
"ntext"
);
}
else
if
(
"MEDIUMTEXT"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"16777215"
);
targetfield
.
setDATATYPE
(
"ntext"
);
}
else
if
(
"LONGTEXT"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4294967295"
);
targetfield
.
setDATATYPE
(
"ntext"
);
}
else
if
(
"ENUM"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"nchar"
);
}
else
if
(
"SET"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"nchar"
);
}
else
if
(
"BINARY"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"255"
);
targetfield
.
setDATATYPE
(
"binary"
);
}
else
if
(
"VARBINARY"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"255"
);
targetfield
.
setDATATYPE
(
"varbinary"
);
}
else
if
(
"POINT"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4294967294"
);
targetfield
.
setDATATYPE
(
"longvarbinary"
);
}
else
if
(
"LINESTRING"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4294967294"
);
targetfield
.
setDATATYPE
(
"longvarbinary"
);
}
else
if
(
"POLYGON"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4294967294"
);
targetfield
.
setDATATYPE
(
"longvarbinary"
);
}
else
if
(
"GEOMETRY"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4294967294"
);
targetfield
.
setDATATYPE
(
"longvarbinary"
);
}
else
if
(
"MULTIPOINT"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4294967294"
);
targetfield
.
setDATATYPE
(
"longvarbinary"
);
}
else
if
(
"MULTILINESTRING"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4294967294"
);
targetfield
.
setDATATYPE
(
"longvarbinary"
);
}
else
if
(
"MULTIPOLYGON"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4294967294"
);
targetfield
.
setDATATYPE
(
"longvarbinary"
);
}
else
if
(
"GEOMETRYCOLLECTION"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4294967294"
);
targetfield
.
setDATATYPE
(
"longvarbinary"
);
}
else
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
((
String
)
typeList
.
get
(
i
));
}
targetfield
.
setDESCRIPTION
(
""
);
targetfield
.
setFIELDNUMBER
(
""
+
(
i
+
1
));
targetfield
.
setKEYTYPE
((
String
)
keytype
.
get
(
i
));
targetfield
.
setNAME
((
String
)
nameList
.
get
(
i
));
if
(
"PRIMARY KEY"
.
equals
(
keytype
.
get
(
i
)))
{
targetfield
.
setNULLABLE
(
"NOTNULL"
);
}
else
{
targetfield
.
setNULLABLE
(
"NULL"
);
}
targetfield
.
setPICTURETEXT
(
""
);
targetFieldList
.
add
(
targetfield
);
}
}
else
if
(
"SYBASE"
.
equalsIgnoreCase
(
dbtype
))
{
for
(
int
i
=
0
;
i
<
nameList
.
size
();
++
i
)
{
TARGETFIELD
targetfield
=
new
TARGETFIELD
();
targetfield
.
setBUSINESSNAME
(
""
);
if
(
"bigint"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"19"
);
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"bigint"
);
}
else
if
(
"binary"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"binary"
);
}
else
if
(
"bit"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"bit"
);
}
else
if
(
"char"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"char"
);
}
else
if
(
"date"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"23"
);
targetfield
.
setSCALE
(
"3"
);
targetfield
.
setDATATYPE
(
"datetime"
);
}
else
if
(
"datetime"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
(
"23"
);
targetfield
.
setSCALE
(
"3"
);
targetfield
.
setDATATYPE
(
"datetime"
);
}
else
if
(
"decimal"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"decimal"
);
}
else
if
(
"float"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"float"
);
}
else
if
(
"image"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4000"
);
targetfield
.
setDATATYPE
(
"decimal"
);
}
else
if
(
"longsysname"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"varchar"
);
}
else
if
(
"sysname"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"100"
);
targetfield
.
setDATATYPE
(
"varchar"
);
}
else
if
(
"int"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"int"
);
}
else
if
(
"varchar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setDATATYPE
(
"varchar"
);
}
else
if
(
"money"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"4"
);
targetfield
.
setPRECISION
(
"19"
);
targetfield
.
setDATATYPE
(
"money"
);
}
else
if
(
"nchar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"nchar"
);
}
else
if
(
"nvarchar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"nvarchar"
);
}
else
if
(
"real"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"7"
);
targetfield
.
setDATATYPE
(
"real"
);
}
else
if
(
"smalldatetime"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"19"
);
targetfield
.
setDATATYPE
(
"smalldatetime"
);
}
else
if
(
"smallint"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"5"
);
targetfield
.
setDATATYPE
(
"smallint"
);
}
else
if
(
"smallmoney"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"4"
);
targetfield
.
setPRECISION
(
"10"
);
targetfield
.
setDATATYPE
(
"smallmoney"
);
}
else
if
(
"text"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4000"
);
targetfield
.
setDATATYPE
(
"text"
);
}
else
if
(
"time"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"3"
);
targetfield
.
setPRECISION
(
"23"
);
targetfield
.
setDATATYPE
(
"datetime"
);
}
else
if
(
"timestamp"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"varbinary"
);
}
else
if
(
"tinyint"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"tinyint"
);
}
else
if
(
"unichar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"200"
);
targetfield
.
setDATATYPE
(
"nchar"
);
}
else
if
(
"unitext"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"4000"
);
targetfield
.
setDATATYPE
(
"nvarchar"
);
}
else
if
(
"univarchar"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"200"
);
targetfield
.
setDATATYPE
(
"nvarchar"
);
}
else
if
(
"unsigned bigint"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"bigint"
);
}
else
if
(
"unsigned int"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
(
"int"
);
}
else
if
(
"unsigned smallint"
.
equalsIgnoreCase
((
String
)
typeList
.
get
(
i
)))
{
targetfield
.
setSCALE
(
"0"
);
targetfield
.
setPRECISION
(
"5"
);
targetfield
.
setDATATYPE
(
"smallint"
);
}
else
{
targetfield
.
setSCALE
((
String
)
scalelist
.
get
(
i
));
targetfield
.
setPRECISION
((
String
)
precisionlist
.
get
(
i
));
targetfield
.
setDATATYPE
((
String
)
precisionlist
.
get
(
i
));
}
targetfield
.
setDESCRIPTION
(
""
);
targetfield
.
setFIELDNUMBER
(
""
+
(
i
+
1
));
targetfield
.
setKEYTYPE
((
String
)
keytype
.
get
(
i
));
targetfield
.
setNAME
((
String
)
nameList
.
get
(
i
));
if
(
"PRIMARY KEY"
.
equals
(
keytype
.
get
(
i
)))
{
targetfield
.
setNULLABLE
(
"NOTNULL"
);
}
else
{
targetfield
.
setNULLABLE
(
"NULL"
);
}
targetfield
.
setPICTURETEXT
(
""
);
targetFieldList
.
add
(
targetfield
);
}
}
return
targetFieldList
;
}
public
List
<
TARGET
>
getTargetOther
(
List
<
TargetBean
>
tb
)
{
List
<
TARGET
>
tar_list
=
new
ArrayList
();
if
(
tb
!=
null
&&
tb
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
tb
.
size
();
++
i
)
{
TARGET
target
=
new
TARGET
();
target
.
setBUSINESSNAME
(
""
);
target
.
setCONSTRAINT
(
""
);
target
.
setDATABASETYPE
(
"Flat File"
);
target
.
setDESCRIPTION
(
""
);
target
.
setNAME
(
"target_tab_candidate"
+
i
);
target
.
setOBJECTVERSION
(
"1"
);
target
.
setTABLEOPTIONS
(
""
);
target
.
setVERSIONNUMBER
(
"1"
);
FLATFILE
flatfile
=
new
FLATFILE
();
flatfile
.
setCODEPAGE
(
"MS1252"
);
flatfile
.
setCONSECDELIMITERSASONE
(
"NO"
);
flatfile
.
setDELIMITED
(
"YES"
);
flatfile
.
setDELIMITERS
(
","
);
flatfile
.
setESCAPECHARACTER
(
""
);
flatfile
.
setKEEPESCAPECHAR
(
"NO"
);
flatfile
.
setLINESEQUENTIAL
(
"NO"
);
flatfile
.
setMULTIDELIMITERSASAND
(
"NO"
);
flatfile
.
setNULLCHARTYPE
(
"ASCII"
);
flatfile
.
setNULLCHARACTER
(
"*"
);
flatfile
.
setPADBYTES
(
"1"
);
flatfile
.
setQUOTECHARACTER
(
"NONE"
);
flatfile
.
setREPEATABLE
(
"NO"
);
flatfile
.
setROWDELIMITER
(
"0"
);
flatfile
.
setSHIFTSENSITIVEDATA
(
"NO"
);
flatfile
.
setSKIPROWS
(
"0"
);
flatfile
.
setSTRIPTRAILINGBLANKS
(
"NO"
);
target
.
setFLATFILE
(
flatfile
);
for
(
int
j
=
0
;
j
<
((
TargetBean
)
tb
.
get
(
i
)).
getCb
().
getKeytype
().
size
();
++
j
)
{
if
(((
String
)((
TargetBean
)
tb
.
get
(
i
)).
getCb
().
getKeytype
().
get
(
j
)).
equals
(
"PRIMARY KEY"
))
{
TARGETFIELD
tf
=
new
TARGETFIELD
();
tf
.
setBUSINESSNAME
(
""
);
if
(((
String
)((
TargetBean
)
tb
.
get
(
i
)).
getCb
().
getTypeList
().
get
(
j
)).
equals
(
"number(p,s)"
))
{
tf
.
setDATATYPE
(
"int"
);
}
else
{
tf
.
setDATATYPE
(
"string"
);
}
tf
.
setDESCRIPTION
(
""
);
tf
.
setFIELDNUMBER
(
"1"
);
tf
.
setKEYTYPE
(
"NOT A KEY"
);
tf
.
setNAME
((
String
)((
TargetBean
)
tb
.
get
(
i
)).
getCb
().
getNameList
().
get
(
j
)
+
"_tar"
);
tf
.
setNULLABLE
(
"NULL"
);
tf
.
setPICTURETEXT
(
""
);
tf
.
setPRECISION
((
String
)((
TargetBean
)
tb
.
get
(
i
)).
getCb
().
getLengthList
().
get
(
j
));
tf
.
setSCALE
((
String
)((
TargetBean
)
tb
.
get
(
i
)).
getCb
().
getScalelist
().
get
(
j
));
target
.
getTARGETFIELD
().
add
(
tf
);
}
}
String
[]
attributeStr
=
new
String
[]{
"Datetime Format@A 19 mm/dd/yyyy hh24:mi:ss"
,
"Thousand Separator@None"
,
"Decimal Separator@."
,
"Line Endings@System default"
};
String
[]
tmpAttr
=
null
;
TABLEATTRIBUTE
[]
attribute
=
new
TABLEATTRIBUTE
[
attributeStr
.
length
];
for
(
int
k
=
0
;
k
<
attributeStr
.
length
;
++
k
)
{
tmpAttr
=
attributeStr
[
k
].
split
(
"@"
);
attribute
[
k
]
=
new
TABLEATTRIBUTE
();
attribute
[
k
].
setNAME
(
tmpAttr
[
0
]);
if
(
tmpAttr
.
length
>
1
)
{
attribute
[
k
].
setVALUE
(
tmpAttr
[
1
]);
}
else
{
attribute
[
k
].
setVALUE
(
""
);
}
target
.
getTABLEATTRIBUTE
().
add
(
attribute
[
k
]);
}
tar_list
.
add
(
target
);
}
}
return
tar_list
;
}
public
TARGET
getFixTarget
(
List
<
String
>
typelist
,
List
<
String
>
datatypelist
,
List
<
String
>
namelist
,
List
<
String
>
lengthlist
,
List
<
String
>
sclaelist
)
{
TARGET
target
=
new
TARGET
();
target
.
setBUSINESSNAME
(
""
);
target
.
setCONSTRAINT
(
""
);
target
.
setDATABASETYPE
(
"Flat File"
);
target
.
setDESCRIPTION
(
""
);
target
.
setNAME
(
"tab_candidate"
);
target
.
setOBJECTVERSION
(
"1"
);
target
.
setTABLEOPTIONS
(
""
);
target
.
setVERSIONNUMBER
(
"1"
);
FLATFILE
flatfile
=
new
FLATFILE
();
flatfile
.
setCODEPAGE
(
"MS1252"
);
flatfile
.
setCONSECDELIMITERSASONE
(
"NO"
);
flatfile
.
setDELIMITED
(
"YES"
);
flatfile
.
setDELIMITERS
(
","
);
flatfile
.
setESCAPECHARACTER
(
""
);
flatfile
.
setKEEPESCAPECHAR
(
"NO"
);
flatfile
.
setLINESEQUENTIAL
(
"NO"
);
flatfile
.
setMULTIDELIMITERSASAND
(
"NO"
);
flatfile
.
setNULLCHARTYPE
(
"ASCII"
);
flatfile
.
setNULLCHARACTER
(
"*"
);
flatfile
.
setPADBYTES
(
"1"
);
flatfile
.
setQUOTECHARACTER
(
"NONE"
);
flatfile
.
setREPEATABLE
(
"NO"
);
flatfile
.
setROWDELIMITER
(
"0"
);
flatfile
.
setSHIFTSENSITIVEDATA
(
"NO"
);
flatfile
.
setSKIPROWS
(
"0"
);
flatfile
.
setSTRIPTRAILINGBLANKS
(
"NO"
);
target
.
setFLATFILE
(
flatfile
);
if
(
typelist
!=
null
&&
typelist
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
typelist
.
size
();
++
i
)
{
TARGETFIELD
tf
=
new
TARGETFIELD
();
tf
.
setBUSINESSNAME
(
""
);
tf
.
setDATATYPE
((
String
)
datatypelist
.
get
(
i
));
tf
.
setDESCRIPTION
(
""
);
tf
.
setFIELDNUMBER
(
"1"
);
tf
.
setKEYTYPE
(
"NOT A KEY"
);
tf
.
setNAME
(
"ID1"
);
tf
.
setNULLABLE
(
"NULL"
);
tf
.
setPICTURETEXT
(
""
);
tf
.
setPRECISION
((
String
)
lengthlist
.
get
(
i
));
tf
.
setSCALE
((
String
)
sclaelist
.
get
(
i
));
target
.
getTARGETFIELD
().
add
(
tf
);
}
}
String
[]
attributeStr
=
new
String
[]{
"Datetime Format@A 19 mm/dd/yyyy hh24:mi:ss"
,
"Thousand Separator@None"
,
"Decimal Separator@."
,
"Line Endings@System default"
};
String
[]
tmpAttr
=
null
;
TABLEATTRIBUTE
[]
attribute
=
new
TABLEATTRIBUTE
[
attributeStr
.
length
];
for
(
int
i
=
0
;
i
<
attributeStr
.
length
;
++
i
)
{
tmpAttr
=
attributeStr
[
i
].
split
(
"@"
);
attribute
[
i
]
=
new
TABLEATTRIBUTE
();
attribute
[
i
].
setNAME
(
tmpAttr
[
0
]);
if
(
tmpAttr
.
length
>
1
)
{
attribute
[
i
].
setVALUE
(
tmpAttr
[
1
]);
}
else
{
attribute
[
i
].
setVALUE
(
""
);
}
target
.
getTABLEATTRIBUTE
().
add
(
attribute
[
i
]);
}
return
target
;
}
}
src/main/java/com/chenyang/nse/bussiness/tools/string/BinaryConversion.java
0 → 100644
View file @
cba938dc
package
com
.
chenyang
.
nse
.
bussiness
.
tools
.
string
;
public
class
BinaryConversion
{
public
static
String
StrToBinstr
(
char
strChar
)
{
String
result
=
""
;
result
=
Integer
.
toBinaryString
(
strChar
);
int
length
=
result
.
length
();
for
(
int
var4
=
length
%
4
==
0
?
length
/
4
:
length
/
4
+
1
;
result
.
length
()
<
var4
*
4
;
result
=
"0"
+
result
)
{
}
return
result
;
}
public
static
String
decimalToBinary
(
int
n
)
{
int
t
=
0
;
int
bin
=
0
;
for
(
int
r
=
0
;
n
!=
0
;
++
t
)
{
r
=
n
%
2
;
n
/=
2
;
bin
=
(
int
)((
double
)
bin
+
(
double
)
r
*
Math
.
pow
((
double
)
10.0
F
,
(
double
)
t
));
}
String
str
=
String
.
format
(
"%04d"
,
bin
);
return
str
;
}
public
static
String
binaryToDecimal
(
String
n
)
{
String
res
=
Integer
.
valueOf
(
n
,
2
).
toString
();
return
res
;
}
public
static
String
BinstrToStr
(
String
binStr
)
{
char
[]
tempChar
=
new
char
[
1
];
tempChar
[
0
]
=
BinstrToChar
(
binStr
);
String
s
=
new
String
(
tempChar
);
return
s
;
}
private
static
char
BinstrToChar
(
String
tempStr
)
{
int
[]
temp
=
BinstrToIntArray
(
tempStr
);
int
sum
=
0
;
for
(
int
i
=
0
;
i
<
temp
.
length
;
++
i
)
{
sum
+=
temp
[
temp
.
length
-
1
-
i
]
<<
i
;
}
return
(
char
)
sum
;
}
private
static
int
[]
BinstrToIntArray
(
String
binStr
)
{
char
[]
temp
=
binStr
.
toCharArray
();
int
[]
result
=
new
int
[
temp
.
length
];
for
(
int
i
=
0
;
i
<
temp
.
length
;
++
i
)
{
result
[
i
]
=
temp
[
i
]
-
48
;
}
return
result
;
}
public
static
void
main
(
String
[]
args
)
{
String
strToBinstr
=
StrToBinstr
(
'张'
);
String
binstrToStr
=
BinstrToStr
(
strToBinstr
);
System
.
out
.
println
(
binstrToStr
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论