Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
test
Project
Project
Details
Activity
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
邬友楠
test
Commits
83e6a7b0
Commit
83e6a7b0
authored
Oct 27, 2020
by
雍欢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设置流程事件监听和用户任务监听器的时候可以通过easysearch查询已有spring bean
parent
31b47eba
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
145 additions
and
15 deletions
+145
-15
ModelController.java
.../java/com/huigou/explorer/controller/ModelController.java
+60
-2
listenerDetails.jsp
.../main/webapp/system/configtool/editor/listenerDetails.jsp
+2
-1
listeners.js
...-xt/src/main/webapp/system/configtool/editor/listeners.js
+40
-5
taskListenerDetails.jsp
...n/webapp/system/configtool/editor/taskListenerDetails.jsp
+2
-1
taskListeners.js
...src/main/webapp/system/configtool/editor/taskListeners.js
+41
-6
No files found.
huigou-explorer/src/main/java/com/huigou/explorer/controller/ModelController.java
View file @
83e6a7b0
...
...
@@ -7,6 +7,11 @@ import com.huigou.explorer.converters.WorkflowModeConverter;
import
com.huigou.explorer.domain.model.Model
;
import
com.huigou.explorer.util.GraphUtils
;
import
com.huigou.uasp.annotation.ControllerMapping
;
import
com.huigou.uasp.bmp.common.easysearch.EasySearch
;
import
com.huigou.uasp.bmp.common.easysearch.domain.model.EasySearchParse
;
import
com.huigou.uasp.bmp.common.easysearch.domain.model.QuerySchemeField
;
import
com.huigou.uasp.bmp.opm.application.impl.MemEasySearcherImpl
;
import
com.huigou.uasp.bpm.FlowBroker
;
import
com.huigou.uasp.bpm.managment.application.ProcDefinitionApplication
;
import
com.huigou.uasp.bpm.managment.domain.model.ProcDefinition
;
import
com.huigou.uasp.client.CommonController
;
...
...
@@ -18,11 +23,18 @@ import com.mxgraph.util.mxUtils;
import
org.activiti.bpmn.converter.BpmnXMLConverter
;
import
org.activiti.bpmn.model.BpmnModel
;
import
org.activiti.engine.RepositoryService
;
import
org.activiti.engine.delegate.ExecutionListener
;
import
org.activiti.engine.delegate.TaskListener
;
import
org.activiti.engine.impl.util.io.StringStreamSource
;
import
org.activiti.engine.repository.ProcessDefinition
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.util.Assert
;
import
org.springframework.util.MimeTypeUtils
;
...
...
@@ -39,15 +51,16 @@ import java.io.OutputStream;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Base64
;
import
java.util.List
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* @author yonghuan
*/
@ControllerMapping
(
"procDefinition"
)
@Controller
public
class
ModelController
extends
CommonController
{
public
class
ModelController
extends
CommonController
implements
ApplicationContextAware
{
@Autowired
private
ProcDefinitionApplication
procDefinitionApplication
;
...
...
@@ -61,6 +74,12 @@ public class ModelController extends CommonController {
private
BpmnXMLConverter
bpmnXMLConverter
;
@Autowired
private
GeneralRepository
generalRepository
;
private
ApplicationContext
applicationContext
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
this
.
applicationContext
=
applicationContext
;
}
protected
String
getPagePath
()
{
return
"/system/configtool/editor/"
;
...
...
@@ -269,4 +288,43 @@ public class ModelController extends CommonController {
return
toResult
(
formFields
);
}
/**
* easy search用户任务监听器。
*/
@EasySearch
(
configType
=
"bpm"
,
queryName
=
"taskListener"
)
public
Object
searchTaskListener
(
SDO
sdo
)
{
return
searchListener
(
sdo
,
TaskListener
.
class
);
}
/**
* easy search ExecutionListener
*/
@EasySearch
(
configType
=
"bpm"
,
queryName
=
"executionListener"
)
public
Object
searchExecutionListener
(
SDO
sdo
)
{
return
searchListener
(
sdo
,
ExecutionListener
.
class
);
}
private
Object
searchListener
(
SDO
sdo
,
Class
<?>
listenerClass
)
{
Integer
intPage
=
sdo
.
getInteger
(
"intPage"
,
1
);
Integer
pageSize
=
sdo
.
getInteger
(
"pageSize"
);
PageRequest
pageRequest
=
new
PageRequest
(
intPage
-
1
,
pageSize
);
String
paramValue
=
sdo
.
getString
(
"paramValue"
);
List
<
QuerySchemeField
>
fields
=
Arrays
.
asList
(
new
QuerySchemeField
(
"监听器名称"
,
"name"
,
"string"
,
400L
));
EasySearchParse
easySearchParse
=
new
EasySearchParse
();
easySearchParse
.
setFields
(
fields
);
easySearchParse
.
setWidth
(
400L
);
MemEasySearcherImpl
<
Map
<
String
,
Object
>>
memEasySearcher
=
new
MemEasySearcherImpl
<>();
ApplicationContext
rootApplicationContext
=
applicationContext
.
getParent
();
List
<
Map
<
String
,
Object
>>
flowBrokers
=
rootApplicationContext
.
getBeansOfType
(
listenerClass
).
keySet
().
stream
()
.
map
(
name
->
{
Map
<
String
,
Object
>
flowBroker
=
new
HashMap
<>(
1
);
flowBroker
.
put
(
"name"
,
name
);
return
flowBroker
;
}).
collect
(
Collectors
.
toList
());
return
memEasySearcher
.
search
(
flowBrokers
,
easySearchParse
,
pageRequest
,
(
flowBroker
->
StringUtils
.
isBlank
(
paramValue
)
||
((
String
)
flowBroker
.
get
(
"name"
)).
contains
(
paramValue
)));
}
}
huigou-xt/src/main/webapp/system/configtool/editor/listenerDetails.jsp
View file @
83e6a7b0
...
...
@@ -12,7 +12,8 @@
required=
"true"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
label=
"Java Class"
name=
"implementation"
labelCol=
"4"
fieldCol=
"8"
required=
"true"
/>
<x:inputC
label=
"实现"
name=
"implementation"
labelCol=
"4"
fieldCol=
"8"
required=
"true"
wrapper=
"select"
/>
<x:hidden
name=
"implementationSelector"
/>
</div>
</form>
<div
id=
"field-grid"
></div>
...
...
huigou-xt/src/main/webapp/system/configtool/editor/listeners.js
View file @
83e6a7b0
...
...
@@ -92,8 +92,8 @@ function addListenerHandler() {
title
:
'添加执行监听器'
,
width
:
500
,
height
:
430
,
init
:
function
()
{
initListenerDialog
();
init
:
function
(
div
)
{
initListenerDialog
(
div
);
},
okVal
:
'确定'
,
ok
:
function
()
{
...
...
@@ -117,8 +117,8 @@ function updateListenerHandler() {
title
:
'修改执行监听器'
,
width
:
500
,
height
:
430
,
init
:
function
()
{
initListenerDialog
();
init
:
function
(
div
)
{
initListenerDialog
(
div
);
},
okVal
:
'确定'
,
ok
:
function
()
{
...
...
@@ -127,7 +127,7 @@ function updateListenerHandler() {
});
}
function
initListenerDialog
()
{
function
initListenerDialog
(
div
)
{
$
(
'#submitForm [name="implementation"]'
).
parent
().
parent
().
hide
();
$
(
'#submitForm [name="implementationType"]'
).
combox
({
'onChange'
:
function
(
val
)
{
...
...
@@ -137,6 +137,15 @@ function initListenerDialog() {
}
else
{
$
(
'#submitForm [name="implementation"]'
).
parent
().
parent
().
hide
();
}
if
(
val
.
text
==
'delegateExpression'
)
{
$
(
'#implementation_click button'
)
.
removeProp
(
'disabled'
)
.
removeClass
(
'disabled'
);
}
else
{
$
(
'#implementation_click button'
)
.
prop
(
'disabled'
,
'disabled'
)
.
addClass
(
'disabled'
);
}
}
});
var
__id
=
$
(
'#submitForm [name="__id"]'
).
val
(),
fieldExtensions
=
[];
...
...
@@ -156,6 +165,32 @@ function initListenerDialog() {
}
}
}
$
(
'#implementation_click button'
,
div
).
click
(
function
()
{
$
(
'#implementation-selector-container'
).
remove
();
$
(
'<div id="implementation-selector-container"><input id="implementationSelector" name="implementationSelector" /></div>'
).
insertBefore
(
'#implementation_click'
);
$
(
'#implementationSelector'
).
searchbox
({
type
:
'bpm'
,
name
:
'executionListener'
,
getParam
:
function
()
{
return
{};
},
onChange
:
function
(
data
)
{
$
(
'#implementation'
,
div
).
val
(
data
.
text
?
(
'#{'
+
data
.
text
+
'}'
)
:
data
.
text
);
}
});
$
(
'#implementation-selector-container'
).
css
({
height
:
1
,
width
:
1
,
})
$
(
'#implementation-selector-container .input-group input'
).
css
({
width
:
0.1
,
height
:
0.1
,
padding
:
0
,
margin
:
0
});
$
(
'#implementation-selector-container .input-group-btn'
).
remove
();
$
(
'#implementation-selector-container #implementationSelector_text'
).
trigger
(
'click'
);
});
initFieldGrid
(
fieldExtensions
);
}
...
...
huigou-xt/src/main/webapp/system/configtool/editor/taskListenerDetails.jsp
View file @
83e6a7b0
...
...
@@ -12,7 +12,8 @@
required=
"true"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
label=
"Java Class"
name=
"implementation"
labelCol=
"4"
fieldCol=
"8"
required=
"true"
/>
<x:inputC
label=
"实现"
name=
"implementation"
labelCol=
"4"
fieldCol=
"8"
required=
"true"
wrapper=
"select"
/>
<x:hidden
name=
"implementationSelector"
/>
</div>
</form>
<div
id=
"field-grid"
></div>
...
...
huigou-xt/src/main/webapp/system/configtool/editor/taskListeners.js
View file @
83e6a7b0
...
...
@@ -92,8 +92,8 @@ function addListenerHandler() {
title
:
'添加任务监听器'
,
width
:
500
,
height
:
430
,
init
:
function
()
{
initListenerDialog
();
init
:
function
(
div
)
{
initListenerDialog
(
div
);
},
okVal
:
'确定'
,
ok
:
function
()
{
...
...
@@ -114,11 +114,11 @@ function updateListenerHandler() {
__id
:
row
.
__id
,
shape
:
parent
.
getSelectionShape
()
},
title
:
'修改
执行
监听器'
,
title
:
'修改
任务
监听器'
,
width
:
500
,
height
:
430
,
init
:
function
()
{
initListenerDialog
();
init
:
function
(
div
)
{
initListenerDialog
(
div
);
},
okVal
:
'确定'
,
ok
:
function
()
{
...
...
@@ -127,7 +127,7 @@ function updateListenerHandler() {
});
}
function
initListenerDialog
()
{
function
initListenerDialog
(
div
)
{
$
(
'#submitForm [name="implementation"]'
).
parent
().
parent
().
hide
();
$
(
'#submitForm [name="implementationType"]'
).
combox
({
'onChange'
:
function
(
val
)
{
...
...
@@ -137,6 +137,15 @@ function initListenerDialog() {
}
else
{
$
(
'#submitForm [name="implementation"]'
).
parent
().
parent
().
hide
();
}
if
(
val
.
text
==
'delegateExpression'
)
{
$
(
'#implementation_click button'
)
.
removeProp
(
'disabled'
)
.
removeClass
(
'disabled'
);
}
else
{
$
(
'#implementation_click button'
)
.
prop
(
'disabled'
,
'disabled'
)
.
addClass
(
'disabled'
);
}
}
});
var
__id
=
$
(
'#submitForm [name="__id"]'
).
val
(),
fieldExtensions
=
[];
...
...
@@ -156,6 +165,32 @@ function initListenerDialog() {
}
}
}
$
(
'#implementation_click button'
,
div
).
click
(
function
()
{
$
(
'#implementation-selector-container'
).
remove
();
$
(
'<div id="implementation-selector-container"><input id="implementationSelector" name="implementationSelector" /></div>'
).
insertBefore
(
'#implementation_click'
);
$
(
'#implementationSelector'
).
searchbox
({
type
:
'bpm'
,
name
:
'taskListener'
,
getParam
:
function
()
{
return
{};
},
onChange
:
function
(
data
)
{
$
(
'#implementation'
,
div
).
val
(
data
.
text
?
(
'#{'
+
data
.
text
+
'}'
)
:
data
.
text
);
}
});
$
(
'#implementation-selector-container'
).
css
({
height
:
1
,
width
:
1
,
})
$
(
'#implementation-selector-container .input-group input'
).
css
({
width
:
0.1
,
height
:
0.1
,
padding
:
0
,
margin
:
0
});
$
(
'#implementation-selector-container .input-group-btn'
).
remove
();
$
(
'#implementation-selector-container #implementationSelector_text'
).
trigger
(
'click'
);
});
initFieldGrid
(
fieldExtensions
);
}
...
...
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