Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
3f3218a2
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3f3218a2
编写于
6月 03, 2018
作者:
E
Evgeny Fradkin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#60 EE. Mock data template generator
上级
95d85644
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
53 addition
and
9 deletion
+53
-9
bundles/org.jkiss.utils/src/org/jkiss/utils/CommonUtils.java
bundles/org.jkiss.utils/src/org/jkiss/utils/CommonUtils.java
+9
-0
plugins/org.jkiss.dbeaver.ext.mockdata/plugin.xml
plugins/org.jkiss.dbeaver.ext.mockdata/plugin.xml
+1
-1
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/generator/AbstractMockValueGenerator.java
...er/ext/mockdata/generator/AbstractMockValueGenerator.java
+35
-0
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/generator/NumericSequenceGenerator.java
...aver/ext/mockdata/generator/NumericSequenceGenerator.java
+8
-8
未找到文件。
bundles/org.jkiss.utils/src/org/jkiss/utils/CommonUtils.java
浏览文件 @
3f3218a2
...
...
@@ -355,6 +355,15 @@ public class CommonUtils {
return
strValue
;
}
public
static
String
[]
splitWithDelimiter
(
String
s
,
String
delimiter
)
{
if
(
s
==
null
)
{
return
null
;
}
String
delimiterReplacement
=
"DRDRDR"
;
//$NON-NLS-1$
s
=
s
.
replace
(
delimiter
,
delimiterReplacement
+
delimiter
);
return
s
.
split
(
delimiterReplacement
);
}
@NotNull
public
static
List
<
String
>
splitString
(
@Nullable
String
str
,
char
delimiter
)
{
if
(
CommonUtils
.
isEmpty
(
str
))
{
...
...
plugins/org.jkiss.dbeaver.ext.mockdata/plugin.xml
浏览文件 @
3f3218a2
...
...
@@ -91,7 +91,7 @@
<type
kind=
"NUMERIC"
/>
<propertyGroup
label=
"General"
>
<property
id=
"start"
label=
"Start value"
type=
"long"
defaultValue=
"
0
"
description=
"Initial sequence value"
/>
<property
id=
"start"
label=
"Start value"
type=
"long"
defaultValue=
"
1
"
description=
"Initial sequence value"
/>
<property
id=
"step"
label=
"Increment step"
type=
"long"
defaultValue=
"1"
description=
"Sequence increment step"
/>
<property
id=
"reverse"
label=
"Reverse order"
type=
"boolean"
defaultValue=
"FALSE"
description=
"Reverse the sequence order"
/>
</propertyGroup>
...
...
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/generator/AbstractMockValueGenerator.java
浏览文件 @
3f3218a2
...
...
@@ -128,4 +128,39 @@ public abstract class AbstractMockValueGenerator implements MockValueGenerator {
return
column
.
getValueEnumeration
(
session
,
null
,
number
);
}
protected
Boolean
getBooleanProperty
(
Map
<
Object
,
Object
>
properties
,
String
propName
)
{
Object
prop
=
properties
.
get
(
propName
);
if
(
prop
!=
null
)
{
if
(
prop
instanceof
Boolean
)
{
return
(
Boolean
)
prop
;
}
else
{
return
Boolean
.
valueOf
(
prop
.
toString
());
}
}
return
null
;
}
protected
Double
getDoubleProperty
(
Map
<
Object
,
Object
>
properties
,
String
propName
)
{
Object
prop
=
properties
.
get
(
propName
);
if
(
prop
!=
null
)
{
if
(
prop
instanceof
Double
)
{
return
(
Double
)
prop
;
}
else
{
return
Double
.
valueOf
(
prop
.
toString
());
}
}
return
null
;
}
protected
Long
getLongProperty
(
Map
<
Object
,
Object
>
properties
,
String
propName
)
{
Object
prop
=
properties
.
get
(
propName
);
if
(
prop
!=
null
)
{
if
(
prop
instanceof
Long
)
{
return
(
Long
)
prop
;
}
else
{
return
Long
.
valueOf
(
prop
.
toString
());
}
}
return
null
;
}
}
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/generator/NumericSequenceGenerator.java
浏览文件 @
3f3218a2
...
...
@@ -28,22 +28,22 @@ import java.util.Map;
public
class
NumericSequenceGenerator
extends
AbstractMockValueGenerator
{
private
long
start
=
0
;
private
long
step
=
0
;
private
long
start
=
1
;
private
long
step
=
1
;
private
boolean
reverse
=
false
;
@Override
public
void
init
(
DBSDataManipulator
container
,
DBSAttributeBase
attribute
,
Map
<
Object
,
Object
>
properties
)
throws
DBException
{
super
.
init
(
container
,
attribute
,
properties
);
Long
start
=
(
Long
)
properties
.
get
(
"start"
);
//$NON-NLS-1$
if
(
start
!=
null
)
{
this
.
start
=
start
;
Long
start
Property
=
getLongProperty
(
properties
,
"start"
);
//$NON-NLS-1$
if
(
start
Property
!=
null
)
{
this
.
start
=
start
Property
;
}
Long
step
=
(
Long
)
properties
.
get
(
"step"
);
//$NON-NLS-1$
if
(
step
!=
null
)
{
this
.
step
=
step
;
Long
step
Property
=
getLongProperty
(
properties
,
"step"
);
//$NON-NLS-1$
if
(
step
Property
!=
null
)
{
this
.
step
=
step
Property
;
}
Boolean
reverse
=
(
Boolean
)
properties
.
get
(
"reverse"
);
//$NON-NLS-1$
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录