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.resources; |
35 |
|
|
36 |
|
import java.util.Arrays; |
37 |
|
import java.util.List; |
38 |
|
|
39 |
|
import org.apache.commons.lang3.StringUtils; |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
@deprecated@link |
44 |
|
|
45 |
|
@Deprecated |
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 4 |
Complexity Density: 0.8 |
|
46 |
|
public final class ResourceTypes { |
47 |
|
|
48 |
|
public static final String RESOURCES_PREFIX = "resources:"; |
49 |
|
|
50 |
|
public static final String PROCESSED_PREFIX = "processed"; |
51 |
|
|
52 |
|
|
53 |
|
public static final String CSS_SUFFIX = "css"; |
54 |
|
|
55 |
|
public static final String JS_SUFFIX = "js"; |
56 |
|
|
57 |
|
public static final String HTML_SUFFIX = "html"; |
58 |
|
|
59 |
|
public static final String PROCESSED_JS_SUFFIX = PROCESSED_PREFIX + StringUtils.capitalize(JS_SUFFIX); |
60 |
|
|
61 |
|
public static final String BINARY_SUFFIX = "binary"; |
62 |
|
|
63 |
|
public static final String PROCESSED_CSS_SUFFIX = PROCESSED_PREFIX + StringUtils.capitalize(CSS_SUFFIX); |
64 |
|
|
65 |
|
public static final String PROCESSED_HTML_SUFFIX = PROCESSED_PREFIX + StringUtils.capitalize(HTML_SUFFIX); |
66 |
|
|
67 |
|
|
68 |
|
public static final String CSS = RESOURCES_PREFIX + CSS_SUFFIX; |
69 |
|
|
70 |
|
public static final String JS = RESOURCES_PREFIX + JS_SUFFIX; |
71 |
|
|
72 |
|
public static final String HTML = RESOURCES_PREFIX + HTML_SUFFIX; |
73 |
|
|
74 |
|
public static final String PROCESSED_CSS = RESOURCES_PREFIX + PROCESSED_CSS_SUFFIX; |
75 |
|
|
76 |
|
public static final String PROCESSED_JS = RESOURCES_PREFIX + PROCESSED_JS_SUFFIX; |
77 |
|
|
78 |
|
public static final String PROCESSED_HTML = RESOURCES_PREFIX + PROCESSED_HTML_SUFFIX; |
79 |
|
|
80 |
|
public static final String BINARY = RESOURCES_PREFIX + BINARY_SUFFIX; |
81 |
|
|
82 |
|
|
83 |
|
private static final List<String> nonBinaryResources = Arrays.asList(new String[]{"css", "js", "html"}); |
84 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
85 |
2 |
public static String determineType(String resource) {... |
86 |
2 |
return ResourceTypes.determineType(resource, true); |
87 |
|
} |
88 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
89 |
8 |
public static String determineType(String resource, boolean processed) {... |
90 |
8 |
String extension = StringUtils.substringAfterLast(resource, "."); |
91 |
8 |
if (nonBinaryResources.contains(extension)) { |
92 |
7 |
return processed ? RESOURCES_PREFIX + PROCESSED_PREFIX + StringUtils.capitalize(extension) : RESOURCES_PREFIX + extension; |
93 |
|
} else { |
94 |
1 |
return BINARY; |
95 |
|
} |
96 |
|
} |
97 |
|
|
98 |
|
} |