Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
b35f1f57
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,发现更多精彩内容 >>
提交
b35f1f57
编写于
12月 16, 2020
作者:
O
o2sword
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
全局设计搜索之script脚本搜索
上级
047fd5ce
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
834 addition
and
3 deletion
+834
-3
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ActionManagerList.java
.../cms/assemble/control/jaxrs/script/ActionManagerList.java
+58
-0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ScriptAction.java
...com/x/cms/assemble/control/jaxrs/script/ScriptAction.java
+18
-1
o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/script/ActionManagerList.java
...tal/assemble/designer/jaxrs/script/ActionManagerList.java
+70
-0
o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/script/ScriptAction.java
...x/portal/assemble/designer/jaxrs/script/ScriptAction.java
+18
-1
o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/script/ActionManagerList.java
...orm/assemble/designer/jaxrs/script/ActionManagerList.java
+71
-0
o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/script/ScriptAction.java
...platform/assemble/designer/jaxrs/script/ScriptAction.java
+18
-1
o2server/x_query_service_processing/pom.xml
o2server/x_query_service_processing/pom.xml
+4
-0
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/ActionApplication.java
...m/x/query/service/processing/jaxrs/ActionApplication.java
+2
-0
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/DesignJaxrsFilter.java
...m/x/query/service/processing/jaxrs/DesignJaxrsFilter.java
+10
-0
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/ActionSearch.java
...x/query/service/processing/jaxrs/design/ActionSearch.java
+312
-0
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/BaseAction.java
...m/x/query/service/processing/jaxrs/design/BaseAction.java
+85
-0
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/DesignAction.java
...x/query/service/processing/jaxrs/design/DesignAction.java
+45
-0
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/ExceptionFieldEmpty.java
.../service/processing/jaxrs/design/ExceptionFieldEmpty.java
+14
-0
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/WrapScript.java
...m/x/query/service/processing/jaxrs/design/WrapScript.java
+109
-0
未找到文件。
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ActionManagerList.java
0 → 100644
浏览文件 @
b35f1f57
package
com.x.cms.assemble.control.jaxrs.script
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.cms.core.entity.AppInfo
;
import
com.x.cms.core.entity.element.Script
;
import
java.util.List
;
class
ActionManagerList
extends
BaseAction
{
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
)
throws
Exception
{
if
(!
effectivePerson
.
isManager
()){
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
List
<
Wo
>
wos
=
emc
.
fetchAll
(
Script
.
class
,
Wo
.
copier
);
wos
.
stream
().
forEach
(
wo
->
{
try
{
AppInfo
appInfo
=
emc
.
find
(
wo
.
getAppId
(),
AppInfo
.
class
);
if
(
appInfo
!=
null
){
wo
.
setAppName
(
appInfo
.
getAppName
());
}
}
catch
(
Exception
e
)
{
}
});
result
.
setData
(
wos
);
result
.
setCount
((
long
)
wos
.
size
());
return
result
;
}
}
public
static
class
Wo
extends
Script
{
private
static
final
long
serialVersionUID
=
-
8095369685452823624L
;
static
WrapCopier
<
Script
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Script
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Script
.
class
,
true
,
false
),
null
);
@FieldDescribe
(
"应用名称."
)
private
String
appName
;
public
String
getAppName
()
{
return
appName
;
}
public
void
setAppName
(
String
appName
)
{
this
.
appName
=
appName
;
}
}
}
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ScriptAction.java
浏览文件 @
b35f1f57
...
...
@@ -258,4 +258,21 @@ public class ScriptAction extends StandardJaxrsAction {
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
\ No newline at end of file
@JaxrsMethodDescribe
(
value
=
"列示Script对象(管理员权限)."
,
action
=
ActionManagerList
.
class
)
@GET
@Path
(
"list/manager"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
managerList
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
)
{
ActionResult
<
List
<
ActionManagerList
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionManagerList
().
execute
(
effectivePerson
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/script/ActionManagerList.java
0 → 100644
浏览文件 @
b35f1f57
package
com.x.portal.assemble.designer.jaxrs.script
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.portal.core.entity.Portal
;
import
com.x.portal.core.entity.Script
;
import
java.util.List
;
class
ActionManagerList
extends
BaseAction
{
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
)
throws
Exception
{
if
(!
effectivePerson
.
isManager
()){
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
List
<
Wo
>
wos
=
emc
.
fetchAll
(
Script
.
class
,
Wo
.
copier
);
wos
.
stream
().
forEach
(
wo
->
{
try
{
Portal
portal
=
emc
.
find
(
wo
.
getPortal
(),
Portal
.
class
);
if
(
portal
!=
null
){
wo
.
setAppId
(
portal
.
getId
());
wo
.
setAppName
(
portal
.
getName
());
}
}
catch
(
Exception
e
)
{
}
});
result
.
setData
(
wos
);
result
.
setCount
((
long
)
wos
.
size
());
return
result
;
}
}
public
static
class
Wo
extends
Script
{
private
static
final
long
serialVersionUID
=
-
8095369685452823624L
;
static
WrapCopier
<
Script
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Script
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Script
.
class
,
true
,
false
),
null
);
@FieldDescribe
(
"应用Id."
)
private
String
appId
;
@FieldDescribe
(
"应用名称."
)
private
String
appName
;
public
String
getAppId
()
{
return
appId
;
}
public
void
setAppId
(
String
appId
)
{
this
.
appId
=
appId
;
}
public
String
getAppName
()
{
return
appName
;
}
public
void
setAppName
(
String
appName
)
{
this
.
appName
=
appName
;
}
}
}
o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/script/ScriptAction.java
浏览文件 @
b35f1f57
...
...
@@ -142,4 +142,21 @@ public class ScriptAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
\ No newline at end of file
@JaxrsMethodDescribe
(
value
=
"列示Script对象(管理员权限)."
,
action
=
ActionManagerList
.
class
)
@GET
@Path
(
"list/manager"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
managerList
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
)
{
ActionResult
<
List
<
ActionManagerList
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionManagerList
().
execute
(
effectivePerson
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/script/ActionManagerList.java
0 → 100644
浏览文件 @
b35f1f57
package
com.x.processplatform.assemble.designer.jaxrs.script
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.core.entity.element.Application
;
import
com.x.processplatform.core.entity.element.Script
;
import
java.util.List
;
class
ActionManagerList
extends
BaseAction
{
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
)
throws
Exception
{
if
(!
effectivePerson
.
isManager
()){
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
List
<
Wo
>
wos
=
emc
.
fetchAll
(
Script
.
class
,
Wo
.
copier
);
wos
.
stream
().
forEach
(
wo
->
{
try
{
Application
app
=
emc
.
find
(
wo
.
getApplication
(),
Application
.
class
);
if
(
app
!=
null
){
wo
.
setAppId
(
app
.
getId
());
wo
.
setAppName
(
app
.
getName
());
}
}
catch
(
Exception
e
)
{
}
});
result
.
setData
(
wos
);
result
.
setCount
((
long
)
wos
.
size
());
return
result
;
}
}
public
static
class
Wo
extends
Script
{
private
static
final
long
serialVersionUID
=
-
8095369685452823624L
;
static
WrapCopier
<
Script
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Script
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Script
.
class
,
true
,
false
),
null
);
@FieldDescribe
(
"应用Id."
)
private
String
appId
;
@FieldDescribe
(
"应用名称."
)
private
String
appName
;
public
String
getAppId
()
{
return
appId
;
}
public
void
setAppId
(
String
appId
)
{
this
.
appId
=
appId
;
}
public
String
getAppName
()
{
return
appName
;
}
public
void
setAppName
(
String
appName
)
{
this
.
appName
=
appName
;
}
}
}
o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/script/ScriptAction.java
浏览文件 @
b35f1f57
...
...
@@ -199,4 +199,21 @@ public class ScriptAction extends StandardJaxrsAction {
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
\ No newline at end of file
@JaxrsMethodDescribe
(
value
=
"列示Script对象(管理员权限)."
,
action
=
ActionManagerList
.
class
)
@GET
@Path
(
"list/manager"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
managerList
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
)
{
ActionResult
<
List
<
ActionManagerList
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionManagerList
().
execute
(
effectivePerson
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
o2server/x_query_service_processing/pom.xml
浏览文件 @
b35f1f57
...
...
@@ -44,6 +44,10 @@
<groupId>
o2oa
</groupId>
<artifactId>
x_cms_core_express
</artifactId>
</dependency>
<dependency>
<groupId>
o2oa
</groupId>
<artifactId>
x_portal_core_entity
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
...
...
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/ActionApplication.java
浏览文件 @
b35f1f57
...
...
@@ -5,6 +5,7 @@ import java.util.Set;
import
javax.ws.rs.ApplicationPath
;
import
com.x.base.core.project.jaxrs.AbstractActionApplication
;
import
com.x.query.service.processing.jaxrs.design.DesignAction
;
import
com.x.query.service.processing.jaxrs.neural.NeuralAction
;
import
com.x.query.service.processing.jaxrs.segment.SegmentAction
;
import
com.x.query.service.processing.jaxrs.test.TestAction
;
...
...
@@ -16,6 +17,7 @@ public class ActionApplication extends AbstractActionApplication {
classes
.
add
(
TestAction
.
class
);
classes
.
add
(
NeuralAction
.
class
);
classes
.
add
(
SegmentAction
.
class
);
classes
.
add
(
DesignAction
.
class
);
return
classes
;
}
...
...
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/DesignJaxrsFilter.java
0 → 100644
浏览文件 @
b35f1f57
package
com.x.query.service.processing.jaxrs
;
import
com.x.base.core.project.jaxrs.CipherManagerUserJaxrsFilter
;
import
javax.servlet.annotation.WebFilter
;
@WebFilter
(
urlPatterns
=
"/jaxrs/design/*"
,
asyncSupported
=
true
)
public
class
DesignJaxrsFilter
extends
CipherManagerUserJaxrsFilter
{
}
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/ActionSearch.java
0 → 100644
浏览文件 @
b35f1f57
package
com.x.query.service.processing.jaxrs.design
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.project.Applications
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.SortTools
;
import
com.x.base.core.project.x_cms_assemble_control
;
import
com.x.base.core.project.x_portal_assemble_designer
;
import
com.x.base.core.project.x_processplatform_assemble_designer
;
import
com.x.query.service.processing.ThisApplication
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.CompletableFuture
;
class
ActionSearch
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionSearch
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
Wo
wo
=
new
Wo
();
wo
.
setType
(
wi
.
getType
());
if
(
StringUtils
.
isBlank
(
wi
.
getKeyword
())){
throw
new
ExceptionFieldEmpty
(
"keyword"
);
}
if
(
StringUtils
.
isBlank
(
wi
.
getType
())){
throw
new
ExceptionFieldEmpty
(
"type"
);
}
logger
.
print
(
"{}搜索全局设计:{},关键字:{}"
,
effectivePerson
.
getDistinguishedName
(),
wi
.
getType
(),
wi
.
getKeyword
());
switch
(
wi
.
getType
())
{
case
"script"
:
wo
.
setScriptWrapList
(
searchScript
(
wi
));
break
;
default
:
throw
new
ExceptionFieldEmpty
(
"type"
);
}
result
.
setData
(
wo
);
return
result
;
}
private
List
<
ScriptWo
>
searchScript
(
final
Wi
wi
)
throws
Exception
{
List
<
ScriptWo
>
scriptWoList
=
new
ArrayList
<>();
CompletableFuture
<
List
<
ScriptWo
>>
cmsCf
=
CompletableFuture
.
supplyAsync
(()
->
{
List
<
ScriptWo
>
swList
=
new
ArrayList
<>();
try
{
List
<
WrapScript
>
scriptList
=
ThisApplication
.
context
().
applications
().
getQuery
(
x_cms_assemble_control
.
class
,
Applications
.
joinQueryUri
(
"script"
,
"list"
,
"manager"
),
null
).
getDataAsList
(
WrapScript
.
class
);
logger
.
print
(
"CMS的脚本个数:{}"
,
scriptList
.
size
());
getScriptSearchRes
(
wi
,
"cms"
,
swList
,
scriptList
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
if
(
swList
.
size
()>
2
){
try
{
SortTools
.
desc
(
swList
,
"appId"
);
}
catch
(
Exception
e
)
{
}
}
return
swList
;
});
CompletableFuture
<
List
<
ScriptWo
>>
portalCf
=
CompletableFuture
.
supplyAsync
(()
->
{
List
<
ScriptWo
>
swList
=
new
ArrayList
<>();
try
{
List
<
WrapScript
>
scriptList
=
ThisApplication
.
context
().
applications
().
getQuery
(
x_portal_assemble_designer
.
class
,
Applications
.
joinQueryUri
(
"script"
,
"list"
,
"manager"
),
null
).
getDataAsList
(
WrapScript
.
class
);
logger
.
print
(
"门户的脚本个数:{}"
,
scriptList
.
size
());
getScriptSearchRes
(
wi
,
"portal"
,
swList
,
scriptList
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
if
(
swList
.
size
()>
2
){
try
{
SortTools
.
desc
(
swList
,
"appId"
);
}
catch
(
Exception
e
)
{
}
}
return
swList
;
});
CompletableFuture
<
List
<
ScriptWo
>>
processPlatformCf
=
CompletableFuture
.
supplyAsync
(()
->
{
List
<
ScriptWo
>
swList
=
new
ArrayList
<>();
try
{
List
<
WrapScript
>
scriptList
=
ThisApplication
.
context
().
applications
().
getQuery
(
x_processplatform_assemble_designer
.
class
,
Applications
.
joinQueryUri
(
"script"
,
"list"
,
"manager"
),
null
).
getDataAsList
(
WrapScript
.
class
);
logger
.
print
(
"流程平台的脚本个数:{}"
,
scriptList
.
size
());
getScriptSearchRes
(
wi
,
"processPlatform"
,
swList
,
scriptList
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
if
(
swList
.
size
()>
2
){
try
{
SortTools
.
desc
(
swList
,
"appId"
);
}
catch
(
Exception
e
)
{
}
}
return
swList
;
});
scriptWoList
.
addAll
(
processPlatformCf
.
get
());
scriptWoList
.
addAll
(
portalCf
.
get
());
scriptWoList
.
addAll
(
cmsCf
.
get
());
return
scriptWoList
;
}
private
void
getScriptSearchRes
(
final
Wi
wi
,
String
moduleType
,
List
<
ScriptWo
>
swList
,
List
<
WrapScript
>
scriptList
){
if
(!
ListTools
.
isEmpty
(
scriptList
)){
for
(
WrapScript
script:
scriptList
)
{
if
(
keywordMatch
(
wi
.
getKeyword
(),
script
.
getText
(),
wi
.
getCaseSensitive
(),
wi
.
getMatchWholeWord
(),
wi
.
getMatchRegExp
())){
List
<
Integer
>
list
=
patternLines
(
script
.
getId
()+
"-"
+
script
.
getUpdateTime
().
getTime
(),
wi
.
getKeyword
(),
script
.
getText
(),
wi
.
getCaseSensitive
(),
wi
.
getMatchWholeWord
(),
wi
.
getMatchRegExp
());
if
(!
ListTools
.
isEmpty
(
list
)){
ScriptWo
scriptWo
=
new
ScriptWo
();
scriptWo
.
setModuleType
(
moduleType
);
scriptWo
.
setAppId
(
script
.
getAppId
());
scriptWo
.
setAppName
(
script
.
getAppName
());
scriptWo
.
setScriptId
(
script
.
getId
());
scriptWo
.
setScriptName
(
script
.
getName
());
scriptWo
.
setPatternLines
(
list
);
swList
.
add
(
scriptWo
);
}
}
}
}
}
public
static
class
Wi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
4015406081411685640L
;
@FieldDescribe
(
"搜索关键字."
)
private
String
keyword
;
@FieldDescribe
(
"搜索类型:script|form|process"
)
private
String
type
;
@FieldDescribe
(
"是否区分大小写."
)
private
Boolean
caseSensitive
;
@FieldDescribe
(
"是否全字匹配."
)
private
Boolean
matchWholeWord
;
@FieldDescribe
(
"是否正则表达式匹配."
)
private
Boolean
matchRegExp
;
@FieldDescribe
(
"限制查询的模块列表."
)
private
List
<
Module
>
moduleList
;
public
String
getKeyword
()
{
return
keyword
;
}
public
void
setKeyword
(
String
keyword
)
{
this
.
keyword
=
keyword
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
Boolean
getCaseSensitive
()
{
return
caseSensitive
;
}
public
void
setCaseSensitive
(
Boolean
caseSensitive
)
{
this
.
caseSensitive
=
caseSensitive
;
}
public
Boolean
getMatchWholeWord
()
{
return
matchWholeWord
;
}
public
void
setMatchWholeWord
(
Boolean
matchWholeWord
)
{
this
.
matchWholeWord
=
matchWholeWord
;
}
public
Boolean
getMatchRegExp
()
{
return
matchRegExp
;
}
public
void
setMatchRegExp
(
Boolean
matchRegExp
)
{
this
.
matchRegExp
=
matchRegExp
;
}
public
List
<
Module
>
getModuleList
()
{
return
moduleList
;
}
public
void
setModuleList
(
List
<
Module
>
moduleList
)
{
this
.
moduleList
=
moduleList
;
}
}
public
static
class
Module
extends
GsonPropertyObject
{
@FieldDescribe
(
"模块的应用关键字."
)
private
String
flag
;
@FieldDescribe
(
"模块类型:processPlatform|cms|portal|query|service"
)
private
String
moduleType
;
public
String
getFlag
()
{
return
flag
;
}
public
void
setFlag
(
String
flag
)
{
this
.
flag
=
flag
;
}
public
String
getModuleType
()
{
return
moduleType
;
}
public
void
setModuleType
(
String
moduleType
)
{
this
.
moduleType
=
moduleType
;
}
}
public
static
class
Wo
extends
GsonPropertyObject
{
@FieldDescribe
(
"搜索类型:script|form|process"
)
private
String
type
;
@FieldDescribe
(
"脚本搜索结果集"
)
private
List
<
ScriptWo
>
scriptWrapList
=
new
ArrayList
<>();
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
List
<
ScriptWo
>
getScriptWrapList
()
{
return
scriptWrapList
;
}
public
void
setScriptWrapList
(
List
<
ScriptWo
>
scriptWrapList
)
{
this
.
scriptWrapList
=
scriptWrapList
;
}
}
public
static
class
ScriptWo
extends
GsonPropertyObject
{
@FieldDescribe
(
"模块类型:processPlatform|cms|portal|query|service"
)
private
String
moduleType
;
@FieldDescribe
(
"应用ID"
)
private
String
appId
;
@FieldDescribe
(
"应用名称"
)
private
String
appName
;
@FieldDescribe
(
"脚本Id"
)
private
String
scriptId
;
@FieldDescribe
(
"脚本名称"
)
private
String
scriptName
;
@FieldDescribe
(
"匹配行"
)
private
List
<
Integer
>
patternLines
;
public
String
getModuleType
()
{
return
moduleType
;
}
public
void
setModuleType
(
String
moduleType
)
{
this
.
moduleType
=
moduleType
;
}
public
String
getAppId
()
{
return
appId
;
}
public
void
setAppId
(
String
appId
)
{
this
.
appId
=
appId
;
}
public
String
getAppName
()
{
return
appName
;
}
public
void
setAppName
(
String
appName
)
{
this
.
appName
=
appName
;
}
public
String
getScriptId
()
{
return
scriptId
;
}
public
void
setScriptId
(
String
scriptId
)
{
this
.
scriptId
=
scriptId
;
}
public
String
getScriptName
()
{
return
scriptName
;
}
public
void
setScriptName
(
String
scriptName
)
{
this
.
scriptName
=
scriptName
;
}
public
List
<
Integer
>
getPatternLines
()
{
return
patternLines
;
}
public
void
setPatternLines
(
List
<
Integer
>
patternLines
)
{
this
.
patternLines
=
patternLines
;
}
}
}
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/BaseAction.java
0 → 100644
浏览文件 @
b35f1f57
package
com.x.query.service.processing.jaxrs.design
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
import
com.x.base.core.project.tools.DefaultCharset
;
import
com.x.base.core.project.tools.FileTools
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.File
;
import
java.io.RandomAccessFile
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
abstract
class
BaseAction
extends
StandardJaxrsAction
{
protected
boolean
keywordMatch
(
String
keyword
,
String
content
,
Boolean
caseSensitive
,
Boolean
matchWholeWord
,
Boolean
matchRegExp
){
if
(
StringUtils
.
isBlank
(
keyword
)
||
StringUtils
.
isBlank
(
content
)){
return
false
;
}
if
(
BooleanUtils
.
isTrue
(
matchRegExp
)){
Pattern
pattern
=
Pattern
.
compile
(
keyword
);
Matcher
matcher
=
pattern
.
matcher
(
content
);
return
matcher
.
find
();
}
else
if
(
BooleanUtils
.
isTrue
(
matchWholeWord
)){
if
(
BooleanUtils
.
isTrue
(
caseSensitive
))
{
Pattern
pattern
=
Pattern
.
compile
(
"\\b("
+
keyword
+
")\\b"
);
Matcher
matcher
=
pattern
.
matcher
(
content
);
return
matcher
.
find
();
}
else
{
Pattern
pattern
=
Pattern
.
compile
(
"\\b("
+
keyword
+
")\\b"
,
Pattern
.
CASE_INSENSITIVE
);
Matcher
matcher
=
pattern
.
matcher
(
content
);
return
matcher
.
find
();
}
}
else
{
if
(
BooleanUtils
.
isTrue
(
caseSensitive
))
{
return
(
content
.
indexOf
(
keyword
)
>
-
1
);
}
else
{
return
(
content
.
toLowerCase
().
indexOf
(
keyword
.
toLowerCase
())
>
-
1
);
}
}
}
protected
List
<
Integer
>
patternLines
(
String
id
,
String
keyword
,
String
content
,
Boolean
caseSensitive
,
Boolean
matchWholeWord
,
Boolean
matchRegExp
){
List
<
Integer
>
list
=
new
ArrayList
<>();
File
file
=
readFile
(
id
,
content
);
if
(
file
!=
null
){
try
(
RandomAccessFile
randomFile
=
new
RandomAccessFile
(
file
,
"r"
))
{
int
curReadLine
=
0
;
String
tmp
=
""
;
while
((
tmp
=
randomFile
.
readLine
())
!=
null
)
{
curReadLine
++;
byte
[]
bytes
=
tmp
.
getBytes
(
"ISO8859-1"
);
String
lineStr
=
new
String
(
bytes
);
if
(
StringUtils
.
isNotBlank
(
lineStr
)
&&
lineStr
.
length
()>=
keyword
.
length
()){
if
(
keywordMatch
(
keyword
,
lineStr
,
caseSensitive
,
matchWholeWord
,
matchRegExp
)){
list
.
add
(
curReadLine
);
}
}
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
return
list
;
}
private
synchronized
File
readFile
(
String
id
,
String
content
){
try
{
File
searchFile
=
new
File
(
Config
.
base
(),
"local/search"
);
FileTools
.
forceMkdir
(
searchFile
);
File
file
=
new
File
(
searchFile
.
getAbsolutePath
(),
id
+
".txt"
);
if
(!
file
.
exists
()){
FileUtils
.
writeByteArrayToFile
(
file
,
content
.
getBytes
(
DefaultCharset
.
name
));
}
return
file
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
}
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/DesignAction.java
0 → 100644
浏览文件 @
b35f1f57
package
com.x.query.service.processing.jaxrs.design
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.project.annotation.JaxrsDescribe
;
import
com.x.base.core.project.annotation.JaxrsMethodDescribe
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.http.HttpMediaType
;
import
com.x.base.core.project.jaxrs.ResponseFactory
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.ws.rs.*
;
import
javax.ws.rs.container.AsyncResponse
;
import
javax.ws.rs.container.Suspended
;
import
javax.ws.rs.core.Context
;
import
javax.ws.rs.core.MediaType
;
@Path
(
"design"
)
@JaxrsDescribe
(
"设计"
)
public
class
DesignAction
extends
StandardJaxrsAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DesignAction
.
class
);
@JaxrsMethodDescribe
(
value
=
"全局设计搜索."
,
action
=
ActionSearch
.
class
)
@POST
@Path
(
"search"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
search
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
JsonElement
jsonElement
)
{
ActionResult
<
ActionSearch
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionSearch
().
execute
(
effectivePerson
,
jsonElement
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/ExceptionFieldEmpty.java
0 → 100644
浏览文件 @
b35f1f57
package
com.x.query.service.processing.jaxrs.design
;
import
com.x.base.core.project.exception.PromptException
;
public
class
ExceptionFieldEmpty
extends
PromptException
{
private
static
final
long
serialVersionUID
=
-
87643358931771164L
;
public
ExceptionFieldEmpty
(
String
field
)
{
super
(
"参数: {} 值无效."
,
field
);
}
}
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/WrapScript.java
0 → 100644
浏览文件 @
b35f1f57
package
com.x.query.service.processing.jaxrs.design
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
java.util.Date
;
public
class
WrapScript
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
2563902286060447795L
;
private
String
id
;
private
String
name
;
private
String
alias
;
private
String
text
;
private
String
appName
;
private
String
appId
;
private
String
portalName
;
private
String
portal
;
private
String
applicationName
;
private
String
application
;
private
Date
updateTime
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getAlias
()
{
return
alias
;
}
public
void
setAlias
(
String
alias
)
{
this
.
alias
=
alias
;
}
public
String
getText
()
{
return
text
;
}
public
void
setText
(
String
text
)
{
this
.
text
=
text
;
}
public
String
getAppName
()
{
return
appName
;
}
public
void
setAppName
(
String
appName
)
{
this
.
appName
=
appName
;
}
public
String
getAppId
()
{
return
appId
;
}
public
void
setAppId
(
String
appId
)
{
this
.
appId
=
appId
;
}
public
String
getPortalName
()
{
return
portalName
;
}
public
void
setPortalName
(
String
portalName
)
{
this
.
portalName
=
portalName
;
}
public
String
getPortal
()
{
return
portal
;
}
public
void
setPortal
(
String
portal
)
{
this
.
portal
=
portal
;
}
public
String
getApplicationName
()
{
return
applicationName
;
}
public
void
setApplicationName
(
String
applicationName
)
{
this
.
applicationName
=
applicationName
;
}
public
String
getApplication
()
{
return
application
;
}
public
void
setApplication
(
String
application
)
{
this
.
application
=
application
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录