1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
package info.magnolia.module.templating; |
35 |
|
|
36 |
|
import info.magnolia.cms.core.Content; |
37 |
|
import info.magnolia.context.MgnlContext; |
38 |
|
import info.magnolia.objectfactory.Components; |
39 |
|
|
40 |
|
import java.io.IOException; |
41 |
|
import java.io.Writer; |
42 |
|
|
43 |
|
import javax.servlet.jsp.PageContext; |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
@author |
49 |
|
@version |
50 |
|
@deprecated@link |
51 |
|
|
|
|
| 87.1% |
Uncovered Elements: 4 (31) |
Complexity: 11 |
Complexity Density: 0.58 |
|
52 |
|
public class ParagraphRenderingFacade { |
53 |
|
|
54 |
|
private final ParagraphRendererManager rendererManager; |
55 |
|
|
56 |
|
private final ParagraphManager paragraphManager; |
57 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
58 |
0
|
public static ParagraphRenderingFacade getInstance() {... |
59 |
0
|
return Components.getSingleton(ParagraphRenderingFacade.class); |
60 |
|
} |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
62 |
0
|
public ParagraphRenderingFacade() {... |
63 |
0
|
this(ParagraphRendererManager.getInstance(), ParagraphManager.getInstance()); |
64 |
|
} |
65 |
|
|
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
67 |
3
|
ParagraphRenderingFacade(ParagraphRendererManager rendererManager, ParagraphManager paragraphManager) {... |
68 |
3
|
this.rendererManager = rendererManager; |
69 |
3
|
this.paragraphManager = paragraphManager; |
70 |
|
} |
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
76 |
2
|
public void render(Content content, Writer out) throws RenderException, IOException {... |
77 |
2
|
render(content, out, null); |
78 |
|
} |
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
84 |
2
|
public void render(Content content, Writer out, PageContext pageContext) throws RenderException, IOException {... |
85 |
2
|
final String paragraphName = content.getMetaData().getTemplate(); |
86 |
2
|
final Paragraph paragraph = paragraphManager.getParagraphDefinition(paragraphName); |
87 |
2
|
if (paragraph == null) { |
88 |
1
|
throw new IllegalStateException("Paragraph " + paragraphName + " not found for page " + content.getHandle()); |
89 |
|
} |
90 |
1
|
render(content, paragraph, out, pageContext); |
91 |
|
} |
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
97 |
2
|
public void render(Content content, Paragraph paragraph, Writer out) throws RenderException, IOException {... |
98 |
2
|
render(content, paragraph, out, null); |
99 |
|
} |
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
106 |
4
|
public void render(Content content, Paragraph paragraph, Writer out, PageContext pageContext) throws RenderException, IOException{... |
107 |
4
|
setPageContext(pageContext); |
108 |
4
|
final String paragraphType = paragraph.getType(); |
109 |
|
|
110 |
4
|
try { |
111 |
4
|
final ParagraphRenderer renderer = rendererManager.getRenderer(paragraphType); |
112 |
4
|
renderer.render(content, paragraph, out); |
113 |
|
} finally { |
114 |
4
|
setPageContext(null); |
115 |
|
} |
116 |
|
|
117 |
|
} |
118 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 3 |
Complexity Density: 1.5 |
|
119 |
8
|
private void setPageContext(PageContext pageContext) {... |
120 |
8
|
if (pageContext != null && MgnlContext.isWebContext()) { |
121 |
1
|
MgnlContext.getWebContext().setPageContext(pageContext); |
122 |
|
} |
123 |
|
} |
124 |
|
|
125 |
|
} |