Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
logwire-bo-persistence
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
薛涛 Toby Xue
logwire-bo-persistence
Commits
f80bd7c1
Commit
f80bd7c1
authored
Dec 07, 2020
by
薛涛 Toby Xue
🆒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#1971 actionListener
parent
c3f628bb
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
925 additions
and
119 deletions
+925
-119
BoService.java
src/main/java/logwire/web/bo/BoService.java
+15
-0
TypeOperationHandlerBean.java
...in/java/logwire/web/bo/bean/TypeOperationHandlerBean.java
+0
-31
BoBeanContainer.java
src/main/java/logwire/web/bo/container/BoBeanContainer.java
+0
-9
BoRelationBeanContainerBuilder.java
...wire/web/bo/container/BoRelationBeanContainerBuilder.java
+0
-29
OperationHandlerContainer.java
...a/logwire/web/bo/container/OperationHandlerContainer.java
+0
-23
BigIntegerFieldParser.java
...ava/logwire/web/bo/field/parse/BigIntegerFieldParser.java
+30
-0
BizArrayFieldParser.java
.../java/logwire/web/bo/field/parse/BizArrayFieldParser.java
+25
-0
BooleanFieldParser.java
...n/java/logwire/web/bo/field/parse/BooleanFieldParser.java
+24
-0
DateTimeFieldParser.java
.../java/logwire/web/bo/field/parse/DateTimeFieldParser.java
+25
-0
DecimalFieldParser.java
...n/java/logwire/web/bo/field/parse/DecimalFieldParser.java
+25
-0
FieldParser.java
src/main/java/logwire/web/bo/field/parse/FieldParser.java
+20
-0
FieldParserUtil.java
...main/java/logwire/web/bo/field/parse/FieldParserUtil.java
+47
-0
IntegerFieldParser.java
...n/java/logwire/web/bo/field/parse/IntegerFieldParser.java
+24
-0
SmallIntegerFieldParser.java
...a/logwire/web/bo/field/parse/SmallIntegerFieldParser.java
+24
-0
StringFieldParser.java
...in/java/logwire/web/bo/field/parse/StringFieldParser.java
+25
-0
CreateOperationHandler.java
...n/java/logwire/web/bo/handler/CreateOperationHandler.java
+21
-0
BoActionListener.java
src/main/java/logwire/web/bo/listener/BoActionListener.java
+50
-0
BoModelBeanLoader.java
src/main/java/logwire/web/bo/loader/BoModelBeanLoader.java
+37
-27
BizModelQuery.java
src/main/java/logwire/web/bo/query/BizModelQuery.java
+4
-0
BizObjectStatus.java
src/main/java/logwire/web/bo/session/BizObjectStatus.java
+4
-0
Session.java
src/main/java/logwire/web/bo/session/Session.java
+485
-0
SessionHolder.java
src/main/java/logwire/web/bo/session/SessionHolder.java
+40
-0
No files found.
src/main/java/logwire/web/bo/BoService.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
;
import
logwire.web.service.query.QueryService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
@Component
public
class
BoService
{
@Autowired
QueryService
queryService
;
}
src/main/java/logwire/web/bo/bean/TypeOperationHandlerBean.java
deleted
100644 → 0
View file @
c3f628bb
package
logwire
.
web
.
bo
.
bean
;
import
logwire.core.bo.handler.OperationHandler
;
import
logwire.core.bo.object.BizObject
;
public
class
TypeOperationHandlerBean
{
public
TypeOperationHandlerBean
(
Class
<?
extends
BizObject
>
bizObject
,
Class
<?
extends
OperationHandler
>
handler
)
{
this
.
bizObject
=
bizObject
;
this
.
handler
=
handler
;
}
private
Class
<?
extends
BizObject
>
bizObject
;
private
Class
<?
extends
OperationHandler
>
handler
;
public
Class
getBizObject
()
{
return
bizObject
;
}
public
void
setBizObject
(
Class
<?
extends
BizObject
>
bizObject
)
{
this
.
bizObject
=
bizObject
;
}
public
Class
getHandler
()
{
return
handler
;
}
public
void
setHandler
(
Class
<?
extends
OperationHandler
>
handler
)
{
this
.
handler
=
handler
;
}
}
src/main/java/logwire/web/bo/container/BoBeanContainer.java
deleted
100644 → 0
View file @
c3f628bb
package
logwire
.
web
.
bo
.
container
;
public
abstract
class
BoBeanContainer
<
T
>
{
public
abstract
T
getBean
(
String
id
);
}
src/main/java/logwire/web/bo/container/BoRelationBeanContainerBuilder.java
deleted
100644 → 0
View file @
c3f628bb
package
logwire
.
web
.
bo
.
container
;
import
logwire.core.resource.*
;
import
logwire.web.bo.loader.BoRelationBeanDefinitionLoader
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.stereotype.Component
;
@Component
public
class
BoRelationBeanContainerBuilder
implements
JavaBeanContainerBuilder
{
@Override
public
JavaBeanContainer
build
(
ApplicationContext
applicationContext
)
{
return
newContainer
(
applicationContext
,
BoRelationBeanDefinitionLoader
.
class
);
}
@Override
public
String
getContainerName
()
{
return
"BO_RELATION"
;
}
private
JavaBeanContainer
newContainer
(
ApplicationContext
ctx
,
Class
...
classes
)
{
BeanLoader
[]
loaders
=
new
BeanLoader
[
classes
.
length
];
for
(
int
i
=
0
;
i
<
loaders
.
length
;
i
++)
{
loaders
[
i
]
=
(
BeanLoader
)
Util
.
getExactBean
(
ctx
,
classes
[
i
]);
}
JavaBeanContainer
container
=
new
JavaBeanContainer
(
loaders
);
return
container
;
}
}
src/main/java/logwire/web/bo/container/OperationHandlerContainer.java
deleted
100644 → 0
View file @
c3f628bb
package
logwire
.
web
.
bo
.
container
;
import
logwire.web.bo.bean.TypeOperationHandlerBean
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
OperationHandlerContainer
{
private
List
<
TypeOperationHandlerBean
>
typeOperationHandlerBeanList
=
new
ArrayList
<>();
public
List
<
TypeOperationHandlerBean
>
getTypeOperationHandlerBeanList
()
{
return
typeOperationHandlerBeanList
;
}
public
void
setTypeOperationHandlerBeanList
(
List
<
TypeOperationHandlerBean
>
typeOperationHandlerBeanList
)
{
this
.
typeOperationHandlerBeanList
=
typeOperationHandlerBeanList
;
}
public
void
addTypeOperationHandlerBean
(
TypeOperationHandlerBean
typeOperationHandlerBean
)
{
this
.
typeOperationHandlerBeanList
.
add
(
typeOperationHandlerBean
);
}
}
src/main/java/logwire/web/bo/field/parse/BigIntegerFieldParser.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
.
field
.
parse
;
import
logwire.core.meta.model.fields.BigIntegerField
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Field
;
public
class
BigIntegerFieldParser
extends
FieldParser
<
BigIntegerField
>
{
@Override
protected
BigIntegerField
newField
(
Field
field
,
Annotation
[]
annotations
)
{
return
new
BigIntegerField
(
field
.
getName
());
}
@Override
protected
void
setField
(
BigIntegerField
newField
,
Annotation
[]
annotations
)
{
}
private
BigIntegerFieldParser
()
{
}
public
static
BigIntegerFieldParser
getInstance
()
{
return
BigIntegerFieldParser
.
SingletonHolder
.
instance
;
}
private
static
class
SingletonHolder
{
private
static
BigIntegerFieldParser
instance
=
new
BigIntegerFieldParser
();
}
}
src/main/java/logwire/web/bo/field/parse/BizArrayFieldParser.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
.
field
.
parse
;
import
logwire.core.meta.model.fields.StringField
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Field
;
public
class
BizArrayFieldParser
extends
FieldParser
<
StringField
>
{
@Override
protected
StringField
newField
(
Field
field
,
Annotation
[]
annotations
)
{
return
new
StringField
(
field
.
getName
(),
100
);
}
private
BizArrayFieldParser
()
{
}
public
static
BizArrayFieldParser
getInstance
()
{
return
BizArrayFieldParser
.
SingletonHolder
.
instance
;
}
private
static
class
SingletonHolder
{
private
static
BizArrayFieldParser
instance
=
new
BizArrayFieldParser
();
}
}
src/main/java/logwire/web/bo/field/parse/BooleanFieldParser.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
.
field
.
parse
;
import
logwire.core.meta.model.fields.BooleanField
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Field
;
public
class
BooleanFieldParser
extends
FieldParser
<
BooleanField
>
{
@Override
protected
BooleanField
newField
(
Field
field
,
Annotation
[]
annotations
)
{
return
new
BooleanField
(
field
.
getName
());
}
private
BooleanFieldParser
()
{
}
public
static
BooleanFieldParser
getInstance
()
{
return
BooleanFieldParser
.
SingletonHolder
.
instance
;
}
private
static
class
SingletonHolder
{
private
static
BooleanFieldParser
instance
=
new
BooleanFieldParser
();
}
}
src/main/java/logwire/web/bo/field/parse/DateTimeFieldParser.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
.
field
.
parse
;
import
logwire.core.meta.model.fields.DateTimeField
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Field
;
public
class
DateTimeFieldParser
extends
FieldParser
<
DateTimeField
>
{
@Override
protected
DateTimeField
newField
(
Field
field
,
Annotation
[]
annotations
)
{
return
new
DateTimeField
(
field
.
getName
());
}
private
DateTimeFieldParser
()
{
}
public
static
DateTimeFieldParser
getInstance
()
{
return
DateTimeFieldParser
.
SingletonHolder
.
instance
;
}
private
static
class
SingletonHolder
{
private
static
DateTimeFieldParser
instance
=
new
DateTimeFieldParser
();
}
}
src/main/java/logwire/web/bo/field/parse/DecimalFieldParser.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
.
field
.
parse
;
import
logwire.core.meta.model.fields.DecimalField
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Field
;
public
class
DecimalFieldParser
extends
FieldParser
<
DecimalField
>
{
@Override
protected
DecimalField
newField
(
Field
field
,
Annotation
[]
annotations
)
{
return
new
DecimalField
(
field
.
getName
(),
18
,
6
);
}
private
DecimalFieldParser
()
{
}
public
static
DecimalFieldParser
getInstance
()
{
return
DecimalFieldParser
.
SingletonHolder
.
instance
;
}
private
static
class
SingletonHolder
{
private
static
DecimalFieldParser
instance
=
new
DecimalFieldParser
();
}
}
src/main/java/logwire/web/bo/field/parse/FieldParser.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
.
field
.
parse
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Field
;
public
abstract
class
FieldParser
<
T
extends
logwire
.
core
.
meta
.
model
.
fields
.
Field
>
{
protected
abstract
T
newField
(
Field
field
,
Annotation
[]
annotations
);
public
T
parse
(
Field
field
,
Annotation
[]
annotations
)
{
T
newField
=
newField
(
field
,
annotations
);
setField
(
newField
,
annotations
);
return
newField
;
}
protected
void
setField
(
T
newField
,
Annotation
[]
annotations
)
{
}
}
src/main/java/logwire/web/bo/field/parse/FieldParserUtil.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
.
field
.
parse
;
import
logwire.core.bo.field.BizArray
;
import
java.lang.annotation.Annotation
;
import
java.time.OffsetDateTime
;
public
abstract
class
FieldParserUtil
{
private
FieldParserUtil
()
{
}
/**
* 获取解析注解的 parser
*
* @param field
* @param annotations
* @return
*/
public
static
FieldParser
getParser
(
java
.
lang
.
reflect
.
Field
field
,
Annotation
[]
annotations
)
{
return
getParserByFieldType
(
field
);
}
private
static
FieldParser
getParserByFieldType
(
java
.
lang
.
reflect
.
Field
field
)
{
// 此时一定是存在 Field 类型的 annotation
// 根据字段类型来推断 Parser
Class
clazz
=
field
.
getType
();
if
(
clazz
.
equals
(
String
.
class
))
{
return
StringFieldParser
.
getInstance
();
}
else
if
(
clazz
.
equals
(
Integer
.
class
)
||
clazz
.
equals
(
int
.
class
))
{
return
IntegerFieldParser
.
getInstance
();
}
else
if
(
clazz
.
equals
(
Short
.
class
)
||
clazz
.
equals
(
short
.
class
))
{
return
SmallIntegerFieldParser
.
getInstance
();
}
else
if
(
clazz
.
equals
(
Long
.
class
)
||
clazz
.
equals
(
long
.
class
))
{
return
BigIntegerFieldParser
.
getInstance
();
}
else
if
(
clazz
.
equals
(
OffsetDateTime
.
class
)
||
clazz
.
equals
(
java
.
util
.
Date
.
class
))
{
return
DateTimeFieldParser
.
getInstance
();
}
else
if
(
clazz
.
equals
(
Boolean
.
class
)
||
clazz
.
equals
(
boolean
.
class
))
{
return
BooleanFieldParser
.
getInstance
();
}
else
if
(
clazz
.
equals
(
Double
.
class
)
||
clazz
.
equals
(
double
.
class
)
||
clazz
.
equals
(
float
.
class
))
{
return
DecimalFieldParser
.
getInstance
();
}
else
if
(
clazz
.
equals
(
BizArray
.
class
))
{
return
BizArrayFieldParser
.
getInstance
();
}
return
null
;
}
}
src/main/java/logwire/web/bo/field/parse/IntegerFieldParser.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
.
field
.
parse
;
import
logwire.core.meta.model.fields.IntegerField
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Field
;
public
class
IntegerFieldParser
extends
FieldParser
<
IntegerField
>
{
@Override
protected
IntegerField
newField
(
Field
field
,
Annotation
[]
annotations
)
{
return
new
IntegerField
(
field
.
getName
());
}
private
IntegerFieldParser
()
{
}
public
static
IntegerFieldParser
getInstance
()
{
return
IntegerFieldParser
.
SingletonHolder
.
instance
;
}
private
static
class
SingletonHolder
{
private
static
IntegerFieldParser
instance
=
new
IntegerFieldParser
();
}
}
src/main/java/logwire/web/bo/field/parse/SmallIntegerFieldParser.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
.
field
.
parse
;
import
logwire.core.meta.model.fields.SmallIntegerField
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Field
;
public
class
SmallIntegerFieldParser
extends
FieldParser
<
SmallIntegerField
>
{
@Override
protected
SmallIntegerField
newField
(
Field
field
,
Annotation
[]
annotations
)
{
return
new
SmallIntegerField
(
field
.
getName
());
}
private
SmallIntegerFieldParser
()
{
}
public
static
SmallIntegerFieldParser
getInstance
()
{
return
SmallIntegerFieldParser
.
SingletonHolder
.
instance
;
}
private
static
class
SingletonHolder
{
private
static
SmallIntegerFieldParser
instance
=
new
SmallIntegerFieldParser
();
}
}
src/main/java/logwire/web/bo/field/parse/StringFieldParser.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
.
field
.
parse
;
import
logwire.core.meta.model.fields.StringField
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Field
;
public
class
StringFieldParser
extends
FieldParser
<
StringField
>
{
@Override
protected
StringField
newField
(
Field
field
,
Annotation
[]
annotations
)
{
return
new
StringField
(
field
.
getName
(),
50
);
}
private
StringFieldParser
()
{
}
public
static
StringFieldParser
getInstance
()
{
return
StringFieldParser
.
SingletonHolder
.
instance
;
}
private
static
class
SingletonHolder
{
private
static
StringFieldParser
instance
=
new
StringFieldParser
();
}
}
src/main/java/logwire/web/bo/handler/CreateOperationHandler.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
.
handler
;
import
logwire.core.bo.handler.TypeOperationHandler
;
public
class
CreateOperationHandler
implements
TypeOperationHandler
{
@Override
public
Object
execute
(
Class
aClass
,
Object
...
args
)
{
return
null
;
}
@Override
public
String
getOperation
()
{
return
"create"
;
}
@Override
public
boolean
isEnabled
()
{
return
true
;
}
}
src/main/java/logwire/web/bo/listener/BoActionListener.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
.
listener
;
import
logwire.core.meta.query.IQuery
;
import
logwire.core.meta.query.Query
;
import
logwire.web.action.listener.ActionListener
;
import
logwire.web.bo.query.BizModelQuery
;
import
logwire.web.bo.session.Session
;
import
logwire.web.bo.session.SessionHolder
;
import
logwire.web.service.ActionContext
;
import
logwire.web.service.query.QueryService
;
import
logwire.web.tenant.TenantProjectService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
@Component
public
class
BoActionListener
implements
ActionListener
{
@Autowired
TenantProjectService
projectService
;
@Autowired
QueryService
queryService
;
@Override
public
void
beforeAction
(
ActionContext
actionContext
,
String
queryName
)
{
IQuery
iQuery
=
projectService
.
getCurrentProject
().
findQuery
(
queryName
);
if
(
iQuery
==
null
)
{
return
;
}
if
(!(
iQuery
instanceof
Query
))
{
return
;
}
Query
query
=
(
Query
)
iQuery
;
if
(
query
instanceof
BizModelQuery
)
{
SessionHolder
.
openSession
(
actionContext
);
}
}
@Override
public
void
afterAction
(
ActionContext
actionContext
,
String
queryName
)
{
Session
session
=
SessionHolder
.
getSession
();
if
(
session
!=
null
)
{
session
.
commit
(
queryService
);
}
}
}
src/main/java/logwire/web/bo/loader/BoModelBeanLoader.java
View file @
f80bd7c1
...
@@ -10,11 +10,14 @@ import logwire.core.resource.BeanLoader;
...
@@ -10,11 +10,14 @@ import logwire.core.resource.BeanLoader;
import
logwire.core.resource.loader.JavaModelBeanLoader
;
import
logwire.core.resource.loader.JavaModelBeanLoader
;
import
logwire.core.tenant.TenantClassLoader
;
import
logwire.core.tenant.TenantClassLoader
;
import
logwire.core.tenant.TenantProject
;
import
logwire.core.tenant.TenantProject
;
import
logwire.web.bo.field.parse.FieldParser
;
import
logwire.web.bo.field.parse.FieldParserUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.config.BeanDefinition
;
import
org.springframework.beans.factory.config.BeanDefinition
;
import
org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider
;
import
org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider
;
import
org.springframework.core.io.DefaultResourceLoader
;
import
org.springframework.core.io.DefaultResourceLoader
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -26,6 +29,17 @@ public class BoModelBeanLoader extends BeanLoader<IQuery, TenantProject> impleme
...
@@ -26,6 +29,17 @@ public class BoModelBeanLoader extends BeanLoader<IQuery, TenantProject> impleme
@Autowired
@Autowired
LoaderUtil
loaderUtil
;
LoaderUtil
loaderUtil
;
/**
* load BoModel 的逻辑:
* 1、先遍历出所有BizObject的子类
* 2、将直接继承BizObject的类初始化
* 3、剩余的类中,判断是否独立的model(包含BizModel注解),若是,生成Model;若不是,字段添加至父类的Model中
*
* @param project 当前租户
* @param input 待加载的资源
* @param consumer 处理加载结果
* @throws Exception
*/
@Override
@Override
public
void
load
(
TenantProject
project
,
TenantProject
input
,
Consumer
<
IQuery
>
consumer
)
throws
Exception
{
public
void
load
(
TenantProject
project
,
TenantProject
input
,
Consumer
<
IQuery
>
consumer
)
throws
Exception
{
TenantClassLoader
classLoader
=
project
.
getTenantBeanContext
().
getTenantClassLoader
();
TenantClassLoader
classLoader
=
project
.
getTenantBeanContext
().
getTenantClassLoader
();
...
@@ -44,33 +58,22 @@ public class BoModelBeanLoader extends BeanLoader<IQuery, TenantProject> impleme
...
@@ -44,33 +58,22 @@ public class BoModelBeanLoader extends BeanLoader<IQuery, TenantProject> impleme
}
}
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
for
(
BeanDefinition
beanDefinition
:
bizModelList
)
{
for
(
BeanDefinition
beanDefinition
:
beans
)
{
Class
<?>
clazz
=
classLoader
.
loadClass
(
beanDefinition
.
getBeanClassName
());
Class
<?>
clazz
=
classLoader
.
loadClass
(
beanDefinition
.
getBeanClassName
());
//判断是否独立model
//独立model
BizModel
bizModelAnnotation
=
clazz
.
getAnnotation
(
BizModel
.
class
);
Model
model
=
new
Model
();
if
(
bizModelAnnotation
!=
null
)
{
model
.
setName
(
clazz
.
getSimpleName
());
//独立model
model
.
setVerboseName
(
clazz
.
getAnnotation
(
BizModel
.
class
).
label
());
Model
model
=
new
Model
();
model
.
setIncludeAuditFields
(
true
);
model
.
setName
(
clazz
.
getSimpleName
());
model
.
setIncludeVersionField
(
true
);
model
.
setName
(
clazz
.
getSimpleName
());
model
.
setIncludeDomainField
(
true
);
model
.
setVerboseName
(
bizModelAnnotation
.
label
());
initField
(
clazz
,
model
);
model
.
setIncludeAuditFields
(
true
);
/*
model
.
setIncludeVersionField
(
true
);
//todo
model
.
setIncludeDomainField
(
true
);
this.initIndex(clazz, model);
initField
(
clazz
,
model
);
this.initSign(model);*/
}
else
{
consumer
.
accept
(
model
);
//判断父类是否包含 @BizModel ,若包含则
}
/* this.initModel(clazz, model);
this.initFields(clazz, model);
this.initIndex(clazz, model);
this.initSign(model);
consumer.accept(model);*/
}
}
...
@@ -78,11 +81,18 @@ public class BoModelBeanLoader extends BeanLoader<IQuery, TenantProject> impleme
...
@@ -78,11 +81,18 @@ public class BoModelBeanLoader extends BeanLoader<IQuery, TenantProject> impleme
}
}
private
void
initField
(
Class
<?>
clazz
,
Model
model
)
{
private
void
initField
(
Class
<?>
clazz
,
Model
model
)
{
//获取所有带有Column注解的字段
Field
[]
fields
=
clazz
.
getDeclaredFields
();
Field
[]
fields
=
clazz
.
getDeclaredFields
();
for
(
Field
f
:
fields
)
{
for
(
Field
f
:
fields
)
{
Column
column
=
f
.
getAnnotation
(
Column
.
class
);
Column
column
=
f
.
getAnnotation
(
Column
.
class
);
if
(
column
!=
null
)
{
if
(
column
!=
null
)
{
/* model.*/
Annotation
[]
annotations
=
f
.
getDeclaredAnnotations
();
FieldParser
parser
=
FieldParserUtil
.
getParser
(
f
,
annotations
);
if
(
parser
==
null
)
{
continue
;
}
logwire
.
core
.
meta
.
model
.
fields
.
Field
field
=
parser
.
parse
(
f
,
annotations
);
model
.
addField
(
field
);
}
}
}
}
}
}
...
...
src/main/java/logwire/web/bo/query/BizModelQuery.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
.
query
;
public
interface
BizModelQuery
{
}
src/main/java/logwire/web/bo/session/BizObjectStatus.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
.
session
;
public
class
BizObjectStatus
{
}
src/main/java/logwire/web/bo/session/Session.java
0 → 100644
View file @
f80bd7c1
This diff is collapsed.
Click to expand it.
src/main/java/logwire/web/bo/session/SessionHolder.java
0 → 100644
View file @
f80bd7c1
package
logwire
.
web
.
bo
.
session
;
import
logwire.core.exceptions.ApplicationException
;
import
logwire.web.service.ActionContext
;
import
org.springframework.core.NamedThreadLocal
;
/**
* SessionHolder
*
*/
public
abstract
class
SessionHolder
{
private
static
ThreadLocal
<
Session
>
sessionThreadLocal
=
new
NamedThreadLocal
<>(
"Biz context"
);
public
static
Session
getSessionOrFail
()
{
Session
session
=
sessionThreadLocal
.
get
();
if
(
session
!=
null
)
{
return
session
;
}
throw
new
ApplicationException
(
"No session exists, please call method SessionHolder.openSession() to open a new session!"
);
}
public
static
Session
getSession
()
{
return
sessionThreadLocal
.
get
();
}
public
static
Session
openSession
(
ActionContext
context
)
{
Session
session
=
sessionThreadLocal
.
get
();
if
(
session
==
null
)
{
session
=
new
Session
(
context
);
sessionThreadLocal
.
set
(
session
);
}
return
session
;
}
public
static
void
clear
()
{
sessionThreadLocal
.
remove
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment