View Javadoc
1   /**
2    * This file Copyright (c) 2012-2018 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.ui.api.app.registry;
35  
36  import info.magnolia.cms.security.operations.AccessDefinition;
37  import info.magnolia.ui.api.app.App;
38  import info.magnolia.ui.api.app.AppDescriptor;
39  import info.magnolia.ui.api.app.SubAppDescriptor;
40  
41  import java.util.LinkedHashMap;
42  import java.util.Map;
43  
44  /**
45   * Simple implementation of {@link AppDescriptor}.
46   */
47  public class ConfiguredAppDescriptor implements AppDescriptor {
48  
49      private String name;
50  
51      private String label;
52  
53      private boolean enabled = true;
54  
55      private String icon;
56  
57      private String theme;
58  
59      private Class<? extends App> appClass;
60  
61      private Map<String, SubAppDescriptor> subApps = new LinkedHashMap<>();
62  
63      private AccessDefinition permissions;
64  
65      private String i18nBasename;
66  
67      private boolean htmlCaption;
68  
69      @Override
70      public String getName() {
71          return name;
72      }
73  
74      public void setName(String name) {
75          this.name = name;
76      }
77  
78      @Override
79      public String getLabel() {
80          return this.label;
81      }
82  
83      public void setLabel(String label) {
84          this.label = label;
85      }
86  
87      @Override
88      public boolean isEnabled() {
89          return enabled;
90      }
91  
92      public void setEnabled(boolean enabled) {
93          this.enabled = enabled;
94      }
95  
96      @Override
97      public String getIcon() {
98          return icon;
99      }
100 
101     public void setIcon(String icon) {
102         this.icon = icon;
103     }
104 
105     @Override
106     public String getTheme() {
107         return theme;
108     }
109 
110     public void setTheme(String theme) {
111         this.theme = theme;
112     }
113 
114     @Override
115     public Class<? extends App> getAppClass() {
116         return appClass;
117     }
118 
119     public void setAppClass(Class<? extends App> appClass) {
120         this.appClass = appClass;
121     }
122 
123     @Override
124     public Map<String, SubAppDescriptor> getSubApps() {
125         return subApps;
126     }
127 
128     public void setSubApps(Map<String, SubAppDescriptor> subApps) {
129         this.subApps = subApps;
130     }
131 
132     public void addSubApp(SubAppDescriptor subApp) {
133         subApps.put(subApp.getName(), subApp);
134     }
135 
136     @Override
137     public AccessDefinition getPermissions() {
138         return permissions;
139     }
140 
141     public void setPermissions(AccessDefinition permissions) {
142         this.permissions = permissions;
143     }
144 
145     @Override
146     public String getI18nBasename() {
147         return i18nBasename;
148     }
149 
150     public void setI18nBasename(String i18nBasename) {
151         this.i18nBasename = i18nBasename;
152     }
153 
154     @Override
155     public boolean isHtmlCaption() {
156         return htmlCaption;
157     }
158 
159     public void setHtmlCaption(boolean htmlCaption) {
160         this.htmlCaption = htmlCaption;
161     }
162 }