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.resources.app.action; |
35 |
|
|
36 |
|
import info.magnolia.resourceloader.Resource; |
37 |
|
import info.magnolia.resourceloader.ResourceOrigin; |
38 |
|
import info.magnolia.resources.app.workbench.ResourcesContainer; |
39 |
|
import info.magnolia.ui.api.action.AbstractAction; |
40 |
|
import info.magnolia.ui.api.action.ActionDefinition; |
41 |
|
|
42 |
|
import com.google.common.base.Joiner; |
43 |
|
import com.vaadin.data.Item; |
44 |
|
import com.vaadin.data.Property; |
45 |
|
|
46 |
|
|
47 |
|
@link |
48 |
|
@param@link |
49 |
|
|
|
|
| 80% |
Uncovered Elements: 2 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
50 |
|
public abstract class AbstractResourceAction<D extends ActionDefinition> extends AbstractAction<D> { |
51 |
|
|
52 |
|
private ResourceOrigin<?> origin; |
53 |
|
|
54 |
|
protected static final String HOTFIX_SUBAPP_NAME = "hotfix"; |
55 |
|
protected static final String DETAIL_SUBAPP_NAME = "detail"; |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
57 |
13 |
protected AbstractResourceAction(D definition, ResourceOrigin<?> origin) {... |
58 |
13 |
super(definition); |
59 |
13 |
this.origin = origin; |
60 |
|
} |
61 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
62 |
10 |
protected Resource unwrapResource(Item resourceItem) throws IllegalStateException {... |
63 |
10 |
final Property<String> pathProperty = resourceItem.getItemProperty(ResourcesContainer.RESOURCE_PATH); |
64 |
10 |
if (pathProperty == null) { |
65 |
0 |
throw new IllegalStateException(String.format("Required [%s] property is missing, available properties are: [%s]", ResourcesContainer.RESOURCE_PATH, Joiner.on(',').join(resourceItem.getItemPropertyIds()))); |
66 |
|
} |
67 |
|
|
68 |
10 |
return origin.getByPath(pathProperty.getValue()); |
69 |
|
} |
70 |
|
} |