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.commands.CommandsManager; |
37 |
|
import info.magnolia.context.Context; |
38 |
|
import info.magnolia.event.EventBus; |
39 |
|
import info.magnolia.i18nsystem.SimpleTranslator; |
40 |
|
import info.magnolia.resources.app.utils.ResourceUtils; |
41 |
|
import info.magnolia.ui.api.context.UiContext; |
42 |
|
import info.magnolia.ui.api.event.AdmincentralEventBus; |
43 |
|
import info.magnolia.ui.api.event.ContentChangedEvent; |
44 |
|
import info.magnolia.ui.contentapp.browser.action.RestoreItemPreviousVersionAction; |
45 |
|
import info.magnolia.ui.vaadin.integration.jcr.JcrNodeAdapter; |
46 |
|
|
47 |
|
import javax.inject.Inject; |
48 |
|
import javax.inject.Named; |
49 |
|
import javax.jcr.Node; |
50 |
|
|
51 |
|
import com.vaadin.data.Item; |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
@see |
57 |
|
|
|
|
| 68.8% |
Uncovered Elements: 5 (16) |
Complexity: 5 |
Complexity Density: 0.56 |
|
58 |
|
public class RestoreResourcePreviousVersionAction extends RestoreItemPreviousVersionAction<RestoreResourcePreviousVersionActionDefinition> { |
59 |
|
|
60 |
|
private final EventBus eventBus; |
61 |
|
private final Node parentNode; |
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
63 |
4 |
@Inject... |
64 |
|
public RestoreResourcePreviousVersionAction(RestoreResourcePreviousVersionActionDefinition definition, Item item, CommandsManager commandsManager, @Named(AdmincentralEventBus.NAME) EventBus eventBus, UiContext uiContext, SimpleTranslator i18n, Context context) { |
65 |
4 |
this(definition, ResourceUtils.getJcrNodeAdapterFor(context, item), commandsManager, eventBus, uiContext, i18n); |
66 |
|
} |
67 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
68 |
4 |
private RestoreResourcePreviousVersionAction(RestoreResourcePreviousVersionActionDefinition definition, JcrNodeAdapter jcrNodeAdapter, CommandsManager commandsManager, EventBus eventBus, UiContext uiContext, SimpleTranslator i18n) {... |
69 |
4 |
super(definition, jcrNodeAdapter, commandsManager, eventBus, uiContext, i18n); |
70 |
4 |
this.eventBus = eventBus; |
71 |
4 |
this.parentNode = ResourceUtils.extractParentItem(jcrNodeAdapter); |
72 |
|
} |
73 |
|
|
|
|
| 44.4% |
Uncovered Elements: 5 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
74 |
4 |
@Override... |
75 |
|
protected void onPostExecute() throws Exception { |
76 |
4 |
super.onPostExecute(); |
77 |
4 |
if (getCurrentItem().getJcrItem() != null) { |
78 |
4 |
eventBus.fireEvent(new ContentChangedEvent(getCurrentItem().getJcrItem().getPath())); |
79 |
0 |
} else if (parentNode != null) { |
80 |
0 |
eventBus.fireEvent(new ContentChangedEvent(parentNode.getPath())); |
81 |
|
} |
82 |
|
} |
83 |
|
} |