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