Skip to content

Package: ModelFactory

ModelFactory

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.core.model;
28:
29: import javax.annotation.Nonnull;
30: import javax.servlet.http.HttpServletRequest;
31: import it.tidalwave.northernwind.frontend.ui.Layout;
32:
33: /***********************************************************************************************************************
34: *
35: * A factory for creating domain objects.
36: *
37: * TODO: use a builder for all products
38: *
39: * @author Fabrizio Giudici
40: *
41: **********************************************************************************************************************/
42: public interface ModelFactory
43: {
44: /*******************************************************************************************************************
45: *
46: * Creates a new {@link Resource}.
47: *
48: * @return a builder for the {@code Resource}
49: *
50: ******************************************************************************************************************/
51: @Nonnull
52: public Resource.Builder createResource();
53:
54: /*******************************************************************************************************************
55: *
56: * Creates a new {@link Content}.
57: *
58: * @return a builder for the {@code Content}
59: *
60: ******************************************************************************************************************/
61: @Nonnull
62: public Content.Builder createContent();
63:
64: /*******************************************************************************************************************
65: *
66: * Creates a new {@link Media}.
67: *
68: * @return a builder for the {@code Media}
69: *
70: ******************************************************************************************************************/
71: @Nonnull
72: public Media.Builder createMedia();
73:
74: /*******************************************************************************************************************
75: *
76: * Creates a new {@link SiteNode}.
77: *
78: * @param site the {@code Site} that the {@code SiteNode} belongs to
79: * @param folder the folder representing the {@code SiteNode}
80: * @return the {@code SiteNode}
81: *
82: ******************************************************************************************************************/
83: @Nonnull
84: public SiteNode createSiteNode (@Nonnull Site site, @Nonnull ResourceFile folder);
85:
86: /*******************************************************************************************************************
87: *
88: * Creates a new {@link Layout}.
89: *
90: * @param id the id
91: * @param type the type
92: * @return the {@code Layout}
93: *
94: ******************************************************************************************************************/
95: @Nonnull
96: public Layout.Builder createLayout();
97:
98: /*******************************************************************************************************************
99: *
100: * Creates a new {@link Request}.
101: *
102: * @return the {@code Request}
103: *
104: ******************************************************************************************************************/
105: @Nonnull
106: public Request createRequest();
107:
108: /*******************************************************************************************************************
109: *
110: * Creates a new {@link Request} from a given {@link HttpServletRequest}.
111: *
112: * @param httpServletRequest the {@code HttpServletRequest}
113: * @return the {@code Request}
114: *
115: ******************************************************************************************************************/
116: @Nonnull
117: public Request createRequestFrom (@Nonnull HttpServletRequest httpServletRequest);
118:
119: /*******************************************************************************************************************
120: *
121: *
122: ******************************************************************************************************************/
123: @Nonnull
124: public ResourceProperties.Builder createProperties();
125:
126: /*******************************************************************************************************************
127: *
128: * Creates a new {@link Site}.
129: *
130: * @return a builder for the new {@code Site}
131: *
132: ******************************************************************************************************************/
133: @Nonnull
134: public Site.Builder createSite();
135: }