Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzlite
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzlite
提交
5d68fb6f
提交
5d68fb6f
编写于
11月 20, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
model
上级
219aade2
变更
4
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
210 行增加
和
46 行删除
+210
-46
EntityObj.java
...ava/cn/ibizlab/core/lite/extensions/domain/EntityObj.java
+18
-0
ModelObj.java
...java/cn/ibizlab/core/lite/extensions/domain/ModelObj.java
+86
-9
NestedArray.java
...a/cn/ibizlab/core/lite/extensions/domain/NestedArray.java
+58
-0
DataModel.java
...java/cn/ibizlab/core/lite/extensions/model/DataModel.java
+48
-37
未找到文件。
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/EntityObj.java
浏览文件 @
5d68fb6f
...
...
@@ -95,4 +95,22 @@ public class EntityObj extends DataObj<String,Object> {
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
ModelObj
modelObj
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
ModelObj
getModelObj
()
{
return
modelObj
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
EntityObj
setModelObj
(
ModelObj
modelObj
)
{
this
.
modelObj
=
modelObj
;
return
this
;
}
}
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/ModelObj.java
浏览文件 @
5d68fb6f
...
...
@@ -30,25 +30,102 @@ public class ModelObj extends DataObj<String,Object> {
this
.
dataModel
=
dataModel
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
ModelObj
parent
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
ModelObj
getParent
()
{
return
parent
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
void
setParent
(
ModelObj
parent
)
{
this
.
parent
=
parent
;
}
public
EntityObj
getEntity
(
String
name
)
{
Property
property
=
this
.
getDataModel
().
getObjectProperty
(
name
);
Object
obj
=
this
.
get
(
name
);
if
(
obj
!=
null
&&
obj
instanceof
EntityObj
)
return
(
EntityObj
)
obj
;
else
if
(
property
==
null
)
Property
property
=
this
.
getDataModel
().
getObjectProperty
(
name
);
if
(
property
!=
null
)
{
return
new
EntityObj
().
setDataModel
(
this
.
getDataModel
()).
setProperty
(
property
).
setRowKey
(
this
.
getRowKey
());
else
return
new
EntityObj
().
setDataModel
(
this
.
getDataModel
()).
setDstSystemId
(
this
.
getDataModel
().
getFactPorperty
().
getSystem
()).
setMetaEntityName
(
name
).
setRowKey
(
this
.
getRowKey
());
}
property
=
this
.
getDataModel
().
findObjectProperty
(
name
,
"UP"
);
if
(
property
!=
null
){
int
layerDiff
=
this
.
getDataModel
().
getLayerNo
()-
property
.
getLayerNo
();
ModelObj
parentObj
=
this
;
for
(
int
i
=
0
;
i
<
layerDiff
;
i
++)
parentObj
=
parentObj
.
getParent
();
return
parentObj
.
getEntity
(
name
);
}
return
new
EntityObj
().
setDataModel
(
this
.
getDataModel
()).
setDstSystemId
(
this
.
getDataModel
().
getFactPorperty
().
getSystem
()).
setMetaEntityName
(
name
).
setRowKey
(
this
.
getRowKey
());
}
public
List
<
ModelObj
>
getNested
(
String
name
)
public
NestedArray
getNested
(
String
name
)
{
Object
list
=
this
.
get
(
name
);
if
(
list
!=
null
&&
list
instanceof
List
)
return
(
List
<
ModelObj
>)
list
;
else
return
new
ArrayList
<>();
if
(
list
!=
null
&&
list
instanceof
NestedArray
)
return
(
NestedArray
)
list
;
DataModel
model
=
this
.
getDataModel
().
getNestedDataModel
(
name
);
if
(
model
!=
null
)
return
new
NestedArray
().
setDataModel
(
this
.
getDataModel
()).
setParent
(
this
);
model
=
this
.
getDataModel
().
findDataModel
(
name
,
"DOWN"
);
if
(
model
!=
null
)
{
List
<
String
>
steps
=
new
ArrayList
<>();
DataModel
tmpModel
=
model
;
while
(
tmpModel
.
getParentDataModel
()!=
null
&&!
tmpModel
.
getParentDataModel
().
getDataModelName
().
equalsIgnoreCase
(
this
.
getDataModel
().
getDataModelName
()))
{
tmpModel
=
model
.
getParentDataModel
();
steps
.
add
(
0
,
tmpModel
.
getDataModelName
());
}
if
(
steps
.
size
()>
1
)
{
NestedArray
subarry
=
this
.
getNested
(
steps
.
get
(
0
));
if
(
subarry
.
size
()>
0
)
{
for
(
int
i
=
1
;
i
<
steps
.
size
();
i
++)
{
subarry
=
subarry
.
getSubNested
(
steps
.
get
(
i
));
if
(
subarry
.
size
()==
0
)
return
new
NestedArray
().
setDataModel
(
this
.
getDataModel
()).
setParent
(
this
);
}
return
subarry
;
}
}
}
return
new
NestedArray
().
setDataModel
(
this
.
getDataModel
()).
setParent
(
this
);
}
@Override
public
Object
get
(
Object
key
)
{
if
(
key
==
null
)
return
null
;
if
(
key
.
toString
().
indexOf
(
"."
)>
0
)
{
String
[]
epair
=
key
.
toString
().
split
(
"[.]"
);
if
(
epair
.
length
>=
2
)
{
String
name
=
epair
[
0
];
String
column
=
epair
[
1
];
return
this
.
getEntity
(
name
).
get
(
column
);
}
}
return
super
.
get
(
key
);
}
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/NestedArray.java
0 → 100644
浏览文件 @
5d68fb6f
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
;
import
cn.ibizlab.core.lite.extensions.model.DataModel
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
java.util.ArrayList
;
public
class
NestedArray
extends
ArrayList
<
ModelObj
>
{
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
DataModel
dataModel
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
DataModel
getDataModel
()
{
return
dataModel
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
NestedArray
setDataModel
(
DataModel
dataModel
)
{
this
.
dataModel
=
dataModel
;
return
this
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
ModelObj
parent
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
ModelObj
getParent
()
{
return
parent
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
NestedArray
setParent
(
ModelObj
parent
)
{
this
.
parent
=
parent
;
return
this
;
}
public
NestedArray
getSubNested
(
String
name
)
{
NestedArray
rt
=
new
NestedArray
();
for
(
ModelObj
modelObj:
this
)
{
Object
list
=
modelObj
.
get
(
name
);
if
(
list
!=
null
&&
list
instanceof
NestedArray
)
rt
.
addAll
((
NestedArray
)
list
);
}
return
rt
;
}
}
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/model/DataModel.java
浏览文件 @
5d68fb6f
...
...
@@ -121,32 +121,36 @@ public class DataModel {
return
null
;
}
public
Property
findObjectProperty
(
String
name
)
public
Property
findObjectProperty
(
String
name
,
String
direction
)
{
if
(
StringUtils
.
isEmpty
(
direction
))
direction
=
"ALL"
;
Property
rt
=
this
.
getObjectProperty
(
name
);
if
(
rt
!=
null
)
return
rt
;
if
(
this
.
getNestedDataModels
()!=
null
)
{
for
(
DataModel
dm:
this
.
getNestedDataModels
())
{
rt
=
dm
.
findObjectProperty
(
name
);
if
(
rt
!=
null
)
return
rt
;
if
(
direction
.
equalsIgnoreCase
(
"ALL"
)||
direction
.
equalsIgnoreCase
(
"DOWN"
))
{
if
(
this
.
getNestedDataModels
()
!=
null
)
{
for
(
DataModel
dm
:
this
.
getNestedDataModels
())
{
rt
=
dm
.
findObjectProperty
(
name
,
"DOWN"
);
if
(
rt
!=
null
)
return
rt
;
}
}
}
DataModel
parent
=
this
.
getParentDataModel
();
while
(
parent
!=
null
)
{
rt
=
parent
.
getObjectProperty
(
name
);
if
(
rt
!=
null
)
return
rt
;
else
parent
=
parent
.
getParentDataModel
();
if
(
direction
.
equalsIgnoreCase
(
"ALL"
)||
direction
.
equalsIgnoreCase
(
"UP"
))
{
DataModel
parent
=
this
.
getParentDataModel
();
while
(
parent
!=
null
)
{
rt
=
parent
.
getObjectProperty
(
name
);
if
(
rt
!=
null
)
return
rt
;
else
parent
=
parent
.
getParentDataModel
();
}
}
return
null
;
}
public
DataModel
getNestedDataModel
(
String
name
)
{
if
(
this
.
getNestedDataModels
()!=
null
&&(!
StringUtils
.
isEmpty
(
name
)))
...
...
@@ -161,36 +165,43 @@ public class DataModel {
return
null
;
}
public
DataModel
findDataModel
(
String
name
)
public
DataModel
findDataModel
(
String
name
,
String
direction
)
{
if
(
StringUtils
.
isEmpty
(
direction
))
direction
=
"ALL"
;
if
(
name
.
equalsIgnoreCase
(
this
.
getDataModelName
()))
return
this
;
DataModel
rt
=
this
.
getNestedDataModel
(
name
)
;
if
(
rt
!=
null
)
r
eturn
rt
;
if
(
this
.
getNestedDataModels
()
!=
null
)
{
for
(
DataModel
dm:
this
.
getNestedDataModels
()
)
DataModel
rt
=
null
;
if
(
direction
.
equalsIgnoreCase
(
"ALL"
)||
direction
.
equalsIgnoreCase
(
"DOWN"
))
{
r
t
=
this
.
getNestedDataModel
(
name
)
;
if
(
rt
!=
null
)
return
rt
;
if
(
this
.
getNestedDataModels
()!=
null
)
{
rt
=
dm
.
getNestedDataModel
(
name
);
if
(
rt
!=
null
)
return
rt
;
for
(
DataModel
dm:
this
.
getNestedDataModels
())
{
rt
=
dm
.
findDataModel
(
name
,
"DOWN"
);
if
(
rt
!=
null
)
return
rt
;
}
}
}
if
(
this
.
getObjectProperty
(
name
)!=
null
)
return
this
;
DataModel
parent
=
this
.
getParentDataModel
();
while
(
parent
!=
null
)
{
if
(
name
.
equalsIgnoreCase
(
parent
.
getDataModelName
()))
rt
=
parent
;
if
(
rt
==
null
&&
parent
.
getObjectProperty
(
name
)!=
null
)
rt
=
parent
;
if
(
rt
!=
null
)
return
rt
;
else
parent
=
parent
.
getParentDataModel
();
if
(
direction
.
equalsIgnoreCase
(
"ALL"
)||
direction
.
equalsIgnoreCase
(
"UP"
))
{
DataModel
parent
=
this
.
getParentDataModel
();
while
(
parent
!=
null
)
{
if
(
name
.
equalsIgnoreCase
(
parent
.
getDataModelName
()))
rt
=
parent
;
if
(
rt
==
null
&&
parent
.
getObjectProperty
(
name
)
!=
null
)
rt
=
parent
;
if
(
rt
!=
null
)
return
rt
;
else
parent
=
parent
.
getParentDataModel
();
}
}
return
null
;
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录