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.blossom.template; |
35 |
|
|
36 |
|
import info.magnolia.config.registry.DefinitionMetadata; |
37 |
|
import info.magnolia.config.registry.DefinitionMetadataBuilder; |
38 |
|
import info.magnolia.config.registry.DefinitionProvider; |
39 |
|
import info.magnolia.config.registry.DefinitionRawView; |
40 |
|
import info.magnolia.config.registry.Registry; |
41 |
|
import info.magnolia.module.blossom.support.ExplicitIdDefinitionMetadataBuilder; |
42 |
|
import info.magnolia.rendering.DefinitionTypes; |
43 |
|
import info.magnolia.rendering.template.TemplateDefinition; |
44 |
|
|
45 |
|
import java.util.Collections; |
46 |
|
import java.util.List; |
47 |
|
|
48 |
|
|
49 |
|
@link |
50 |
|
|
51 |
|
@since |
52 |
|
|
|
|
| 90.9% |
Uncovered Elements: 1 (11) |
Complexity: 4 |
Complexity Density: 0.67 |
|
53 |
|
public class BlossomTemplateDefinitionProvider implements DefinitionProvider<TemplateDefinition> { |
54 |
|
|
55 |
|
private BlossomTemplateDefinition definition; |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
11 |
public BlossomTemplateDefinitionProvider(BlossomTemplateDefinition definition) {... |
58 |
11 |
this.definition = definition; |
59 |
|
} |
60 |
|
|
|
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
61 |
28 |
@Override... |
62 |
|
public DefinitionMetadata getMetadata() { |
63 |
28 |
DefinitionMetadataBuilder builder = new ExplicitIdDefinitionMetadataBuilder(definition.getId()) |
64 |
|
.type(DefinitionTypes.TEMPLATE) |
65 |
|
.name(definition.getName()); |
66 |
28 |
if (definition.getHandler() != null) { |
67 |
28 |
builder.location(definition.getHandler().getClass().getName()); |
68 |
|
} |
69 |
28 |
return builder.build(); |
70 |
|
} |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
72 |
9 |
@Override... |
73 |
|
public TemplateDefinition get() throws Registry.InvalidDefinitionException { |
74 |
9 |
return definition; |
75 |
|
} |
76 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
77 |
|
@Override... |
78 |
|
public DefinitionRawView getRaw() { |
79 |
|
return DefinitionRawView.EMPTY; |
80 |
|
} |
81 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
82 |
|
@Override... |
83 |
|
public boolean isValid() { |
84 |
|
return true; |
85 |
|
} |
86 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
87 |
|
@Override... |
88 |
|
public List<String> getErrorMessages() { |
89 |
|
return Collections.emptyList(); |
90 |
|
} |
91 |
|
} |