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.portlet.journal.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.impl.BaseModelImpl;
26  
27  import com.liferay.portlet.journal.model.JournalContentSearch;
28  import com.liferay.portlet.journal.model.JournalContentSearchSoap;
29  
30  import java.io.Serializable;
31  
32  import java.lang.reflect.Proxy;
33  
34  import java.sql.Types;
35  
36  import java.util.ArrayList;
37  import java.util.List;
38  
39  /**
40   * <a href="JournalContentSearchModelImpl.java.html"><b><i>View Source</i></b></a>
41   *
42   * <p>
43   * ServiceBuilder generated this class. Modifications in this class will be
44   * overwritten the next time is generated.
45   * </p>
46   *
47   * <p>
48   * This class is a model that represents the <code>JournalContentSearch</code> table
49   * in the database.
50   * </p>
51   *
52   * @author Brian Wing Shun Chan
53   *
54   * @see com.liferay.portlet.journal.model.JournalContentSearch
55   * @see com.liferay.portlet.journal.model.JournalContentSearchModel
56   * @see com.liferay.portlet.journal.model.impl.JournalContentSearchImpl
57   *
58   */
59  public class JournalContentSearchModelImpl extends BaseModelImpl {
60      public static final String TABLE_NAME = "JournalContentSearch";
61      public static final Object[][] TABLE_COLUMNS = {
62              { "contentSearchId", new Integer(Types.BIGINT) },
63              
64  
65              { "groupId", new Integer(Types.BIGINT) },
66              
67  
68              { "companyId", new Integer(Types.BIGINT) },
69              
70  
71              { "privateLayout", new Integer(Types.BOOLEAN) },
72              
73  
74              { "layoutId", new Integer(Types.BIGINT) },
75              
76  
77              { "portletId", new Integer(Types.VARCHAR) },
78              
79  
80              { "articleId", new Integer(Types.VARCHAR) }
81          };
82      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)";
83      public static final String TABLE_SQL_DROP = "drop table JournalContentSearch";
84      public static final String DATA_SOURCE = "liferayDataSource";
85      public static final String SESSION_FACTORY = "liferaySessionFactory";
86      public static final String TX_MANAGER = "liferayTransactionManager";
87      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
88                  "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalContentSearch"),
89              true);
90  
91      public static JournalContentSearch toModel(
92          JournalContentSearchSoap soapModel) {
93          JournalContentSearch model = new JournalContentSearchImpl();
94  
95          model.setContentSearchId(soapModel.getContentSearchId());
96          model.setGroupId(soapModel.getGroupId());
97          model.setCompanyId(soapModel.getCompanyId());
98          model.setPrivateLayout(soapModel.getPrivateLayout());
99          model.setLayoutId(soapModel.getLayoutId());
100         model.setPortletId(soapModel.getPortletId());
101         model.setArticleId(soapModel.getArticleId());
102 
103         return model;
104     }
105 
106     public static List<JournalContentSearch> toModels(
107         JournalContentSearchSoap[] soapModels) {
108         List<JournalContentSearch> models = new ArrayList<JournalContentSearch>(soapModels.length);
109 
110         for (JournalContentSearchSoap soapModel : soapModels) {
111             models.add(toModel(soapModel));
112         }
113 
114         return models;
115     }
116 
117     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
118                 "lock.expiration.time.com.liferay.portlet.journal.model.JournalContentSearch"));
119 
120     public JournalContentSearchModelImpl() {
121     }
122 
123     public long getPrimaryKey() {
124         return _contentSearchId;
125     }
126 
127     public void setPrimaryKey(long pk) {
128         setContentSearchId(pk);
129     }
130 
131     public Serializable getPrimaryKeyObj() {
132         return new Long(_contentSearchId);
133     }
134 
135     public long getContentSearchId() {
136         return _contentSearchId;
137     }
138 
139     public void setContentSearchId(long contentSearchId) {
140         if (contentSearchId != _contentSearchId) {
141             _contentSearchId = contentSearchId;
142         }
143     }
144 
145     public long getGroupId() {
146         return _groupId;
147     }
148 
149     public void setGroupId(long groupId) {
150         if (groupId != _groupId) {
151             _groupId = groupId;
152         }
153     }
154 
155     public long getCompanyId() {
156         return _companyId;
157     }
158 
159     public void setCompanyId(long companyId) {
160         if (companyId != _companyId) {
161             _companyId = companyId;
162         }
163     }
164 
165     public boolean getPrivateLayout() {
166         return _privateLayout;
167     }
168 
169     public boolean isPrivateLayout() {
170         return _privateLayout;
171     }
172 
173     public void setPrivateLayout(boolean privateLayout) {
174         if (privateLayout != _privateLayout) {
175             _privateLayout = privateLayout;
176         }
177     }
178 
179     public long getLayoutId() {
180         return _layoutId;
181     }
182 
183     public void setLayoutId(long layoutId) {
184         if (layoutId != _layoutId) {
185             _layoutId = layoutId;
186         }
187     }
188 
189     public String getPortletId() {
190         return GetterUtil.getString(_portletId);
191     }
192 
193     public void setPortletId(String portletId) {
194         if (((portletId == null) && (_portletId != null)) ||
195                 ((portletId != null) && (_portletId == null)) ||
196                 ((portletId != null) && (_portletId != null) &&
197                 !portletId.equals(_portletId))) {
198             _portletId = portletId;
199         }
200     }
201 
202     public String getArticleId() {
203         return GetterUtil.getString(_articleId);
204     }
205 
206     public void setArticleId(String articleId) {
207         if (((articleId == null) && (_articleId != null)) ||
208                 ((articleId != null) && (_articleId == null)) ||
209                 ((articleId != null) && (_articleId != null) &&
210                 !articleId.equals(_articleId))) {
211             _articleId = articleId;
212         }
213     }
214 
215     public JournalContentSearch toEscapedModel() {
216         if (isEscapedModel()) {
217             return (JournalContentSearch)this;
218         }
219         else {
220             JournalContentSearch model = new JournalContentSearchImpl();
221 
222             model.setNew(isNew());
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 }