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.detail; |
35 |
|
|
36 |
|
import info.magnolia.event.EventBus; |
37 |
|
import info.magnolia.i18nsystem.I18nizer; |
38 |
|
import info.magnolia.i18nsystem.SimpleTranslator; |
39 |
|
import info.magnolia.objectfactory.ComponentProvider; |
40 |
|
import info.magnolia.ui.api.app.SubAppContext; |
41 |
|
import info.magnolia.ui.api.availability.AvailabilityChecker; |
42 |
|
import info.magnolia.ui.api.event.AdmincentralEventBus; |
43 |
|
import info.magnolia.ui.api.event.ContentChangedEvent; |
44 |
|
import info.magnolia.ui.contentapp.detail.DetailPresenter; |
45 |
|
import info.magnolia.ui.contentapp.detail.DetailView; |
46 |
|
import info.magnolia.ui.form.FormPresenter; |
47 |
|
import info.magnolia.ui.framework.app.SubAppActionExecutor; |
48 |
|
import info.magnolia.ui.vaadin.integration.contentconnector.ContentConnector; |
49 |
|
import info.magnolia.ui.vaadin.integration.jcr.JcrNodeAdapter; |
50 |
|
|
51 |
|
import javax.inject.Inject; |
52 |
|
import javax.inject.Named; |
53 |
|
import javax.jcr.RepositoryException; |
54 |
|
|
55 |
|
import org.apache.commons.lang3.StringUtils; |
56 |
|
import org.slf4j.Logger; |
57 |
|
import org.slf4j.LoggerFactory; |
58 |
|
|
59 |
|
|
60 |
|
@link |
61 |
|
|
|
|
| 83.3% |
Uncovered Elements: 3 (18) |
Complexity: 5 |
Complexity Density: 0.42 |
|
62 |
|
public class ResourcesDetailPresenter extends DetailPresenter { |
63 |
|
|
64 |
|
private static final Logger log = LoggerFactory.getLogger(ResourcesDetailPresenter.class); |
65 |
|
|
66 |
|
private final SubAppContext subAppContext; |
67 |
|
|
68 |
|
private final EventBus eventBus; |
69 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
70 |
1 |
@Inject... |
71 |
|
public ResourcesDetailPresenter(final SubAppContext subAppContext, final @Named(AdmincentralEventBus.NAME) EventBus eventBus, final DetailView view, final ComponentProvider componentProvider, final SubAppActionExecutor executor, final I18nizer i18nizer, final SimpleTranslator i18n, final AvailabilityChecker checker, final ContentConnector contentConnector, final FormPresenter formPresenter) { |
72 |
1 |
super(subAppContext, eventBus, view, componentProvider, executor, i18nizer, i18n, checker, contentConnector, formPresenter); |
73 |
1 |
this.subAppContext = subAppContext; |
74 |
1 |
this.eventBus = eventBus; |
75 |
|
} |
76 |
|
|
77 |
|
|
78 |
|
@link |
79 |
|
@link |
80 |
|
|
|
|
| 76.9% |
Uncovered Elements: 3 (13) |
Complexity: 4 |
Complexity Density: 0.44 |
|
81 |
1 |
@Override... |
82 |
|
public void onSuccess(final String actionName) { |
83 |
1 |
String path = null; |
84 |
1 |
if (getItem() instanceof JcrNodeAdapter) { |
85 |
1 |
JcrNodeAdapter adapter = (JcrNodeAdapter) getItem(); |
86 |
1 |
try { |
87 |
1 |
path = adapter.getJcrItem().getPath(); |
88 |
|
} catch (RepositoryException e) { |
89 |
0 |
log.warn("Unable to obtain path for item {}", adapter.getItemId()); |
90 |
|
} |
91 |
|
} |
92 |
1 |
if (StringUtils.isNotBlank(path)) { |
93 |
1 |
eventBus.fireEvent(new ContentChangedEvent(path)); |
94 |
|
} |
95 |
1 |
subAppContext.close(); |
96 |
|
} |
97 |
|
} |