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