1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.model.impl;
21  
22  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23  import com.liferay.portal.kernel.util.GetterUtil;
24  import com.liferay.portal.kernel.util.HtmlUtil;
25  import com.liferay.portal.model.LayoutSet;
26  import com.liferay.portal.model.LayoutSetSoap;
27  
28  import java.io.Serializable;
29  
30  import java.lang.reflect.Proxy;
31  
32  import java.sql.Types;
33  
34  import java.util.ArrayList;
35  import java.util.List;
36  
37  /**
38   * <a href="LayoutSetModelImpl.java.html"><b><i>View Source</i></b></a>
39   *
40   * <p>
41   * ServiceBuilder generated this class. Modifications in this class will be
42   * overwritten the next time is generated.
43   * </p>
44   *
45   * <p>
46   * This class is a model that represents the <code>LayoutSet</code> table
47   * in the database.
48   * </p>
49   *
50   * @author Brian Wing Shun Chan
51   *
52   * @see com.liferay.portal.model.LayoutSet
53   * @see com.liferay.portal.model.LayoutSetModel
54   * @see com.liferay.portal.model.impl.LayoutSetImpl
55   *
56   */
57  public class LayoutSetModelImpl extends BaseModelImpl {
58      public static final String TABLE_NAME = "LayoutSet";
59      public static final Object[][] TABLE_COLUMNS = {
60              { "layoutSetId", new Integer(Types.BIGINT) },
61              
62  
63              { "groupId", new Integer(Types.BIGINT) },
64              
65  
66              { "companyId", new Integer(Types.BIGINT) },
67              
68  
69              { "privateLayout", new Integer(Types.BOOLEAN) },
70              
71  
72              { "logo", new Integer(Types.BOOLEAN) },
73              
74  
75              { "logoId", new Integer(Types.BIGINT) },
76              
77  
78              { "themeId", new Integer(Types.VARCHAR) },
79              
80  
81              { "colorSchemeId", new Integer(Types.VARCHAR) },
82              
83  
84              { "wapThemeId", new Integer(Types.VARCHAR) },
85              
86  
87              { "wapColorSchemeId", new Integer(Types.VARCHAR) },
88              
89  
90              { "css", new Integer(Types.VARCHAR) },
91              
92  
93              { "pageCount", new Integer(Types.INTEGER) },
94              
95  
96              { "virtualHost", new Integer(Types.VARCHAR) }
97          };
98      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)";
99      public static final String TABLE_SQL_DROP = "drop table LayoutSet";
100     public static final String DATA_SOURCE = "liferayDataSource";
101     public static final String SESSION_FACTORY = "liferaySessionFactory";
102     public static final String TX_MANAGER = "liferayTransactionManager";
103     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
104                 "value.object.finder.cache.enabled.com.liferay.portal.model.LayoutSet"),
105             true);
106 
107     public static LayoutSet toModel(LayoutSetSoap soapModel) {
108         LayoutSet model = new LayoutSetImpl();
109 
110         model.setLayoutSetId(soapModel.getLayoutSetId());
111         model.setGroupId(soapModel.getGroupId());
112         model.setCompanyId(soapModel.getCompanyId());
113         model.setPrivateLayout(soapModel.getPrivateLayout());
114         model.setLogo(soapModel.getLogo());
115         model.setLogoId(soapModel.getLogoId());
116         model.setThemeId(soapModel.getThemeId());
117         model.setColorSchemeId(soapModel.getColorSchemeId());
118         model.setWapThemeId(soapModel.getWapThemeId());
119         model.setWapColorSchemeId(soapModel.getWapColorSchemeId());
120         model.setCss(soapModel.getCss());
121         model.setPageCount(soapModel.getPageCount());
122         model.setVirtualHost(soapModel.getVirtualHost());
123 
124         return model;
125     }
126 
127     public static List<LayoutSet> toModels(LayoutSetSoap[] soapModels) {
128         List<LayoutSet> models = new ArrayList<LayoutSet>(soapModels.length);
129 
130         for (LayoutSetSoap soapModel : soapModels) {
131             models.add(toModel(soapModel));
132         }
133 
134         return models;
135     }
136 
137     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
138                 "lock.expiration.time.com.liferay.portal.model.LayoutSet"));
139 
140     public LayoutSetModelImpl() {
141     }
142 
143     public long getPrimaryKey() {
144         return _layoutSetId;
145     }
146 
147     public void setPrimaryKey(long pk) {
148         setLayoutSetId(pk);
149     }
150 
151     public Serializable getPrimaryKeyObj() {
152         return new Long(_layoutSetId);
153     }
154 
155     public long getLayoutSetId() {
156         return _layoutSetId;
157     }
158 
159     public void setLayoutSetId(long layoutSetId) {
160         if (layoutSetId != _layoutSetId) {
161             _layoutSetId = layoutSetId;
162         }
163     }
164 
165     public long getGroupId() {
166         return _groupId;
167     }
168 
169     public void setGroupId(long groupId) {
170         if (groupId != _groupId) {
171             _groupId = groupId;
172         }
173     }
174 
175     public long getCompanyId() {
176         return _companyId;
177     }
178 
179     public void setCompanyId(long companyId) {
180         if (companyId != _companyId) {
181             _companyId = companyId;
182         }
183     }
184 
185     public boolean getPrivateLayout() {
186         return _privateLayout;
187     }
188 
189     public boolean isPrivateLayout() {
190         return _privateLayout;
191     }
192 
193     public void setPrivateLayout(boolean privateLayout) {
194         if (privateLayout != _privateLayout) {
195             _privateLayout = privateLayout;
196         }
197     }
198 
199     public boolean getLogo() {
200         return _logo;
201     }
202 
203     public boolean isLogo() {
204         return _logo;
205     }
206 
207     public void setLogo(boolean logo) {
208         if (logo != _logo) {
209             _logo = logo;
210         }
211     }
212 
213     public long getLogoId() {
214         return _logoId;
215     }
216 
217     public void setLogoId(long logoId) {
218         if (logoId != _logoId) {
219             _logoId = logoId;
220         }
221     }
222 
223     public String getThemeId() {
224         return GetterUtil.getString(_themeId);
225     }
226 
227     public void setThemeId(String themeId) {
228         if (((themeId == null) && (_themeId != null)) ||
229                 ((themeId != null) && (_themeId == null)) ||
230                 ((themeId != null) && (_themeId != null) &&
231                 !themeId.equals(_themeId))) {
232             _themeId = themeId;
233         }
234     }
235 
236     public String getColorSchemeId() {
237         return GetterUtil.getString(_colorSchemeId);
238     }
239 
240     public void setColorSchemeId(String colorSchemeId) {
241         if (((colorSchemeId == null) && (_colorSchemeId != null)) ||
242                 ((colorSchemeId != null) && (_colorSchemeId == null)) ||
243                 ((colorSchemeId != null) && (_colorSchemeId != null) &&
244                 !colorSchemeId.equals(_colorSchemeId))) {
245             _colorSchemeId = colorSchemeId;
246         }
247     }
248 
249     public String getWapThemeId() {
250         return GetterUtil.getString(_wapThemeId);
251     }
252 
253     public void setWapThemeId(String wapThemeId) {
254         if (((wapThemeId == null) && (_wapThemeId != null)) ||
255                 ((wapThemeId != null) && (_wapThemeId == null)) ||
256                 ((wapThemeId != null) && (_wapThemeId != null) &&
257                 !wapThemeId.equals(_wapThemeId))) {
258             _wapThemeId = wapThemeId;
259         }
260     }
261 
262     public String getWapColorSchemeId() {
263         return GetterUtil.getString(_wapColorSchemeId);
264     }
265 
266     public void setWapColorSchemeId(String wapColorSchemeId) {
267         if (((wapColorSchemeId == null) && (_wapColorSchemeId != null)) ||
268                 ((wapColorSchemeId != null) && (_wapColorSchemeId == null)) ||
269                 ((wapColorSchemeId != null) && (_wapColorSchemeId != null) &&
270                 !wapColorSchemeId.equals(_wapColorSchemeId))) {
271             _wapColorSchemeId = wapColorSchemeId;
272         }
273     }
274 
275     public String getCss() {
276         return GetterUtil.getString(_css);
277     }
278 
279     public void setCss(String css) {
280         if (((css == null) && (_css != null)) ||
281                 ((css != null) && (_css == null)) ||
282                 ((css != null) && (_css != null) && !css.equals(_css))) {
283             _css = css;
284         }
285     }
286 
287     public int getPageCount() {
288         return _pageCount;
289     }
290 
291     public void setPageCount(int pageCount) {
292         if (pageCount != _pageCount) {
293             _pageCount = pageCount;
294         }
295     }
296 
297     public String getVirtualHost() {
298         return GetterUtil.getString(_virtualHost);
299     }
300 
301     public void setVirtualHost(String virtualHost) {
302         if (((virtualHost == null) && (_virtualHost != null)) ||
303                 ((virtualHost != null) && (_virtualHost == null)) ||
304                 ((virtualHost != null) && (_virtualHost != null) &&
305                 !virtualHost.equals(_virtualHost))) {
306             _virtualHost = virtualHost;
307         }
308     }
309 
310     public LayoutSet toEscapedModel() {
311         if (isEscapedModel()) {
312             return (LayoutSet)this;
313         }
314         else {
315             LayoutSet model = new LayoutSetImpl();
316 
317             model.setNew(isNew());
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 }