Skip to content

Package: GalleryAdapterSupport

GalleryAdapterSupport

nameinstructionbranchcomplexitylinemethod
GalleryAdapterSupport(SiteNode, GalleryView, ModelFactory)
M: 24 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getExtraViewProperties(Id)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getInlinedScript()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
loadTemplate(Key, String)
M: 18 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * #%L
3: * *********************************************************************************************************************
4: *
5: * NorthernWind - lightweight CMS
6: * http://northernwind.tidalwave.it - git clone https://bitbucket.org/tidalwave/northernwind-src.git
7: * %%
8: * Copyright (C) 2011 - 2023 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.frontend.ui.component.gallery.spi;
28:
29: import javax.annotation.Nonnull;
30: import it.tidalwave.util.Id;
31: import it.tidalwave.util.Key;
32: import it.tidalwave.northernwind.core.model.ModelFactory;
33: import it.tidalwave.northernwind.core.model.ResourcePath;
34: import it.tidalwave.northernwind.core.model.ResourceProperties;
35: import it.tidalwave.northernwind.core.model.SiteNode;
36: import it.tidalwave.northernwind.core.model.Template;
37: import it.tidalwave.northernwind.frontend.ui.component.gallery.GalleryView;
38: import lombok.RequiredArgsConstructor;
39:
40: /***********************************************************************************************************************
41: *
42: * @author Fabrizio Giudici
43: *
44: **********************************************************************************************************************/
45: @RequiredArgsConstructor
46: public abstract class GalleryAdapterSupport implements GalleryAdapter
47: {
48: @Nonnull
49: protected final SiteNode siteNode;
50:
51: @Nonnull
52: protected final GalleryView view;
53:
54: @Nonnull
55: protected final ModelFactory modelFactory;
56:
57: /*******************************************************************************************************************
58: *
59: * {@inheritDoc}
60: *
61: ******************************************************************************************************************/
62: @Override @Nonnull
63: public ResourceProperties getExtraViewProperties (@Nonnull final Id viewId)
64: {
65: return modelFactory.createProperties().withId(viewId).build();
66: }
67:
68: /*******************************************************************************************************************
69: *
70: * {@inheritDoc}
71: *
72: ******************************************************************************************************************/
73: @Override @Nonnull
74: public String getInlinedScript()
75: {
76: return "";
77: }
78:
79: /*******************************************************************************************************************
80: *
81: * {@inheritDoc}
82: *
83: ******************************************************************************************************************/
84: @Nonnull
85: protected final Template loadTemplate (@Nonnull final Key<? extends ResourcePath> templateName,
86: @Nonnull final String fallbackTemplate)
87: {
88: final var viewProperties = siteNode.getPropertyGroup(view.getId());
89: return siteNode.getSite().getTemplate(getClass(), viewProperties.getProperty(templateName), fallbackTemplate);
90: }
91: }