001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.ade.galleries.shared;
029
030import org.opencms.gwt.shared.CmsListInfoBean;
031
032import java.util.ArrayList;
033
034/**
035 * Bean representing resource type information.<p>
036 *
037 * @since 8.0.0
038 */
039public class CmsResourceTypeBean extends CmsListInfoBean {
040
041    /** Enum for data source from which resource type bean was constructed. */
042    public enum Origin {
043        /** from sitemap config. */
044        config,
045
046        /** from other source. */
047        other,
048        /** unknown. */
049        unknown
050    }
051
052    /** Enum representing the visibility of a resource type in the bean. */
053    public enum TypeVisibility {
054        /** Never displayed. */
055        hidden,
056        /** Always show the type. */
057        showAlways,
058        /** The user may choose to display the type, but it's not shown by default. */
059        showOptional
060    }
061
062    /** Flag to indicate if the current user may create a new resource of this type. */
063    private boolean m_creatableType;
064
065    /** The creation path. */
066    private String m_createPath;
067
068    /** The deactivated flag. */
069    private boolean m_deactivated;
070
071    /** An array of gallery type names associated with this content type. */
072    private ArrayList<String> m_galleryTypeNames;
073
074    /** The naming pattern for new resources. */
075    private String m_namePattern;
076
077    /** Origin. */
078    private Origin m_origin = Origin.unknown;
079
080    /** The name of the preview provider. */
081    private String m_previewProviderName;
082
083    /** The resource type id. */
084    private int m_typeId;
085
086    /** Visibility of this type. */
087    private TypeVisibility m_visibility = TypeVisibility.showAlways;
088
089    /**
090     * Gets the creation path.<p>
091     *
092     * @return the creation path
093     */
094    public String getCreatePath() {
095
096        return m_createPath;
097    }
098
099    /**
100     * Returns the description.<p>
101     *
102     * @return the description
103     */
104    public String getDescription() {
105
106        return getSubTitle();
107    }
108
109    /**
110     * Returns the list with the gallery types names associated with this resource type.<p>
111     *
112     * @return the gallery type names
113     */
114    public ArrayList<String> getGalleryTypeNames() {
115
116        return m_galleryTypeNames;
117    }
118
119    /**
120     * Returns the naming pattern for new resources.<p>
121     *
122     * @return the naming pattern
123     */
124    public String getNamePattern() {
125
126        return m_namePattern;
127    }
128
129    /**
130     * Returns the origin.<p>
131     *
132     * @return the origin
133     */
134    public Origin getOrigin() {
135
136        return m_origin;
137    }
138
139    /**
140     * Returns the preview provider name.<p>
141     *
142     * @return the preview provider name
143     */
144    public String getPreviewProviderName() {
145
146        return m_previewProviderName;
147    }
148
149    /**
150     * Returns the resource type id.<p>
151     *
152     * @return the resource type id
153     */
154    public int getTypeId() {
155
156        return m_typeId;
157    }
158
159    /**
160     * Gets the visibility.<p>
161     *
162     * @return the visibility
163     */
164    public TypeVisibility getVisibility() {
165
166        return m_visibility;
167    }
168
169    /**
170     * Returns if the current user may create a new resource of this type.<p>
171     *
172     * @return <code>true</code> if the current user may create a new resource of this type
173     */
174    public boolean isCreatableType() {
175
176        return m_creatableType;
177    }
178
179    /**
180     * Returns if the type is deactivated.<p>
181     *
182     * @return if the type is deactivated
183     */
184    public boolean isDeactivated() {
185
186        return m_deactivated;
187    }
188
189    /**
190     * Sets flag to indicate if the current user may create a new resource of this type.<p>
191     *
192     * @param creatableType <code>true</code> if the current user may create a new resource of this type
193     */
194    public void setCreatableType(boolean creatableType) {
195
196        m_creatableType = creatableType;
197    }
198
199    /**
200     * Sets the creation path.<p>
201     *
202     * @param createPath the creation path
203     */
204    public void setCreatePath(String createPath) {
205
206        m_createPath = createPath;
207    }
208
209    /**
210     * Sets the type deactivated.<p>
211     *
212     * @param deactivated if the type is deactivated
213     */
214    public void setDeactivated(boolean deactivated) {
215
216        m_deactivated = deactivated;
217    }
218
219    /**
220     * Sets the list with the gallery types names associated with this resource type.<p>
221     *
222     * @param galleryNames the list with gallery type names to set
223     */
224    public void setGalleryTypeNames(ArrayList<String> galleryNames) {
225
226        m_galleryTypeNames = galleryNames;
227    }
228
229    /**
230     * Sets the naming pattern for new resources.<p>
231     *
232     * @param pattern the naming pattern for new resources
233     */
234    public void setNamePattern(String pattern) {
235
236        m_namePattern = pattern;
237    }
238
239    /**
240     * Sets the origin.<p>
241     *
242     * @param origin the origin to set
243     */
244    public void setOrigin(Origin origin) {
245
246        m_origin = origin;
247    }
248
249    /**
250     * Sets the preview provider name.<p>
251     *
252     * @param previewProviderName the preview provider name to set
253     */
254    public void setPreviewProviderName(String previewProviderName) {
255
256        m_previewProviderName = previewProviderName;
257    }
258
259    /**
260     * Sets the resource type id.<p>
261     *
262     * @param typeId the resource type id to set
263     */
264    public void setTypeId(int typeId) {
265
266        m_typeId = typeId;
267    }
268
269    /**
270     * Sets the visibility.<p>
271     *
272     * @param visibility the new visibility
273     */
274    public void setVisibility(TypeVisibility visibility) {
275
276        m_visibility = visibility;
277
278    }
279
280}