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