Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
4e1b7aac
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,发现更多精彩内容 >>
未验证
提交
4e1b7aac
编写于
5月 10, 2018
作者:
S
Serge Rider
提交者:
GitHub
5月 10, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3457 from dbeaver/3453-mock-data
#3453 Any type generators should be applied to string columns
上级
5901cae5
2e5dac35
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
55 addition
and
45 deletion
+55
-45
plugins/org.jkiss.dbeaver.ext.mockdata/plugin.xml
plugins/org.jkiss.dbeaver.ext.mockdata/plugin.xml
+42
-42
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/MockDataSettings.java
.../src/org/jkiss/dbeaver/ext/mockdata/MockDataSettings.java
+1
-3
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/model/MockGeneratorDescriptor.java
...s/dbeaver/ext/mockdata/model/MockGeneratorDescriptor.java
+7
-0
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/model/MockGeneratorRegistry.java
...iss/dbeaver/ext/mockdata/model/MockGeneratorRegistry.java
+5
-0
未找到文件。
plugins/org.jkiss.dbeaver.ext.mockdata/plugin.xml
浏览文件 @
4e1b7aac
...
...
@@ -64,9 +64,44 @@
<extension
point=
"org.jkiss.dbeaver.mockGenerator"
>
<generator
id=
"numericConstantGenerator"
label=
"Numeric Constant"
description=
"Constant numeric value"
class=
"org.jkiss.dbeaver.ext.mockdata.generator.ConstantGenerator"
>
<type
kind=
"NUMERIC"
/>
<propertyGroup
label=
"General"
>
<property
id=
"value"
label=
"Value"
type=
"numeric"
defaultValue=
"0"
/>
</propertyGroup>
</generator>
<generator
id=
"numericRandomGenerator"
label=
"Numeric Random"
description=
"Random numeric values"
class=
"org.jkiss.dbeaver.ext.mockdata.generator.NumericRandomGenerator"
>
<type
kind=
"NUMERIC"
/>
</generator>
<generator
id=
"numericSequenceGenerator"
label=
"Numeric Sequence"
description=
"Sequence of numbers with adjustable start, step and order"
class=
"org.jkiss.dbeaver.ext.mockdata.generator.NumericSequenceGenerator"
tags=
"id,number,order"
>
<type
kind=
"NUMERIC"
/>
<propertyGroup
label=
"General"
>
<property
id=
"start"
label=
"Start value"
type=
"long"
defaultValue=
"0"
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>
</generator>
<generator
id=
"booleanConstantGenerator"
label=
"Constant"
label=
"
Boolean
Constant"
description=
"Constant boolean value"
class=
"org.jkiss.dbeaver.ext.mockdata.generator.ConstantGenerator"
>
<type
kind=
"BOOLEAN"
/>
...
...
@@ -78,7 +113,7 @@
<generator
id=
"booleanRandomGenerator"
label=
"Random"
label=
"
Boolean
Random"
description=
"Random boolean values"
class=
"org.jkiss.dbeaver.ext.mockdata.generator.BooleanRandomGenerator"
>
<type
kind=
"BOOLEAN"
/>
...
...
@@ -86,7 +121,7 @@
<generator
id=
"booleanSequenceGenerator"
label=
"Sequence"
label=
"
Boolean
Sequence"
description=
"Adjustable sequence of boolean values"
class=
"org.jkiss.dbeaver.ext.mockdata.generator.BooleanSequenceGenerator"
>
<type
kind=
"BOOLEAN"
/>
...
...
@@ -99,7 +134,7 @@
<generator
id=
"dateConstantGenerator"
label=
"Constant"
label=
"
Date
Constant"
description=
"Constant date value"
class=
"org.jkiss.dbeaver.ext.mockdata.generator.ConstantGenerator"
>
<type
kind=
"DATETIME"
/>
...
...
@@ -111,7 +146,7 @@
<generator
id=
"dateRandomGenerator"
label=
"Random"
label=
"
Date
Random"
description=
"Random date values"
class=
"org.jkiss.dbeaver.ext.mockdata.generator.DateRandomGenerator"
>
<type
kind=
"DATETIME"
/>
...
...
@@ -124,7 +159,7 @@
<generator
id=
"dateSequenceGenerator"
label=
"Sequence"
label=
"
Date
Sequence"
description=
"Adjustable sequence of dates"
class=
"org.jkiss.dbeaver.ext.mockdata.generator.DateSequenceGenerator"
>
<type
kind=
"DATETIME"
/>
...
...
@@ -148,44 +183,9 @@
-->
</generator>
<generator
id=
"numericConstantGenerator"
label=
"Constant"
description=
"Constant numeric value"
class=
"org.jkiss.dbeaver.ext.mockdata.generator.ConstantGenerator"
>
<type
kind=
"NUMERIC"
/>
<propertyGroup
label=
"General"
>
<property
id=
"value"
label=
"Value"
type=
"numeric"
defaultValue=
"0"
/>
</propertyGroup>
</generator>
<generator
id=
"numericRandomGenerator"
label=
"Random"
description=
"Random numeric values"
class=
"org.jkiss.dbeaver.ext.mockdata.generator.NumericRandomGenerator"
>
<type
kind=
"NUMERIC"
/>
</generator>
<generator
id=
"numericSequenceGenerator"
label=
"Sequence"
description=
"Sequence of numbers with adjustable start, step and order"
class=
"org.jkiss.dbeaver.ext.mockdata.generator.NumericSequenceGenerator"
tags=
"id,number,order"
>
<type
kind=
"NUMERIC"
/>
<propertyGroup
label=
"General"
>
<property
id=
"start"
label=
"Start value"
type=
"long"
defaultValue=
"0"
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>
</generator>
<generator
id=
"stringConstantGenerator"
label=
"Constant"
label=
"
String
Constant"
description=
"Constant string"
class=
"org.jkiss.dbeaver.ext.mockdata.generator.ConstantGenerator"
>
<type
kind=
"STRING"
/>
...
...
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/MockDataSettings.java
浏览文件 @
4e1b7aac
...
...
@@ -33,8 +33,6 @@ import java.util.*;
public
class
MockDataSettings
{
public
static
final
String
FK_GENERATOR_ID
=
"fkGenerator"
;
//$NON-NLS-1$
public
static
final
String
PROP_REMOVE_OLD_DATA
=
"removeOldData"
;
//$NON-NLS-1$
public
static
final
String
PROP_ROWS_NUMBER
=
"rowsNumber"
;
//$NON-NLS-1$
...
...
@@ -73,7 +71,7 @@ public class MockDataSettings {
//((JDBCColumnKeyType) attribute).isInUniqueKey()
List
<
DBSEntityReferrer
>
attributeReferrers
=
DBUtils
.
getAttributeReferrers
(
monitor
,
(
DBSEntityAttribute
)
attribute
);
if
(!
CommonUtils
.
isEmpty
(
attributeReferrers
))
{
MockGeneratorDescriptor
generator
=
generatorRegistry
.
getGenerator
(
FK_GENERATOR_ID
);
MockGeneratorDescriptor
generator
=
generatorRegistry
.
getGenerator
(
MockGeneratorRegistry
.
FK_GENERATOR_ID
);
putGenerator
(
generatorProperties
,
generator
);
}
else
{
List
<
MockGeneratorDescriptor
>
generators
=
generatorRegistry
.
findAllGenerators
(
dataManipulator
.
getDataSource
(),
attribute
);
...
...
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/model/MockGeneratorDescriptor.java
浏览文件 @
4e1b7aac
...
...
@@ -23,6 +23,7 @@ import org.jkiss.dbeaver.model.DBPDataKind;
import
org.jkiss.dbeaver.model.DBPImage
;
import
org.jkiss.dbeaver.model.impl.PropertyDescriptor
;
import
org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.registry.RegistryConstants
;
import
org.jkiss.dbeaver.registry.datatype.DataTypeAbstractDescriptor
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -177,6 +178,12 @@ public class MockGeneratorDescriptor extends DataTypeAbstractDescriptor<MockValu
return
null
;
}
@Override
public
boolean
supportsType
(
DBSTypedObject
typedObject
)
{
return
(
typedObject
.
getDataKind
()
==
DBPDataKind
.
STRING
)
||
super
.
supportsType
(
typedObject
);
}
@NotNull
public
MockValueGenerator
createGenerator
()
{
return
createInstance
();
...
...
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/model/MockGeneratorRegistry.java
浏览文件 @
4e1b7aac
...
...
@@ -32,6 +32,8 @@ public class MockGeneratorRegistry
{
static
final
String
TAG_GENERATOR
=
"generator"
;
//$NON-NLS-1$
public
static
final
String
FK_GENERATOR_ID
=
"fkGenerator"
;
//$NON-NLS-1$
private
static
final
Log
log
=
Log
.
getLog
(
MockGeneratorRegistry
.
class
);
private
static
MockGeneratorRegistry
instance
=
null
;
...
...
@@ -94,6 +96,9 @@ public class MockGeneratorRegistry
List
<
MockGeneratorDescriptor
>
result
=
new
ArrayList
<>();
for
(
MockGeneratorDescriptor
descriptor
:
generators
)
{
if
(
FK_GENERATOR_ID
.
equalsIgnoreCase
(
descriptor
.
getId
()))
{
continue
;
}
if
(((!
descriptor
.
isGlobal
()
&&
descriptor
.
supportsDataSource
(
dataSource
)
&&
descriptor
.
supportsType
(
typedObject
))
||
(
descriptor
.
isGlobal
()
&&
descriptor
.
supportsType
(
typedObject
))))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录