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.resources.app.action; |
35 |
|
|
36 |
|
import info.magnolia.i18nsystem.SimpleTranslator; |
37 |
|
import info.magnolia.jcr.util.NodeTypes.Renderable; |
38 |
|
import info.magnolia.ui.api.action.ActionExecutionException; |
39 |
|
import info.magnolia.ui.api.app.AppContext; |
40 |
|
import info.magnolia.ui.api.context.UiContext; |
41 |
|
import info.magnolia.ui.api.location.Location; |
42 |
|
import info.magnolia.ui.api.location.LocationController; |
43 |
|
import info.magnolia.ui.contentapp.browser.action.ShowVersionsAction; |
44 |
|
import info.magnolia.ui.contentapp.detail.DetailLocation; |
45 |
|
import info.magnolia.ui.contentapp.detail.DetailView; |
46 |
|
import info.magnolia.ui.dialog.formdialog.FormDialogPresenter; |
47 |
|
import info.magnolia.ui.vaadin.integration.jcr.AbstractJcrNodeAdapter; |
48 |
|
|
49 |
|
import javax.inject.Inject; |
50 |
|
import javax.jcr.Node; |
51 |
|
import javax.jcr.RepositoryException; |
52 |
|
|
53 |
|
import org.apache.commons.lang3.StringUtils; |
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
@see |
59 |
|
@deprecated |
60 |
|
|
61 |
|
|
62 |
|
@Deprecated |
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.3 |
|
63 |
|
public class ShowResourceVersionsAction extends ShowVersionsAction<ShowResourceVersionsActionDefinition> { |
64 |
|
|
65 |
|
private final AppContext appContext; |
66 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
67 |
0 |
@Inject... |
68 |
|
public ShowResourceVersionsAction(ShowResourceVersionsActionDefinition definition, AppContext appContext, LocationController locationController, UiContext uiContext, |
69 |
|
FormDialogPresenter formDialogPresenter, AbstractJcrNodeAdapter nodeAdapter, SimpleTranslator i18n) { |
70 |
0 |
super(definition, appContext, locationController, uiContext, formDialogPresenter, nodeAdapter, i18n); |
71 |
0 |
this.appContext = appContext; |
72 |
|
} |
73 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.25 |
|
74 |
0 |
@Override... |
75 |
|
protected Location getLocation() throws ActionExecutionException { |
76 |
0 |
try { |
77 |
0 |
final Node node = getNode(); |
78 |
0 |
final String path = node.getPath(); |
79 |
0 |
final String appName = appContext.getName(); |
80 |
0 |
final String template = StringUtils.split(Renderable.getTemplate(nodeAdapter.getJcrItem()), ":")[1]; |
81 |
0 |
final String subAppId = getDefinition().getSubAppMapping().get(template); |
82 |
|
|
83 |
0 |
return new DetailLocation(appName, subAppId, DetailView.ViewType.VIEW, path, (String) getItem().getItemProperty("versionName").getValue()); |
84 |
|
} catch (RepositoryException e) { |
85 |
0 |
throw new ActionExecutionException("Could not get target location for '{}'" + nodeAdapter.getItemId()); |
86 |
|
} |
87 |
|
} |
88 |
|
|
89 |
|
} |