Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
07e7640b
o2oa
项目概览
weixin_42566577
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
07e7640b
编写于
9月 11, 2020
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改启动脚本先行拷贝
上级
87098357
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
304 addition
and
75 deletion
+304
-75
o2server/configSample/cache.json
o2server/configSample/cache.json
+28
-0
o2server/pom.xml
o2server/pom.xml
+9
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/build/CreateConfigSample.java
...ava/com/x/base/core/project/build/CreateConfigSample.java
+7
-5
o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/CompressTools.java
...ain/java/com/x/base/core/project/tools/CompressTools.java
+43
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/PathTools.java
...rc/main/java/com/x/base/core/project/tools/PathTools.java
+37
-4
o2server/x_console/src/main/java/com/x/server/console/action/UpdateFile.java
...src/main/java/com/x/server/console/action/UpdateFile.java
+35
-31
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/test/ActionGroup1.java
...m/x/query/service/processing/jaxrs/test/ActionGroup1.java
+45
-0
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/test/ActionGroup2.java
...m/x/query/service/processing/jaxrs/test/ActionGroup2.java
+21
-17
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/test/TestAction.java
...com/x/query/service/processing/jaxrs/test/TestAction.java
+17
-0
o2server/x_query_service_processing/src/main/webapp/describe/describe.json
...service_processing/src/main/webapp/describe/describe.json
+23
-0
o2server/x_query_service_processing/src/main/webapp/describe/sources/com/x/query/service/processing/jaxrs/neural/Learn.java
...es/com/x/query/service/processing/jaxrs/neural/Learn.java
+1
-1
o2server/x_query_service_processing/src/main/webapp/describe/sources/com/x/query/service/processing/jaxrs/test/ActionGroup2.java
...m/x/query/service/processing/jaxrs/test/ActionGroup2.java
+21
-17
o2server/x_query_service_processing/src/main/webapp/describe/sources/com/x/query/service/processing/jaxrs/test/TestAction.java
...com/x/query/service/processing/jaxrs/test/TestAction.java
+17
-0
未找到文件。
o2server/configSample/cache.json
0 → 100644
浏览文件 @
07e7640b
{
"type"
:
"ehcache"
,
"redis"
:
{
"host"
:
"127.0.0.1"
,
"port"
:
6379.0
,
"user"
:
""
,
"password"
:
""
,
"connectionTimeout"
:
3000.0
,
"socketTimeout"
:
3000.0
,
"sslEnable"
:
false
,
"index"
:
0.0
,
"###host"
:
"redis服务器地址###"
,
"###port"
:
"redis服务器端口###"
,
"###user"
:
"认证用户###"
,
"###password"
:
"认证口令###"
,
"###connectionTimeout"
:
"连接等待时间###"
,
"###socketTimeout"
:
"response返回等待时间###"
,
"###sslEnable"
:
"是否启用ssl###"
,
"###index"
:
"数据库编号###"
},
"ehcache"
:
{
"jmxEnable"
:
false
,
"###jmxEnable"
:
"是否启用jmx###"
},
"###type"
:
"缓存类型:ehcache,type###"
,
"###redis"
:
"redis配置###"
,
"###ehcache"
:
"ehcache配置###"
}
\ No newline at end of file
o2server/pom.xml
浏览文件 @
07e7640b
...
...
@@ -128,6 +128,10 @@
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-text
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-compress
</artifactId>
</dependency>
<dependency>
<groupId>
org.eclipse.jetty
</groupId>
<artifactId>
jetty-server
</artifactId>
...
...
@@ -529,6 +533,11 @@
<artifactId>
maven-model
</artifactId>
<version>
3.0
</version>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-compress
</artifactId>
<version>
1.20
</version>
</dependency>
<dependency>
<groupId>
org.eclipse.jetty
</groupId>
<artifactId>
jetty-server
</artifactId>
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/build/CreateConfigSample.java
浏览文件 @
07e7640b
...
...
@@ -11,8 +11,14 @@ import java.util.LinkedHashMap;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.reflect.FieldUtils
;
import
org.apache.commons.lang3.reflect.MethodUtils
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.config.AppStyle
;
import
com.x.base.core.project.config.Cache
;
import
com.x.base.core.project.config.CenterServer
;
import
com.x.base.core.project.config.ClientInit
;
import
com.x.base.core.project.config.Collect
;
...
...
@@ -42,11 +48,6 @@ import com.x.base.core.project.logger.Logger;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.DefaultCharset
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.reflect.FieldUtils
;
import
org.apache.commons.lang3.reflect.MethodUtils
;
public
class
CreateConfigSample
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CreateConfigSample
.
class
);
...
...
@@ -79,6 +80,7 @@ public class CreateConfigSample {
classes
.
add
(
Vfs
.
class
);
classes
.
add
(
WorkTime
.
class
);
classes
.
add
(
ZhengwuDingding
.
class
);
classes
.
add
(
Cache
.
class
);
Collections
.
sort
(
classes
,
new
Comparator
<
Class
<?>>()
{
public
int
compare
(
Class
<?>
c1
,
Class
<?>
c2
)
{
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/CompressTools.java
0 → 100644
浏览文件 @
07e7640b
package
com.x.base.core.project.tools
;
import
java.io.BufferedInputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
org.apache.commons.compress.archivers.zip.ZipArchiveEntry
;
import
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream
;
import
org.apache.commons.io.IOUtils
;
public
class
CompressTools
{
private
CompressTools
()
{
}
public
static
void
unzip
(
Path
zip
,
Path
dir
)
throws
IOException
{
try
(
ZipArchiveInputStream
inputStream
=
new
ZipArchiveInputStream
(
new
BufferedInputStream
(
Files
.
newInputStream
(
zip
))))
{
if
(!
Files
.
exists
(
dir
))
{
Files
.
createDirectories
(
dir
);
}
ZipArchiveEntry
entry
=
null
;
while
((
entry
=
inputStream
.
getNextZipEntry
())
!=
null
)
{
Path
p
=
dir
.
resolve
(
Paths
.
get
(
entry
.
getName
()));
if
(
entry
.
isDirectory
())
{
if
(!
Files
.
exists
(
p
))
{
Files
.
createDirectories
(
p
);
}
}
else
{
if
(!
Files
.
exists
(
p
))
{
Files
.
createFile
(
p
);
}
try
(
OutputStream
os
=
Files
.
newOutputStream
(
p
))
{
IOUtils
.
copy
(
inputStream
,
os
);
}
}
}
}
}
}
o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/PathTools.java
浏览文件 @
07e7640b
package
com.x.base.core.project.tools
;
public
class
PathTools
{
import
java.nio.file.Files
;
import
java.nio.file.Path
;
private
PathTools
()
{
// nothing
}
import
org.apache.commons.lang3.StringUtils
;
public
class
PathTools
{
public
static
final
String
WEB_INF
=
"WEB-INF"
;
public
static
final
String
WEB_INF_WEB_XML
=
"WEB-INF/web.xml"
;
...
...
@@ -12,5 +13,37 @@ public class PathTools {
public
static
final
String
WEB_INF_LASTMODIFIED
=
"WEB-INF/lastModified"
;
public
static
final
String
META_INF
=
"META"
;
public
static
final
String
DOT_WAR
=
".war"
;
public
static
final
String
DOT_JAR
=
".jar"
;
public
static
final
String
DOT_ZIP
=
".zip"
;
public
static
final
String
DOT_BAT
=
".bat"
;
public
static
final
String
DOT_SH
=
".sh"
;
public
static
boolean
shOrBat
(
Path
path
)
{
if
(
Files
.
exists
(
path
)
&&
(!
Files
.
isDirectory
(
path
)))
{
return
StringUtils
.
endsWithAny
(
path
.
getFileName
().
toString
().
toLowerCase
(),
DOT_BAT
,
DOT_SH
);
}
return
false
;
}
public
static
boolean
jarOrZip
(
Path
path
)
{
if
(
Files
.
exists
(
path
)
&&
(!
Files
.
isDirectory
(
path
)))
{
return
StringUtils
.
endsWithAny
(
path
.
getFileName
().
toString
().
toLowerCase
(),
DOT_JAR
,
DOT_ZIP
);
}
return
false
;
}
public
static
boolean
jar
(
Path
path
)
{
if
(
Files
.
exists
(
path
)
&&
(!
Files
.
isDirectory
(
path
)))
{
return
StringUtils
.
endsWith
(
path
.
getFileName
().
toString
().
toLowerCase
(),
DOT_JAR
);
}
return
false
;
}
public
static
boolean
war
(
Path
path
)
{
if
(
Files
.
exists
(
path
)
&&
(!
Files
.
isDirectory
(
path
)))
{
return
StringUtils
.
endsWith
(
path
.
getFileName
().
toString
().
toLowerCase
(),
DOT_WAR
);
}
return
false
;
}
}
o2server/x_console/src/main/java/com/x/server/console/action/UpdateFile.java
浏览文件 @
07e7640b
package
com.x.server.console.action
;
import
java.io.File
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.Date
;
import
java.util.stream.Stream
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.filefilter.FileFilterUtils
;
import
org.apache.commons.io.filefilter.IOFileFilter
;
import
org.apache.commons.io.filefilter.WildcardFileFilter
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.JarTools
;
import
org.apache.commons.io.FileUtils
;
/**
* @author Zhou Rui
*/
...
...
@@ -31,11 +38,9 @@ public class UpdateFile extends ActionBase {
logger
.
print
(
"zip file not exist, path:{}."
,
path
);
return
false
;
}
// if (backup) {
// this.backup();
// }
logger
.
print
(
"update from file:{}."
,
file
.
getAbsolutePath
());
this
.
unzip
(
file
);
this
.
updateShell
();
logger
.
print
(
"update completed in {} seconds, restart server to continue update."
,
((
new
Date
()).
getTime
()
-
start
.
getTime
())
/
1000
);
return
true
;
...
...
@@ -45,32 +50,31 @@ public class UpdateFile extends ActionBase {
}
}
// private void backup() throws Exception {
// File dir = Config.dir_local_backup(true);
// String tag = DateTools.compact(new Date());
// File dest = new File(dir, tag + ".zip");
// logger.print("backup current version to {}.", dest.getAbsolutePath());
// List<File> files = new ArrayList<>();
// files.add(Config.dir_commons());
// files.add(Config.dir_config());
// files.add(Config.dir_configSample());
// files.add(Config.dir_localSample());
// files.add(Config.dir_jvm());
// files.add(Config.dir_servers());
// files.add(Config.dir_store());
// files.add(Config.dir_dynamic());
// files.add(Config.dir_custom());
// files.add(new File(Config.base(), "console.jar"));
// files.add(new File(Config.base(), "index.html"));
// files.add(new File(Config.base(), "version.o2"));
// FileFilter fileFilter = new RegexFileFilter(
// "^(start_|stop_|console_|service_)(aix|windows|linux|macos).(sh|bat)$");
// for (File _f : new File(Config.base()).listFiles(fileFilter)) {
// files.add(_f);
// }
// JarTools.jar(files, dest);
// logger.print("backup current version completed.");
// }
private
void
updateShell
()
throws
Exception
{
IOFileFilter
filter
=
FileFilterUtils
.
or
(
new
WildcardFileFilter
(
"start_*.sh"
),
new
WildcardFileFilter
(
"start_*.bat"
),
new
WildcardFileFilter
(
"stop_*.sh"
),
new
WildcardFileFilter
(
"stop_*.bat"
),
new
WildcardFileFilter
(
"console_*.sh"
),
new
WildcardFileFilter
(
"console_*.bat"
),
new
WildcardFileFilter
(
"service_*.bat"
));
try
(
Stream
<
Path
>
stream
=
Files
.
list
(
Config
.
dir_local_update
().
toPath
().
resolve
(
Paths
.
get
(
"o2server"
))))
{
stream
.
filter
(
o
->
filter
.
accept
(
o
.
toFile
())).
forEach
(
o
->
{
try
{
copy
(
o
);
Files
.
delete
(
o
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
});
}
}
private
void
copy
(
Path
source
)
throws
Exception
{
Path
target
=
Paths
.
get
(
Config
.
base
(),
source
.
getFileName
().
toString
());
if
(
Files
.
exists
(
target
))
{
Files
.
write
(
target
,
Files
.
readAllLines
(
source
));
}
else
{
Files
.
copy
(
source
,
target
);
}
}
private
void
unzip
(
File
file
)
throws
Exception
{
File
dir
=
Config
.
dir_local_update
(
true
);
...
...
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/test/ActionGroup1.java
0 → 100644
浏览文件 @
07e7640b
package
com.x.query.service.processing.jaxrs.test
;
import
javax.persistence.EntityManager
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Root
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.utils.time.ClockStamp
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.Work_
;
class
ActionGroup1
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionGroup1
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ClockStamp
.
INIT
(
"创建测试distinct代码."
,
""
);
return
new
ActionResult
<>();
}
}
private
void
id
(
EntityManagerContainer
emc
)
throws
Exception
{
ClockStamp
.
STAMP
(
"执行work的id distinct{}."
,
"开始"
);
EntityManager
em
=
emc
.
get
(
Work
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
Work
>
root
=
cq
.
from
(
Work
.
class
);
cq
.
select
(
root
.
get
(
Work_
.
id
)).
distinct
(
true
);
em
.
createQuery
(
cq
).
getResultList
();
ClockStamp
.
STAMP
(
"执行work的id distinct{}."
,
"结束"
);
}
public
static
class
Wo
extends
WrapBoolean
{
}
}
\ No newline at end of file
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/test/ActionGroup2.java
浏览文件 @
07e7640b
package
com.x.query.service.processing.jaxrs.test
;
import
java.util.ArrayList
;
import
javax.script.Bindings
;
import
javax.script.ScriptContext
;
import
javax.script.ScriptEngine
;
import
javax.script.SimpleScriptContext
;
import
javax.persistence.EntityManager
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Root
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
...
...
@@ -14,7 +12,9 @@ import com.x.base.core.project.http.EffectivePerson;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.script.ScriptFactory
;
import
com.x.base.core.project.utils.time.ClockStamp
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.Work_
;
class
ActionGroup2
extends
BaseAction
{
...
...
@@ -22,19 +22,23 @@ class ActionGroup2 extends BaseAction {
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
ScriptEngine
engine
=
ScriptFactory
.
newScriptEngine
();
ScriptContext
scriptContext
=
new
SimpleScriptContext
();
Bindings
bindings
=
scriptContext
.
getBindings
(
ScriptContext
.
ENGINE_SCOPE
);
bindings
.
put
(
"data"
,
new
ArrayList
<>());
engine
.
setContext
(
scriptContext
);
engine
.
eval
(
"var o = this.data && this.data.length;"
);
Object
o
=
engine
.
eval
(
"o;"
);
System
.
out
.
println
(
o
.
getClass
());
return
result
;
ClockStamp
.
INIT
(
"创建测试distinct代码."
,
""
);
job
(
emc
);
return
new
ActionResult
<>();
}
}
private
void
job
(
EntityManagerContainer
emc
)
throws
Exception
{
ClockStamp
.
STAMP
(
"执行work的job distinct{}."
,
"开始"
);
EntityManager
em
=
emc
.
get
(
Work
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
Work
>
root
=
cq
.
from
(
Work
.
class
);
cq
.
select
(
root
.
get
(
Work_
.
id
)).
distinct
(
true
);
em
.
createQuery
(
cq
).
getResultList
();
ClockStamp
.
STAMP
(
"执行work的job distinct{}."
,
"结束"
);
}
public
static
class
Wo
extends
WrapBoolean
{
}
...
...
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/test/TestAction.java
浏览文件 @
07e7640b
...
...
@@ -81,6 +81,23 @@ public class TestAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"执行group."
,
action
=
ActionGroup2
.
class
)
@GET
@Path
(
"group1"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
group1
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
)
{
ActionResult
<
ActionGroup1
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionGroup1
().
execute
(
effectivePerson
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"执行group."
,
action
=
ActionGroup2
.
class
)
@GET
@Path
(
"group2"
)
...
...
o2server/x_query_service_processing/src/main/webapp/describe/describe.json
浏览文件 @
07e7640b
...
...
@@ -727,6 +727,29 @@
}
]
},
{
"name"
:
"group1"
,
"className"
:
"com.x.query.service.processing.jaxrs.test.ActionGroup2"
,
"description"
:
"执行group."
,
"type"
:
"GET"
,
"path"
:
"jaxrs/test/group1"
,
"contentType"
:
"application/json"
,
"resultContentType"
:
"application/json; charset
\u
003dUTF-8"
,
"useJsonElementParameter"
:
false
,
"useStringParameter"
:
false
,
"pathParameters"
:
[],
"formParameters"
:
[],
"queryParameters"
:
[],
"ins"
:
[],
"outs"
:
[
{
"name"
:
"value"
,
"type"
:
"Boolean"
,
"isCollection"
:
false
,
"description"
:
"布尔值."
}
]
},
{
"name"
:
"group2"
,
"className"
:
"com.x.query.service.processing.jaxrs.test.ActionGroup2"
,
...
...
o2server/x_query_service_processing/src/main/webapp/describe/sources/com/x/query/service/processing/jaxrs/neural/Learn.java
浏览文件 @
07e7640b
...
...
@@ -283,7 +283,7 @@ public class Learn {
cq
.
select
(
root
).
where
(
p
).
orderBy
(
cb
.
desc
(
root
.
get
(
InText_
.
count
)));
Integer
cutoff
=
MapTools
.
getInteger
(
model
.
getPropertyMap
(),
Model
.
PROPERTY_MLP_LEARNINTEXTCUTOFFSIZE
,
Model
.
DEFAULT_MLP_LEARNINTEXTCUTOFFSIZE
);
List
<
InText
>
os
=
em
.
createQuery
(
cq
.
distinct
(
true
)
).
setMaxResults
(
cutoff
).
getResultList
();
List
<
InText
>
os
=
em
.
createQuery
(
cq
).
setMaxResults
(
cutoff
).
getResultList
();
InTextBag
inTextBag
=
new
InTextBag
(
os
);
return
inTextBag
;
}
...
...
o2server/x_query_service_processing/src/main/webapp/describe/sources/com/x/query/service/processing/jaxrs/test/ActionGroup2.java
浏览文件 @
07e7640b
package
com.x.query.service.processing.jaxrs.test
;
import
java.util.ArrayList
;
import
javax.script.Bindings
;
import
javax.script.ScriptContext
;
import
javax.script.ScriptEngine
;
import
javax.script.SimpleScriptContext
;
import
javax.persistence.EntityManager
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Root
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
...
...
@@ -14,7 +12,9 @@ import com.x.base.core.project.http.EffectivePerson;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.script.ScriptFactory
;
import
com.x.base.core.project.utils.time.ClockStamp
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.Work_
;
class
ActionGroup2
extends
BaseAction
{
...
...
@@ -22,19 +22,23 @@ class ActionGroup2 extends BaseAction {
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
ScriptEngine
engine
=
ScriptFactory
.
newScriptEngine
();
ScriptContext
scriptContext
=
new
SimpleScriptContext
();
Bindings
bindings
=
scriptContext
.
getBindings
(
ScriptContext
.
ENGINE_SCOPE
);
bindings
.
put
(
"data"
,
new
ArrayList
<>());
engine
.
setContext
(
scriptContext
);
engine
.
eval
(
"var o = this.data && this.data.length;"
);
Object
o
=
engine
.
eval
(
"o;"
);
System
.
out
.
println
(
o
.
getClass
());
return
result
;
ClockStamp
.
INIT
(
"创建测试distinct代码."
,
""
);
job
(
emc
);
return
new
ActionResult
<>();
}
}
private
void
job
(
EntityManagerContainer
emc
)
throws
Exception
{
ClockStamp
.
STAMP
(
"执行work的job distinct{}."
,
"开始"
);
EntityManager
em
=
emc
.
get
(
Work
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
Work
>
root
=
cq
.
from
(
Work
.
class
);
cq
.
select
(
root
.
get
(
Work_
.
id
)).
distinct
(
true
);
em
.
createQuery
(
cq
).
getResultList
();
ClockStamp
.
STAMP
(
"执行work的job distinct{}."
,
"结束"
);
}
public
static
class
Wo
extends
WrapBoolean
{
}
...
...
o2server/x_query_service_processing/src/main/webapp/describe/sources/com/x/query/service/processing/jaxrs/test/TestAction.java
浏览文件 @
07e7640b
...
...
@@ -81,6 +81,23 @@ public class TestAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"执行group."
,
action
=
ActionGroup2
.
class
)
@GET
@Path
(
"group1"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
group1
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
)
{
ActionResult
<
ActionGroup1
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionGroup1
().
execute
(
effectivePerson
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"执行group."
,
action
=
ActionGroup2
.
class
)
@GET
@Path
(
"group2"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录