View Javadoc
1   /**
2    * This file Copyright (c) 2008-2017 Magnolia International
3    * Ltd.  (http://www.magnolia-cms.com). All rights reserved.
4    *
5    *
6    * This file is dual-licensed under both the Magnolia
7    * Network Agreement and the GNU General Public License.
8    * You may elect to use one or the other of these licenses.
9    *
10   * This file is distributed in the hope that it will be
11   * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
12   * implied warranty of MERCHANTABILITY or FITNESS FOR A
13   * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
14   * Redistribution, except as permitted by whichever of the GPL
15   * or MNA you select, is prohibited.
16   *
17   * 1. For the GPL license (GPL), you can redistribute and/or
18   * modify this file under the terms of the GNU General
19   * Public License, Version 3, as published by the Free Software
20   * Foundation.  You should have received a copy of the GNU
21   * General Public License, Version 3 along with this program;
22   * if not, write to the Free Software Foundation, Inc., 51
23   * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24   *
25   * 2. For the Magnolia Network Agreement (MNA), this file
26   * and the accompanying materials are made available under the
27   * terms of the MNA which accompanies this distribution, and
28   * is available at http://www.magnolia-cms.com/mna.html
29   *
30   * Any modifications to this file must keep this entire header
31   * intact.
32   *
33   */
34  package info.magnolia.module.site;
35  
36  import info.magnolia.cms.beans.config.URI2RepositoryMapping;
37  import info.magnolia.cms.i18n.I18nContentSupport;
38  import info.magnolia.module.site.templates.ConfiguredTemplateSettings;
39  import info.magnolia.module.site.templates.TemplateSettings;
40  import info.magnolia.module.site.theme.ThemeReference;
41  
42  import java.util.ArrayList;
43  import java.util.HashMap;
44  import java.util.List;
45  import java.util.Map;
46  
47  
48  /**
49   * Configured {@link info.magnolia.module.site.Site}.
50   */
51  public class ConfiguredSite implements Site {
52  
53      private String name;
54  
55      private Boolean enabled = Boolean.TRUE;
56  
57      private Map<String, Object> parameters = new HashMap<String, Object>();
58  
59      private TemplateSettings templates = new ConfiguredTemplateSettings();
60  
61      private ThemeReference theme = new ThemeReference();
62  
63      private I18nContentSupport i18n;
64  
65      private List<Domain> domains = new ArrayList<Domain>();
66  
67      private Map<String, URI2RepositoryMapping> mappings = new HashMap<String, URI2RepositoryMapping>();
68  
69      private Map<String, Site> variations = new HashMap<String, Site>();
70  
71      @Override
72      public ThemeReference getTheme() {
73          return theme;
74      }
75  
76      public void setTheme(ThemeReference ref) {
77          this.theme = ref;
78      }
79  
80      @Override
81      public TemplateSettings getTemplates() {
82          return this.templates;
83      }
84  
85      public void setTemplates(TemplateSettings templates) {
86          this.templates = templates;
87      }
88  
89      @Override
90      public I18nContentSupport getI18n() {
91          return this.i18n;
92      }
93  
94      public void setI18n(I18nContentSupport i18n) {
95          this.i18n = i18n;
96      }
97  
98      @Override
99      public String getName() {
100         return this.name;
101     }
102 
103     public void setName(String name) {
104         this.name = name;
105     }
106 
107     @Override
108     public Boolean isEnabled() {
109         return this.enabled;
110     }
111 
112     public void setEnabled(Boolean enabled) {
113         this.enabled = enabled;
114     }
115 
116     @Override
117     public Map<String, Object> getParameters() {
118         return this.parameters;
119     }
120 
121     public void setParameters(Map<String, Object> parameters) {
122         this.parameters = parameters;
123     }
124 
125     @Override
126     public List<Domain> getDomains() {
127         return domains;
128     }
129 
130     public void setDomains(List<Domain> domains) {
131         this.domains = domains;
132     }
133 
134     @Override
135     public Map<String, URI2RepositoryMapping> getMappings() {
136         return this.mappings;
137     }
138 
139     public void setMappings(Map<String, URI2RepositoryMapping> mappings) {
140         this.mappings = mappings;
141     }
142 
143     @Override
144     public Map<String, Site> getVariations() {
145         return variations;
146     }
147 
148     public void setVariations(Map<String, Site> variations) {
149         this.variations = variations;
150     }
151 
152     @Override
153     public String toString() {
154         return this.name
155                 + (this.domains == null ? "" : (", Domains:" + this.domains))
156                 + (this.mappings == null ? "" : (", Mappings:" + this.mappings))
157                 + (this.i18n == null ? "" : (" I18n:" + this.i18n));
158     }
159 
160 }