Skip to contentPackage: VirtualSiteNode
VirtualSiteNode
Coverage
1: /*
2: * *************************************************************************************************************************************************************
3: *
4: * NorthernWind - lightweight CMS
5: * http://tidalwave.it/projects/northernwind
6: *
7: * Copyright (C) 2011 - 2025 Tidalwave s.a.s. (http://tidalwave.it)
8: *
9: * *************************************************************************************************************************************************************
10: *
11: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
12: * You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
17: * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
18: *
19: * *************************************************************************************************************************************************************
20: *
21: * git clone https://bitbucket.org/tidalwave/northernwind-src
22: * git clone https://github.com/tidalwave-it/northernwind-src
23: *
24: * *************************************************************************************************************************************************************
25: */
26: package it.tidalwave.northernwind.frontend.ui.spi;
27:
28: import javax.annotation.Nonnull;
29: import it.tidalwave.util.As;
30: import it.tidalwave.util.Finder;
31: import it.tidalwave.util.Id;
32: import it.tidalwave.northernwind.core.model.ResourceFile;
33: import it.tidalwave.northernwind.core.model.ResourcePath;
34: import it.tidalwave.northernwind.core.model.ResourceProperties;
35: import it.tidalwave.northernwind.core.model.Site;
36: import it.tidalwave.northernwind.core.model.SiteNode;
37: import it.tidalwave.northernwind.frontend.ui.Layout;
38: import it.tidalwave.northernwind.frontend.ui.ViewController;
39: import lombok.Getter;
40: import lombok.RequiredArgsConstructor;
41: import lombok.experimental.Delegate;
42:
43: /***************************************************************************************************************************************************************
44: *
45: * A convenient implementation of {@link SiteNode} for {@link ViewController#findVirtualSiteNodes()}.
46: *
47: * @see ViewController#findVirtualSiteNodes()
48: *
49: * @author Fabrizio Giudici
50: *
51: **************************************************************************************************************************************************************/
52: @RequiredArgsConstructor
53: public class VirtualSiteNode implements SiteNode
54: {
55: @Nonnull
56: private final SiteNode parentSiteNode;
57:
58: @Getter @Nonnull
59: private final ResourcePath relativeUri;
60:
61: @Getter @Nonnull
62: private final ResourceProperties properties;
63:
64: @Delegate
65: private final As asSupport = As.forObject(this);
66:
67: @Override @Nonnull
68: public Site getSite()
69: {
70: return parentSiteNode.getSite();
71: }
72:
73: // TODO: perhaps the methods below could be implemented by delegating to the first real SiteNode up in the
74: // hierarchy.
75: @Nonnull
76: @Override
77: public Layout getLayout()
78: {
79: throw new UnsupportedOperationException("Not supported.");
80: }
81:
82: @Nonnull
83: @Override
84: public ResourceFile getFile()
85: {
86: throw new UnsupportedOperationException("Not supported.");
87: }
88:
89: @Nonnull
90: @Override
91: public ResourceProperties getPropertyGroup (@Nonnull final Id id)
92: {
93: throw new UnsupportedOperationException("Not supported.");
94: }
95:
96: @Override
97: public boolean isPlaceHolder()
98: {
99: throw new UnsupportedOperationException("Not supported.");
100: }
101:
102: @Override @Nonnull
103: public Finder<SiteNode> findChildren()
104: {
105: throw new UnsupportedOperationException("Not supported.");
106: }
107:
108: @Override @Nonnull
109: public String toString()
110: {
111: return "VirtualSiteNode(" + relativeUri + ')';
112: }
113: }