View Javadoc
1   /**
2    * This file Copyright (c) 2011-2015 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.rendering.template.configured;
35  
36  import info.magnolia.rendering.template.AreaDefinition;
37  import info.magnolia.rendering.template.TemplateAvailability;
38  import info.magnolia.rendering.template.TemplateDefinition;
39  import info.magnolia.rendering.template.type.DefaultTemplateTypes;
40  
41  import java.util.HashMap;
42  import java.util.Map;
43  
44  import javax.inject.Inject;
45  
46  /**
47   * A {@link TemplateDefinition} configured in the configuration workspace.
48   */
49  public class ConfiguredTemplateDefinition extends ConfiguredRenderableDefinition implements TemplateDefinition {
50  
51      private Boolean visible;
52      private String dialog;
53      private Map<String, AreaDefinition> areaDefinitions = new HashMap<String, AreaDefinition>();
54      private TemplateAvailability templateAvailability;
55      private String type = DefaultTemplateTypes.CONTENT;
56      private String subtype;
57      private Boolean editable;
58      private Boolean moveable;
59      private Boolean deletable;
60      private Boolean writable;
61  
62      /**
63       * @deprecated since 5.3.3 use {@link #ConfiguredTemplateDefinition(TemplateAvailability templateAvailability)}
64       */
65      public ConfiguredTemplateDefinition() {
66          this.templateAvailability = new ConfiguredTemplateAvailability();
67      }
68  
69      @Inject
70      public ConfiguredTemplateDefinition(TemplateAvailability templateAvailability) {
71          this.templateAvailability = templateAvailability;
72      }
73  
74      @Override
75      public Boolean getVisible() {
76          return visible;
77      }
78  
79      public void setVisible(Boolean visible) {
80          this.visible = visible;
81      }
82  
83      @Override
84      public Boolean getEditable() {
85          return editable;
86      }
87  
88      public void setEditable(Boolean editable) {
89          this.editable = editable;
90      }
91  
92      @Override
93      public Boolean getMoveable() {
94          return moveable;
95      }
96  
97      public void setMoveable(Boolean moveable) {
98          this.moveable = moveable;
99      }
100 
101     @Override
102     public Boolean getDeletable() {
103         return deletable;
104     }
105 
106     public void setDeletable(Boolean deletable) {
107         this.deletable = deletable;
108     }
109 
110     @Override
111     public Boolean getWritable() {
112         return writable;
113     }
114 
115     public void setWritable(Boolean writable) {
116         this.writable = writable;
117     }
118 
119     @Override
120     public String getDialog() {
121         return this.dialog;
122     }
123 
124     public void setDialog(String dialog) {
125         this.dialog = dialog;
126     }
127 
128     @Override
129     public Map<String, AreaDefinition> getAreas() {
130         return this.areaDefinitions;
131     }
132 
133     public void setAreas(Map<String, AreaDefinition> areaDefinitions) {
134         this.areaDefinitions = areaDefinitions;
135     }
136 
137     public void addArea(String name, AreaDefinition areaDefinition) {
138         this.areaDefinitions.put(name, areaDefinition);
139     }
140 
141     @Override
142     public TemplateAvailability getTemplateAvailability() {
143         return templateAvailability;
144     }
145 
146     public void setTemplateAvailability(TemplateAvailability templateAvailability) {
147         this.templateAvailability = templateAvailability;
148     }
149 
150     @Override
151     public String getType() {
152         return type;
153     }
154 
155     public void setType(String type) {
156         this.type = type;
157     }
158 
159     @Override
160     public String getSubtype() {
161         return subtype;
162     }
163 
164     public void setSubtype(String subtype) {
165         this.subtype = subtype;
166     }
167 
168 }