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.portlet.journal.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.impl.BaseModelImpl;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.portlet.journal.model.JournalContentSearch;
31  
32  import com.liferay.util.Html;
33  
34  import java.io.Serializable;
35  
36  import java.lang.reflect.Proxy;
37  
38  import java.sql.Types;
39  
40  /**
41   * <a href="JournalContentSearchModelImpl.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>JournalContentSearch</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portlet.journal.service.model.JournalContentSearch
56   * @see com.liferay.portlet.journal.service.model.JournalContentSearchModel
57   * @see com.liferay.portlet.journal.service.model.impl.JournalContentSearchImpl
58   *
59   */
60  public class JournalContentSearchModelImpl extends BaseModelImpl {
61      public static final String TABLE_NAME = "JournalContentSearch";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "contentSearchId", 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              { "layoutId", new Integer(Types.BIGINT) },
76              
77  
78              { "portletId", new Integer(Types.VARCHAR) },
79              
80  
81              { "articleId", new Integer(Types.VARCHAR) }
82          };
83      public static final String TABLE_SQL_CREATE = "create table JournalContentSearch (contentSearchId LONG not null primary key,groupId LONG,companyId LONG,privateLayout BOOLEAN,layoutId LONG,portletId VARCHAR(200) null,articleId VARCHAR(75) null)";
84      public static final String TABLE_SQL_DROP = "drop table JournalContentSearch";
85      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
86                  "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalContentSearch"),
87              true);
88      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
89                  "lock.expiration.time.com.liferay.portlet.journal.model.JournalContentSearch"));
90  
91      public JournalContentSearchModelImpl() {
92      }
93  
94      public long getPrimaryKey() {
95          return _contentSearchId;
96      }
97  
98      public void setPrimaryKey(long pk) {
99          setContentSearchId(pk);
100     }
101 
102     public Serializable getPrimaryKeyObj() {
103         return new Long(_contentSearchId);
104     }
105 
106     public long getContentSearchId() {
107         return _contentSearchId;
108     }
109 
110     public void setContentSearchId(long contentSearchId) {
111         if (contentSearchId != _contentSearchId) {
112             _contentSearchId = contentSearchId;
113         }
114     }
115 
116     public long getGroupId() {
117         return _groupId;
118     }
119 
120     public void setGroupId(long groupId) {
121         if (groupId != _groupId) {
122             _groupId = groupId;
123         }
124     }
125 
126     public long getCompanyId() {
127         return _companyId;
128     }
129 
130     public void setCompanyId(long companyId) {
131         if (companyId != _companyId) {
132             _companyId = companyId;
133         }
134     }
135 
136     public boolean getPrivateLayout() {
137         return _privateLayout;
138     }
139 
140     public boolean isPrivateLayout() {
141         return _privateLayout;
142     }
143 
144     public void setPrivateLayout(boolean privateLayout) {
145         if (privateLayout != _privateLayout) {
146             _privateLayout = privateLayout;
147         }
148     }
149 
150     public long getLayoutId() {
151         return _layoutId;
152     }
153 
154     public void setLayoutId(long layoutId) {
155         if (layoutId != _layoutId) {
156             _layoutId = layoutId;
157         }
158     }
159 
160     public String getPortletId() {
161         return GetterUtil.getString(_portletId);
162     }
163 
164     public void setPortletId(String portletId) {
165         if (((portletId == null) && (_portletId != null)) ||
166                 ((portletId != null) && (_portletId == null)) ||
167                 ((portletId != null) && (_portletId != null) &&
168                 !portletId.equals(_portletId))) {
169             _portletId = portletId;
170         }
171     }
172 
173     public String getArticleId() {
174         return GetterUtil.getString(_articleId);
175     }
176 
177     public void setArticleId(String articleId) {
178         if (((articleId == null) && (_articleId != null)) ||
179                 ((articleId != null) && (_articleId == null)) ||
180                 ((articleId != null) && (_articleId != null) &&
181                 !articleId.equals(_articleId))) {
182             _articleId = articleId;
183         }
184     }
185 
186     public JournalContentSearch toEscapedModel() {
187         if (isEscapedModel()) {
188             return (JournalContentSearch)this;
189         }
190         else {
191             JournalContentSearch model = new JournalContentSearchImpl();
192 
193             model.setEscapedModel(true);
194 
195             model.setContentSearchId(getContentSearchId());
196             model.setGroupId(getGroupId());
197             model.setCompanyId(getCompanyId());
198             model.setPrivateLayout(getPrivateLayout());
199             model.setLayoutId(getLayoutId());
200             model.setPortletId(Html.escape(getPortletId()));
201             model.setArticleId(Html.escape(getArticleId()));
202 
203             model = (JournalContentSearch)Proxy.newProxyInstance(JournalContentSearch.class.getClassLoader(),
204                     new Class[] { JournalContentSearch.class },
205                     new ReadOnlyBeanHandler(model));
206 
207             return model;
208         }
209     }
210 
211     public Object clone() {
212         JournalContentSearchImpl clone = new JournalContentSearchImpl();
213 
214         clone.setContentSearchId(getContentSearchId());
215         clone.setGroupId(getGroupId());
216         clone.setCompanyId(getCompanyId());
217         clone.setPrivateLayout(getPrivateLayout());
218         clone.setLayoutId(getLayoutId());
219         clone.setPortletId(getPortletId());
220         clone.setArticleId(getArticleId());
221 
222         return clone;
223     }
224 
225     public int compareTo(Object obj) {
226         if (obj == null) {
227             return -1;
228         }
229 
230         JournalContentSearchImpl journalContentSearch = (JournalContentSearchImpl)obj;
231 
232         long pk = journalContentSearch.getPrimaryKey();
233 
234         if (getPrimaryKey() < pk) {
235             return -1;
236         }
237         else if (getPrimaryKey() > pk) {
238             return 1;
239         }
240         else {
241             return 0;
242         }
243     }
244 
245     public boolean equals(Object obj) {
246         if (obj == null) {
247             return false;
248         }
249 
250         JournalContentSearchImpl journalContentSearch = null;
251 
252         try {
253             journalContentSearch = (JournalContentSearchImpl)obj;
254         }
255         catch (ClassCastException cce) {
256             return false;
257         }
258 
259         long pk = journalContentSearch.getPrimaryKey();
260 
261         if (getPrimaryKey() == pk) {
262             return true;
263         }
264         else {
265             return false;
266         }
267     }
268 
269     public int hashCode() {
270         return (int)getPrimaryKey();
271     }
272 
273     private long _contentSearchId;
274     private long _groupId;
275     private long _companyId;
276     private boolean _privateLayout;
277     private long _layoutId;
278     private String _portletId;
279     private String _articleId;
280 }