1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.lesscss.internal; |
21 |
|
|
22 |
|
import javax.inject.Inject; |
23 |
|
import javax.inject.Singleton; |
24 |
|
|
25 |
|
import org.xwiki.component.annotation.Component; |
26 |
|
import org.xwiki.context.Execution; |
27 |
|
import org.xwiki.context.ExecutionContext; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
@version |
33 |
|
@since |
34 |
|
|
35 |
|
@Component(roles = LESSContext.class) |
36 |
|
@Singleton |
|
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 8 |
Complexity Density: 0.8 |
|
37 |
|
public class LESSContext |
38 |
|
{ |
39 |
|
private static final String CACHE_PROPERTY = "less.cache.disable"; |
40 |
|
|
41 |
|
private static final String HTML_EXPORT = "less.htmlexport"; |
42 |
|
|
43 |
|
@Inject |
44 |
|
private Execution execution; |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
49 |
3 |
public void disableCache()... |
50 |
|
{ |
51 |
3 |
setProperty(CACHE_PROPERTY, true); |
52 |
|
} |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
2 |
public void stopDisablingCache()... |
58 |
|
{ |
59 |
2 |
setProperty(CACHE_PROPERTY, false); |
60 |
|
} |
61 |
|
|
62 |
|
|
63 |
|
@return |
64 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
65 |
2166 |
public boolean isCacheDisabled()... |
66 |
|
{ |
67 |
2166 |
return Boolean.TRUE.equals(getContext().getProperty(CACHE_PROPERTY)); |
68 |
|
} |
69 |
|
|
70 |
|
|
71 |
|
@param |
72 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
73 |
2 |
public void setHtmlExport(boolean htmlExport)... |
74 |
|
{ |
75 |
2 |
setProperty(HTML_EXPORT, htmlExport); |
76 |
|
} |
77 |
|
|
78 |
|
|
79 |
|
@return |
80 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
81 |
2097 |
public boolean isHtmlExport()... |
82 |
|
{ |
83 |
2097 |
return Boolean.TRUE.equals(getContext().getProperty(HTML_EXPORT)); |
84 |
|
} |
85 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
86 |
4273 |
private ExecutionContext getContext()... |
87 |
|
{ |
88 |
4273 |
return execution.getContext(); |
89 |
|
} |
90 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
91 |
7 |
private void setProperty(String propertyName, Object value)... |
92 |
|
{ |
93 |
7 |
Object property = getContext().getProperty(propertyName); |
94 |
7 |
if (property != null) { |
95 |
3 |
getContext().setProperty(propertyName, value); |
96 |
|
} else { |
97 |
4 |
getContext().newProperty(propertyName).inherited().initial(value).declare(); |
98 |
|
} |
99 |
|
} |
100 |
|
} |