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.googlesitemap.app.subapp.sitemapdetail; |
35 |
|
|
36 |
|
import info.magnolia.context.MgnlContext; |
37 |
|
import info.magnolia.event.EventBus; |
38 |
|
import info.magnolia.module.googlesitemap.GoogleSiteMapConfiguration; |
39 |
|
import info.magnolia.module.googlesitemap.app.subapp.sitemapdetail.contentconnector.SitemapContentConnector; |
40 |
|
import info.magnolia.ui.api.action.ActionExecutor; |
41 |
|
import info.magnolia.ui.api.app.SubAppContext; |
42 |
|
import info.magnolia.ui.api.app.SubAppEventBus; |
43 |
|
import info.magnolia.ui.api.availability.AvailabilityChecker; |
44 |
|
import info.magnolia.ui.api.event.AdmincentralEventBus; |
45 |
|
import info.magnolia.ui.api.location.Location; |
46 |
|
import info.magnolia.ui.contentapp.ContentSubAppView; |
47 |
|
import info.magnolia.ui.contentapp.browser.BrowserPresenter; |
48 |
|
import info.magnolia.ui.contentapp.browser.BrowserSubApp; |
49 |
|
import info.magnolia.ui.vaadin.integration.contentconnector.ContentConnector; |
50 |
|
|
51 |
|
import javax.inject.Inject; |
52 |
|
import javax.inject.Named; |
53 |
|
import javax.jcr.Node; |
54 |
|
import javax.jcr.RepositoryException; |
55 |
|
|
56 |
|
import org.apache.jackrabbit.commons.JcrUtils; |
57 |
|
import org.slf4j.Logger; |
58 |
|
import org.slf4j.LoggerFactory; |
59 |
|
|
60 |
|
|
61 |
|
@link |
62 |
|
|
63 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.44 |
|
64 |
|
public class SitemapEntryBrowserSubApp extends BrowserSubApp { |
65 |
|
|
66 |
|
private static Logger log = LoggerFactory.getLogger(SitemapEntryBrowserSubApp.class); |
67 |
|
|
68 |
|
private SitemapContentConnector contentConnector; |
69 |
|
|
70 |
|
private String sitemapName; |
71 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
72 |
0 |
@Inject... |
73 |
|
public SitemapEntryBrowserSubApp(ActionExecutor actionExecutor, SubAppContext subAppContext, ContentSubAppView view, BrowserPresenter browser, @Named(SubAppEventBus.NAME) EventBus subAppEventBus, @Named(AdmincentralEventBus.NAME) EventBus adminCentralEventBus, ContentConnector contentConnector, AvailabilityChecker checker) { |
74 |
0 |
super(actionExecutor, subAppContext, view, browser, subAppEventBus, adminCentralEventBus, contentConnector, checker); |
75 |
0 |
this.contentConnector = (SitemapContentConnector) contentConnector; |
76 |
|
} |
77 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
78 |
0 |
@Override... |
79 |
|
public ContentSubAppView start(Location location) { |
80 |
0 |
ContentSubAppView view = super.start(location); |
81 |
0 |
try { |
82 |
0 |
final Node sitemapNode = JcrUtils.getNodeIfExists(contentConnector.getSitemapPath(), MgnlContext.getJCRSession(GoogleSiteMapConfiguration.WORKSPACE)); |
83 |
0 |
if (sitemapNode != null) { |
84 |
0 |
sitemapName = sitemapNode.getName(); |
85 |
|
} |
86 |
|
} catch (RepositoryException e) { |
87 |
0 |
log.error("Failed to obtain Google Sitemap workspace: [{}]", e.getMessage(), e); |
88 |
|
} |
89 |
0 |
return view; |
90 |
|
} |
91 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
92 |
|
@Override... |
93 |
|
public String getCaption() { |
94 |
|
SitemapEntryBrowserSubAppDescriptor descriptor = (SitemapEntryBrowserSubAppDescriptor) getSubAppContext().getSubAppDescriptor(); |
95 |
|
return String.format("%s: %s", descriptor.getCaptionPrefix().toUpperCase(), sitemapName); |
96 |
|
} |
97 |
|
} |