1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.model.impl;
24  
25  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26  import com.liferay.portal.kernel.util.GetterUtil;
27  import com.liferay.portal.model.LayoutSet;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.util.Html;
31  
32  import java.io.Serializable;
33  
34  import java.lang.reflect.Proxy;
35  
36  import java.sql.Types;
37  
38  /**
39   * <a href="LayoutSetModelImpl.java.html"><b><i>View Source</i></b></a>
40   *
41   * <p>
42   * ServiceBuilder generated this class. Modifications in this class will be
43   * overwritten the next time is generated.
44   * </p>
45   *
46   * <p>
47   * This class is a model that represents the <code>LayoutSet</code> table
48   * in the database.
49   * </p>
50   *
51   * @author Brian Wing Shun Chan
52   *
53   * @see com.liferay.portal.service.model.LayoutSet
54   * @see com.liferay.portal.service.model.LayoutSetModel
55   * @see com.liferay.portal.service.model.impl.LayoutSetImpl
56   *
57   */
58  public class LayoutSetModelImpl extends BaseModelImpl {
59      public static final String TABLE_NAME = "LayoutSet";
60      public static final Object[][] TABLE_COLUMNS = {
61              { "layoutSetId", new Integer(Types.BIGINT) },
62              
63  
64              { "groupId", new Integer(Types.BIGINT) },
65              
66  
67              { "companyId", new Integer(Types.BIGINT) },
68              
69  
70              { "privateLayout", new Integer(Types.BOOLEAN) },
71              
72  
73              { "logo", new Integer(Types.BOOLEAN) },
74              
75  
76              { "logoId", new Integer(Types.BIGINT) },
77              
78  
79              { "themeId", new Integer(Types.VARCHAR) },
80              
81  
82              { "colorSchemeId", new Integer(Types.VARCHAR) },
83              
84  
85              { "wapThemeId", new Integer(Types.VARCHAR) },
86              
87  
88              { "wapColorSchemeId", new Integer(Types.VARCHAR) },
89              
90  
91              { "css", new Integer(Types.VARCHAR) },
92              
93  
94              { "pageCount", new Integer(Types.INTEGER) },
95              
96  
97              { "virtualHost", new Integer(Types.VARCHAR) }
98          };
99      public static final String TABLE_SQL_CREATE = "create table LayoutSet (layoutSetId LONG not null primary key,groupId LONG,companyId LONG,privateLayout BOOLEAN,logo BOOLEAN,logoId LONG,themeId VARCHAR(75) null,colorSchemeId VARCHAR(75) null,wapThemeId VARCHAR(75) null,wapColorSchemeId VARCHAR(75) null,css VARCHAR(75) null,pageCount INTEGER,virtualHost VARCHAR(75) null)";
100     public static final String TABLE_SQL_DROP = "drop table LayoutSet";
101     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
102                 "value.object.finder.cache.enabled.com.liferay.portal.model.LayoutSet"),
103             true);
104     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
105                 "lock.expiration.time.com.liferay.portal.model.LayoutSet"));
106 
107     public LayoutSetModelImpl() {
108     }
109 
110     public long getPrimaryKey() {
111         return _layoutSetId;
112     }
113 
114     public void setPrimaryKey(long pk) {
115         setLayoutSetId(pk);
116     }
117 
118     public Serializable getPrimaryKeyObj() {
119         return new Long(_layoutSetId);
120     }
121 
122     public long getLayoutSetId() {
123         return _layoutSetId;
124     }
125 
126     public void setLayoutSetId(long layoutSetId) {
127         if (layoutSetId != _layoutSetId) {
128             _layoutSetId = layoutSetId;
129         }
130     }
131 
132     public long getGroupId() {
133         return _groupId;
134     }
135 
136     public void setGroupId(long groupId) {
137         if (groupId != _groupId) {
138             _groupId = groupId;
139         }
140     }
141 
142     public long getCompanyId() {
143         return _companyId;
144     }
145 
146     public void setCompanyId(long companyId) {
147         if (companyId != _companyId) {
148             _companyId = companyId;
149         }
150     }
151 
152     public boolean getPrivateLayout() {
153         return _privateLayout;
154     }
155 
156     public boolean isPrivateLayout() {
157         return _privateLayout;
158     }
159 
160     public void setPrivateLayout(boolean privateLayout) {
161         if (privateLayout != _privateLayout) {
162             _privateLayout = privateLayout;
163         }
164     }
165 
166     public boolean getLogo() {
167         return _logo;
168     }
169 
170     public boolean isLogo() {
171         return _logo;
172     }
173 
174     public void setLogo(boolean logo) {
175         if (logo != _logo) {
176             _logo = logo;
177         }
178     }
179 
180     public long getLogoId() {
181         return _logoId;
182     }
183 
184     public void setLogoId(long logoId) {
185         if (logoId != _logoId) {
186             _logoId = logoId;
187         }
188     }
189 
190     public String getThemeId() {
191         return GetterUtil.getString(_themeId);
192     }
193 
194     public void setThemeId(String themeId) {
195         if (((themeId == null) && (_themeId != null)) ||
196                 ((themeId != null) && (_themeId == null)) ||
197                 ((themeId != null) && (_themeId != null) &&
198                 !themeId.equals(_themeId))) {
199             _themeId = themeId;
200         }
201     }
202 
203     public String getColorSchemeId() {
204         return GetterUtil.getString(_colorSchemeId);
205     }
206 
207     public void setColorSchemeId(String colorSchemeId) {
208         if (((colorSchemeId == null) && (_colorSchemeId != null)) ||
209                 ((colorSchemeId != null) && (_colorSchemeId == null)) ||
210                 ((colorSchemeId != null) && (_colorSchemeId != null) &&
211                 !colorSchemeId.equals(_colorSchemeId))) {
212             _colorSchemeId = colorSchemeId;
213         }
214     }
215 
216     public String getWapThemeId() {
217         return GetterUtil.getString(_wapThemeId);
218     }
219 
220     public void setWapThemeId(String wapThemeId) {
221         if (((wapThemeId == null) && (_wapThemeId != null)) ||
222                 ((wapThemeId != null) && (_wapThemeId == null)) ||
223                 ((wapThemeId != null) && (_wapThemeId != null) &&
224                 !wapThemeId.equals(_wapThemeId))) {
225             _wapThemeId = wapThemeId;
226         }
227     }
228 
229     public String getWapColorSchemeId() {
230         return GetterUtil.getString(_wapColorSchemeId);
231     }
232 
233     public void setWapColorSchemeId(String wapColorSchemeId) {
234         if (((wapColorSchemeId == null) && (_wapColorSchemeId != null)) ||
235                 ((wapColorSchemeId != null) && (_wapColorSchemeId == null)) ||
236                 ((wapColorSchemeId != null) && (_wapColorSchemeId != null) &&
237                 !wapColorSchemeId.equals(_wapColorSchemeId))) {
238             _wapColorSchemeId = wapColorSchemeId;
239         }
240     }
241 
242     public String getCss() {
243         return GetterUtil.getString(_css);
244     }
245 
246     public void setCss(String css) {
247         if (((css == null) && (_css != null)) ||
248                 ((css != null) && (_css == null)) ||
249                 ((css != null) && (_css != null) && !css.equals(_css))) {
250             _css = css;
251         }
252     }
253 
254     public int getPageCount() {
255         return _pageCount;
256     }
257 
258     public void setPageCount(int pageCount) {
259         if (pageCount != _pageCount) {
260             _pageCount = pageCount;
261         }
262     }
263 
264     public String getVirtualHost() {
265         return GetterUtil.getString(_virtualHost);
266     }
267 
268     public void setVirtualHost(String virtualHost) {
269         if (((virtualHost == null) && (_virtualHost != null)) ||
270                 ((virtualHost != null) && (_virtualHost == null)) ||
271                 ((virtualHost != null) && (_virtualHost != null) &&
272                 !virtualHost.equals(_virtualHost))) {
273             _virtualHost = virtualHost;
274         }
275     }
276 
277     public LayoutSet toEscapedModel() {
278         if (isEscapedModel()) {
279             return (LayoutSet)this;
280         }
281         else {
282             LayoutSet model = new LayoutSetImpl();
283 
284             model.setEscapedModel(true);
285 
286             model.setLayoutSetId(getLayoutSetId());
287             model.setGroupId(getGroupId());
288             model.setCompanyId(getCompanyId());
289             model.setPrivateLayout(getPrivateLayout());
290             model.setLogo(getLogo());
291             model.setLogoId(getLogoId());
292             model.setThemeId(Html.escape(getThemeId()));
293             model.setColorSchemeId(Html.escape(getColorSchemeId()));
294             model.setWapThemeId(Html.escape(getWapThemeId()));
295             model.setWapColorSchemeId(Html.escape(getWapColorSchemeId()));
296             model.setCss(Html.escape(getCss()));
297             model.setPageCount(getPageCount());
298             model.setVirtualHost(Html.escape(getVirtualHost()));
299 
300             model = (LayoutSet)Proxy.newProxyInstance(LayoutSet.class.getClassLoader(),
301                     new Class[] { LayoutSet.class },
302                     new ReadOnlyBeanHandler(model));
303 
304             return model;
305         }
306     }
307 
308     public Object clone() {
309         LayoutSetImpl clone = new LayoutSetImpl();
310 
311         clone.setLayoutSetId(getLayoutSetId());
312         clone.setGroupId(getGroupId());
313         clone.setCompanyId(getCompanyId());
314         clone.setPrivateLayout(getPrivateLayout());
315         clone.setLogo(getLogo());
316         clone.setLogoId(getLogoId());
317         clone.setThemeId(getThemeId());
318         clone.setColorSchemeId(getColorSchemeId());
319         clone.setWapThemeId(getWapThemeId());
320         clone.setWapColorSchemeId(getWapColorSchemeId());
321         clone.setCss(getCss());
322         clone.setPageCount(getPageCount());
323         clone.setVirtualHost(getVirtualHost());
324 
325         return clone;
326     }
327 
328     public int compareTo(Object obj) {
329         if (obj == null) {
330             return -1;
331         }
332 
333         LayoutSetImpl layoutSet = (LayoutSetImpl)obj;
334 
335         long pk = layoutSet.getPrimaryKey();
336 
337         if (getPrimaryKey() < pk) {
338             return -1;
339         }
340         else if (getPrimaryKey() > pk) {
341             return 1;
342         }
343         else {
344             return 0;
345         }
346     }
347 
348     public boolean equals(Object obj) {
349         if (obj == null) {
350             return false;
351         }
352 
353         LayoutSetImpl layoutSet = null;
354 
355         try {
356             layoutSet = (LayoutSetImpl)obj;
357         }
358         catch (ClassCastException cce) {
359             return false;
360         }
361 
362         long pk = layoutSet.getPrimaryKey();
363 
364         if (getPrimaryKey() == pk) {
365             return true;
366         }
367         else {
368             return false;
369         }
370     }
371 
372     public int hashCode() {
373         return (int)getPrimaryKey();
374     }
375 
376     private long _layoutSetId;
377     private long _groupId;
378     private long _companyId;
379     private boolean _privateLayout;
380     private boolean _logo;
381     private long _logoId;
382     private String _themeId;
383     private String _colorSchemeId;
384     private String _wapThemeId;
385     private String _wapColorSchemeId;
386     private String _css;
387     private int _pageCount;
388     private String _virtualHost;
389 }