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.kernel.util.HtmlUtil;
28  import com.liferay.portal.model.LayoutSet;
29  import com.liferay.portal.model.LayoutSetSoap;
30  
31  import java.io.Serializable;
32  
33  import java.lang.reflect.Proxy;
34  
35  import java.sql.Types;
36  
37  import java.util.ArrayList;
38  import java.util.List;
39  
40  /**
41   * <a href="LayoutSetModelImpl.java.html"><b><i>View Source</i></b></a>
42   *
43   * <p>
44   * ServiceBuilder generated this class. Modifications in this class will be
45   * overwritten the next time is generated.
46   * </p>
47   *
48   * <p>
49   * This class is a model that represents the <code>LayoutSet</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portal.service.model.LayoutSet
56   * @see com.liferay.portal.service.model.LayoutSetModel
57   * @see com.liferay.portal.service.model.impl.LayoutSetImpl
58   *
59   */
60  public class LayoutSetModelImpl extends BaseModelImpl {
61      public static final String TABLE_NAME = "LayoutSet";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "layoutSetId", new Integer(Types.BIGINT) },
64              
65  
66              { "groupId", new Integer(Types.BIGINT) },
67              
68  
69              { "companyId", new Integer(Types.BIGINT) },
70              
71  
72              { "privateLayout", new Integer(Types.BOOLEAN) },
73              
74  
75              { "logo", new Integer(Types.BOOLEAN) },
76              
77  
78              { "logoId", new Integer(Types.BIGINT) },
79              
80  
81              { "themeId", new Integer(Types.VARCHAR) },
82              
83  
84              { "colorSchemeId", new Integer(Types.VARCHAR) },
85              
86  
87              { "wapThemeId", new Integer(Types.VARCHAR) },
88              
89  
90              { "wapColorSchemeId", new Integer(Types.VARCHAR) },
91              
92  
93              { "css", new Integer(Types.VARCHAR) },
94              
95  
96              { "pageCount", new Integer(Types.INTEGER) },
97              
98  
99              { "virtualHost", new Integer(Types.VARCHAR) }
100         };
101     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 STRING null,pageCount INTEGER,virtualHost VARCHAR(75) null)";
102     public static final String TABLE_SQL_DROP = "drop table LayoutSet";
103     public static final String DATA_SOURCE = "liferayDataSource";
104     public static final String SESSION_FACTORY = "liferaySessionFactory";
105     public static final String TX_MANAGER = "liferayTransactionManager";
106     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
107                 "value.object.finder.cache.enabled.com.liferay.portal.model.LayoutSet"),
108             true);
109 
110     public static LayoutSet toModel(LayoutSetSoap soapModel) {
111         LayoutSet model = new LayoutSetImpl();
112 
113         model.setLayoutSetId(soapModel.getLayoutSetId());
114         model.setGroupId(soapModel.getGroupId());
115         model.setCompanyId(soapModel.getCompanyId());
116         model.setPrivateLayout(soapModel.getPrivateLayout());
117         model.setLogo(soapModel.getLogo());
118         model.setLogoId(soapModel.getLogoId());
119         model.setThemeId(soapModel.getThemeId());
120         model.setColorSchemeId(soapModel.getColorSchemeId());
121         model.setWapThemeId(soapModel.getWapThemeId());
122         model.setWapColorSchemeId(soapModel.getWapColorSchemeId());
123         model.setCss(soapModel.getCss());
124         model.setPageCount(soapModel.getPageCount());
125         model.setVirtualHost(soapModel.getVirtualHost());
126 
127         return model;
128     }
129 
130     public static List<LayoutSet> toModels(LayoutSetSoap[] soapModels) {
131         List<LayoutSet> models = new ArrayList<LayoutSet>(soapModels.length);
132 
133         for (LayoutSetSoap soapModel : soapModels) {
134             models.add(toModel(soapModel));
135         }
136 
137         return models;
138     }
139 
140     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
141                 "lock.expiration.time.com.liferay.portal.model.LayoutSet"));
142 
143     public LayoutSetModelImpl() {
144     }
145 
146     public long getPrimaryKey() {
147         return _layoutSetId;
148     }
149 
150     public void setPrimaryKey(long pk) {
151         setLayoutSetId(pk);
152     }
153 
154     public Serializable getPrimaryKeyObj() {
155         return new Long(_layoutSetId);
156     }
157 
158     public long getLayoutSetId() {
159         return _layoutSetId;
160     }
161 
162     public void setLayoutSetId(long layoutSetId) {
163         if (layoutSetId != _layoutSetId) {
164             _layoutSetId = layoutSetId;
165         }
166     }
167 
168     public long getGroupId() {
169         return _groupId;
170     }
171 
172     public void setGroupId(long groupId) {
173         if (groupId != _groupId) {
174             _groupId = groupId;
175         }
176     }
177 
178     public long getCompanyId() {
179         return _companyId;
180     }
181 
182     public void setCompanyId(long companyId) {
183         if (companyId != _companyId) {
184             _companyId = companyId;
185         }
186     }
187 
188     public boolean getPrivateLayout() {
189         return _privateLayout;
190     }
191 
192     public boolean isPrivateLayout() {
193         return _privateLayout;
194     }
195 
196     public void setPrivateLayout(boolean privateLayout) {
197         if (privateLayout != _privateLayout) {
198             _privateLayout = privateLayout;
199         }
200     }
201 
202     public boolean getLogo() {
203         return _logo;
204     }
205 
206     public boolean isLogo() {
207         return _logo;
208     }
209 
210     public void setLogo(boolean logo) {
211         if (logo != _logo) {
212             _logo = logo;
213         }
214     }
215 
216     public long getLogoId() {
217         return _logoId;
218     }
219 
220     public void setLogoId(long logoId) {
221         if (logoId != _logoId) {
222             _logoId = logoId;
223         }
224     }
225 
226     public String getThemeId() {
227         return GetterUtil.getString(_themeId);
228     }
229 
230     public void setThemeId(String themeId) {
231         if (((themeId == null) && (_themeId != null)) ||
232                 ((themeId != null) && (_themeId == null)) ||
233                 ((themeId != null) && (_themeId != null) &&
234                 !themeId.equals(_themeId))) {
235             _themeId = themeId;
236         }
237     }
238 
239     public String getColorSchemeId() {
240         return GetterUtil.getString(_colorSchemeId);
241     }
242 
243     public void setColorSchemeId(String colorSchemeId) {
244         if (((colorSchemeId == null) && (_colorSchemeId != null)) ||
245                 ((colorSchemeId != null) && (_colorSchemeId == null)) ||
246                 ((colorSchemeId != null) && (_colorSchemeId != null) &&
247                 !colorSchemeId.equals(_colorSchemeId))) {
248             _colorSchemeId = colorSchemeId;
249         }
250     }
251 
252     public String getWapThemeId() {
253         return GetterUtil.getString(_wapThemeId);
254     }
255 
256     public void setWapThemeId(String wapThemeId) {
257         if (((wapThemeId == null) && (_wapThemeId != null)) ||
258                 ((wapThemeId != null) && (_wapThemeId == null)) ||
259                 ((wapThemeId != null) && (_wapThemeId != null) &&
260                 !wapThemeId.equals(_wapThemeId))) {
261             _wapThemeId = wapThemeId;
262         }
263     }
264 
265     public String getWapColorSchemeId() {
266         return GetterUtil.getString(_wapColorSchemeId);
267     }
268 
269     public void setWapColorSchemeId(String wapColorSchemeId) {
270         if (((wapColorSchemeId == null) && (_wapColorSchemeId != null)) ||
271                 ((wapColorSchemeId != null) && (_wapColorSchemeId == null)) ||
272                 ((wapColorSchemeId != null) && (_wapColorSchemeId != null) &&
273                 !wapColorSchemeId.equals(_wapColorSchemeId))) {
274             _wapColorSchemeId = wapColorSchemeId;
275         }
276     }
277 
278     public String getCss() {
279         return GetterUtil.getString(_css);
280     }
281 
282     public void setCss(String css) {
283         if (((css == null) && (_css != null)) ||
284                 ((css != null) && (_css == null)) ||
285                 ((css != null) && (_css != null) && !css.equals(_css))) {
286             _css = css;
287         }
288     }
289 
290     public int getPageCount() {
291         return _pageCount;
292     }
293 
294     public void setPageCount(int pageCount) {
295         if (pageCount != _pageCount) {
296             _pageCount = pageCount;
297         }
298     }
299 
300     public String getVirtualHost() {
301         return GetterUtil.getString(_virtualHost);
302     }
303 
304     public void setVirtualHost(String virtualHost) {
305         if (((virtualHost == null) && (_virtualHost != null)) ||
306                 ((virtualHost != null) && (_virtualHost == null)) ||
307                 ((virtualHost != null) && (_virtualHost != null) &&
308                 !virtualHost.equals(_virtualHost))) {
309             _virtualHost = virtualHost;
310         }
311     }
312 
313     public LayoutSet toEscapedModel() {
314         if (isEscapedModel()) {
315             return (LayoutSet)this;
316         }
317         else {
318             LayoutSet model = new LayoutSetImpl();
319 
320             model.setEscapedModel(true);
321 
322             model.setLayoutSetId(getLayoutSetId());
323             model.setGroupId(getGroupId());
324             model.setCompanyId(getCompanyId());
325             model.setPrivateLayout(getPrivateLayout());
326             model.setLogo(getLogo());
327             model.setLogoId(getLogoId());
328             model.setThemeId(HtmlUtil.escape(getThemeId()));
329             model.setColorSchemeId(HtmlUtil.escape(getColorSchemeId()));
330             model.setWapThemeId(HtmlUtil.escape(getWapThemeId()));
331             model.setWapColorSchemeId(HtmlUtil.escape(getWapColorSchemeId()));
332             model.setCss(HtmlUtil.escape(getCss()));
333             model.setPageCount(getPageCount());
334             model.setVirtualHost(HtmlUtil.escape(getVirtualHost()));
335 
336             model = (LayoutSet)Proxy.newProxyInstance(LayoutSet.class.getClassLoader(),
337                     new Class[] { LayoutSet.class },
338                     new ReadOnlyBeanHandler(model));
339 
340             return model;
341         }
342     }
343 
344     public Object clone() {
345         LayoutSetImpl clone = new LayoutSetImpl();
346 
347         clone.setLayoutSetId(getLayoutSetId());
348         clone.setGroupId(getGroupId());
349         clone.setCompanyId(getCompanyId());
350         clone.setPrivateLayout(getPrivateLayout());
351         clone.setLogo(getLogo());
352         clone.setLogoId(getLogoId());
353         clone.setThemeId(getThemeId());
354         clone.setColorSchemeId(getColorSchemeId());
355         clone.setWapThemeId(getWapThemeId());
356         clone.setWapColorSchemeId(getWapColorSchemeId());
357         clone.setCss(getCss());
358         clone.setPageCount(getPageCount());
359         clone.setVirtualHost(getVirtualHost());
360 
361         return clone;
362     }
363 
364     public int compareTo(Object obj) {
365         if (obj == null) {
366             return -1;
367         }
368 
369         LayoutSetImpl layoutSet = (LayoutSetImpl)obj;
370 
371         long pk = layoutSet.getPrimaryKey();
372 
373         if (getPrimaryKey() < pk) {
374             return -1;
375         }
376         else if (getPrimaryKey() > pk) {
377             return 1;
378         }
379         else {
380             return 0;
381         }
382     }
383 
384     public boolean equals(Object obj) {
385         if (obj == null) {
386             return false;
387         }
388 
389         LayoutSetImpl layoutSet = null;
390 
391         try {
392             layoutSet = (LayoutSetImpl)obj;
393         }
394         catch (ClassCastException cce) {
395             return false;
396         }
397 
398         long pk = layoutSet.getPrimaryKey();
399 
400         if (getPrimaryKey() == pk) {
401             return true;
402         }
403         else {
404             return false;
405         }
406     }
407 
408     public int hashCode() {
409         return (int)getPrimaryKey();
410     }
411 
412     private long _layoutSetId;
413     private long _groupId;
414     private long _companyId;
415     private boolean _privateLayout;
416     private boolean _logo;
417     private long _logoId;
418     private String _themeId;
419     private String _colorSchemeId;
420     private String _wapThemeId;
421     private String _wapColorSchemeId;
422     private String _css;
423     private int _pageCount;
424     private String _virtualHost;
425 }