1
1
package org .fugerit .java .doc .freemarker .process ;
2
2
3
3
import java .io .Serializable ;
4
- import java .util .HashMap ;
5
- import java .util .Map ;
4
+ import java .util .Set ;
6
5
7
6
import org .fugerit .java .core .cfg .xml .ListMapConfig ;
8
7
import org .fugerit .java .core .util .filterchain .MiniFilterChain ;
8
+ import org .fugerit .java .core .util .filterchain .MiniFilterMap ;
9
9
import org .fugerit .java .doc .base .facade .DocHandlerFacade ;
10
10
import org .fugerit .java .doc .base .process .DocProcessConfig ;
11
11
import org .fugerit .java .doc .base .process .DocProcessContext ;
15
15
import lombok .extern .slf4j .Slf4j ;
16
16
17
17
@ Slf4j
18
- public class FreemarkerDocProcessConfig extends DocProcessConfig implements Serializable {
18
+ public class FreemarkerDocProcessConfig implements Serializable , MiniFilterMap {
19
19
20
20
private static final long serialVersionUID = -6761081877582850120L ;
21
21
22
22
@ Getter
23
23
private ListMapConfig <DocChainModel > docChainList ;
24
24
25
- private Map <String , MiniFilterChain > additionalChans ;
26
-
27
25
@ Getter
28
26
private DocHandlerFacade facade ;
29
27
28
+ private DocProcessConfig docProcessConfig ;
29
+
30
30
protected FreemarkerDocProcessConfig () {
31
31
super ();
32
32
this .docChainList = new ListMapConfig <>();
33
- this .additionalChans = new HashMap <>();
34
33
this .facade = new DocHandlerFacade ();
34
+ this .docProcessConfig = new DocProcessConfig ();
35
35
}
36
36
37
37
private DefaultChainProvider defaultChain ;
@@ -46,26 +46,35 @@ protected DefaultChainProvider getDefaultChain() {
46
46
47
47
public void process ( String chainId , DocProcessContext context , DocProcessData data ) throws Exception {
48
48
MiniFilterChain chain = this .getChainCache ( chainId );
49
- log .info ( "chain list {}" , this .getIdSet () );
49
+ log .info ( "chain list {}" , this .docProcessConfig . getIdSet () );
50
50
chain .apply ( context , data );
51
51
}
52
52
53
53
@ Override
54
54
public MiniFilterChain getChain (String id ) throws Exception {
55
+ return this .docProcessConfig .getChain ( id );
56
+ }
57
+
58
+ @ Override
59
+ public MiniFilterChain getChainCache (String id ) throws Exception {
55
60
MiniFilterChain chain = null ;
56
- if ( this .getDataList ( id ) != null ) {
57
- chain = this .getChain ( id );
58
- } else if ( this .additionalChans .containsKey ( id ) ) {
59
- chain = this .additionalChans .get ( id );
60
- } else if ( this .getDefaultChain () != null ) {
61
- chain = this .getDefaultChain ().newDefaultChain (id );
62
- this .addAdditionalChain (chain );
61
+ if ( this .docProcessConfig .getKeys ().contains ( id ) ) {
62
+ chain = this .docProcessConfig .getChain (id );
63
+ } else if ( this .defaultChain != null ) {
64
+ chain = this .defaultChain .newDefaultChain (id );
65
+ this .setChain (id , chain );
63
66
}
64
67
return chain ;
65
68
}
66
-
67
- protected void addAdditionalChain ( MiniFilterChain chain ) {
68
- this .additionalChans .put (chain .getChainId (), chain );
69
+
70
+ @ Override
71
+ public Set <String > getKeys () {
72
+ return this .docProcessConfig .getKeys ();
73
+ }
74
+
75
+ @ Override
76
+ public void setChain (String id , MiniFilterChain chain ) {
77
+ this .docProcessConfig .setChain (id , chain );
69
78
}
70
79
71
80
}
0 commit comments