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