Skip to content

Package: DefaultContentExplorerPresentationControl

DefaultContentExplorerPresentationControl

nameinstructionbranchcomplexitylinemethod
DefaultContentExplorerPresentationControl(MessageBus, ModelFactory, ContentExplorerPresentation)
M: 15 C: 21
58%
M: 3 C: 3
50%
M: 3 C: 1
25%
M: 0 C: 1
100%
M: 0 C: 1
100%
afterPropertiesSet()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
destroy()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
onOpenSite(OpenSiteEvent)
M: 0 C: 35
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
static {...}
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*
2: * #%L
3: * *********************************************************************************************************************
4: *
5: * NorthernWind - lightweight CMS
6: * http://northernwind.tidalwave.it - git clone git@bitbucket.org:tidalwave/northernwind-rca-src.git
7: * %%
8: * Copyright (C) 2013 - 2021 Tidalwave s.a.s. (http://tidalwave.it)
9: * %%
10: * *********************************************************************************************************************
11: *
12: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
13: * the License. You may obtain a copy of the License at
14: *
15: * http://www.apache.org/licenses/LICENSE-2.0
16: *
17: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
18: * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
19: * specific language governing permissions and limitations under the License.
20: *
21: * *********************************************************************************************************************
22: *
23: *
24: * *********************************************************************************************************************
25: * #L%
26: */
27: package it.tidalwave.northernwind.rca.ui.contentexplorer.impl;
28:
29: import javax.annotation.Nonnull;
30: import it.tidalwave.util.annotation.VisibleForTesting;
31: import it.tidalwave.dci.annotation.DciContext;
32: import it.tidalwave.messagebus.MessageBus;
33: import it.tidalwave.messagebus.annotation.ListensTo;
34: import it.tidalwave.messagebus.annotation.SimpleMessageSubscriber;
35: import it.tidalwave.northernwind.core.model.Content;
36: import it.tidalwave.northernwind.core.model.ModelFactory;
37: import it.tidalwave.northernwind.core.model.ResourceFile;
38: import it.tidalwave.northernwind.rca.ui.contentexplorer.ContentExplorerPresentation;
39: import it.tidalwave.northernwind.rca.ui.contentexplorer.ContentExplorerPresentationControl;
40: import it.tidalwave.northernwind.rca.ui.event.OpenSiteEvent;
41: import it.tidalwave.role.ui.PresentationModel;
42: import lombok.RequiredArgsConstructor;
43: import lombok.extern.slf4j.Slf4j;
44: import static it.tidalwave.northernwind.rca.ui.event.ContentSelectedEvent.emptySelectionEvent;
45:
46: /***********************************************************************************************************************
47: *
48: * The default implementation for {@link ContentExplorerPresentationControl}.
49: *
50: * @stereotype Control
51: *
52: * @author Fabrizio Giudici
53: *
54: **********************************************************************************************************************/
55:•@DciContext(autoThreadBinding = true) @RequiredArgsConstructor @SimpleMessageSubscriber @Slf4j
56: public class DefaultContentExplorerPresentationControl implements ContentExplorerPresentationControl
57: {
58: /* package */ static final String ROOT_DOCUMENT_PATH = "/content/document";
59:
60: @Nonnull
61: protected final MessageBus messageBus;
62:
63: @Nonnull
64: private final ModelFactory modelFactory;
65:
66: @Nonnull
67: private final ContentExplorerPresentation presentation;
68:
69: @VisibleForTesting void onOpenSite (@ListensTo @Nonnull final OpenSiteEvent event)
70: {
71: log.debug("onOpenSite({})", event);
72: final ResourceFile root = event.getFileSystem().findFileByPath(ROOT_DOCUMENT_PATH);
73: final Content rootContent = modelFactory.createContent().withFolder(root).build();
74: presentation.populate(PresentationModel.ofMaybePresentable(rootContent));
75: presentation.expandFirstLevel();
76: messageBus.publish(emptySelectionEvent());
77: }
78: }