1   /**
2    * Copyright (c) 2000-2007 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.util.GetterUtil;
26  import com.liferay.portal.model.impl.BaseModelImpl;
27  import com.liferay.portal.util.PropsUtil;
28  
29  import com.liferay.util.XSSUtil;
30  
31  import java.io.Serializable;
32  
33  import java.sql.Types;
34  
35  /**
36   * <a href="JournalContentSearchModelImpl.java.html"><b><i>View Source</i></b></a>
37   *
38   * <p>
39   * ServiceBuilder generated this class. Modifications in this class will be overwritten
40   * the next time is generated.
41   * </p>
42   *
43   * <p>
44   * This class is a model that represents the <code>JournalContentSearch</code> table
45   * in the database.
46   * </p>
47   *
48   * @author Brian Wing Shun Chan
49   *
50   * @see com.liferay.portlet.journal.service.model.JournalContentSearch
51   * @see com.liferay.portlet.journal.service.model.JournalContentSearchModel
52   * @see com.liferay.portlet.journal.service.model.impl.JournalContentSearchImpl
53   *
54   */
55  public class JournalContentSearchModelImpl extends BaseModelImpl {
56      public static String TABLE_NAME = "JournalContentSearch";
57      public static Object[][] TABLE_COLUMNS = {
58              { "contentSearchId", new Integer(Types.BIGINT) },
59              { "groupId", new Integer(Types.BIGINT) },
60              { "companyId", new Integer(Types.BIGINT) },
61              { "privateLayout", new Integer(Types.BOOLEAN) },
62              { "layoutId", new Integer(Types.BIGINT) },
63              { "portletId", new Integer(Types.VARCHAR) },
64              { "articleId", new Integer(Types.VARCHAR) }
65          };
66      public static 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)";
67      public static String TABLE_SQL_DROP = "drop table JournalContentSearch";
68      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
69                  "xss.allow.com.liferay.portlet.journal.model.JournalContentSearch"),
70              XSS_ALLOW);
71      public static boolean XSS_ALLOW_PORTLETID = GetterUtil.getBoolean(PropsUtil.get(
72                  "xss.allow.com.liferay.portlet.journal.model.JournalContentSearch.portletId"),
73              XSS_ALLOW_BY_MODEL);
74      public static boolean XSS_ALLOW_ARTICLEID = GetterUtil.getBoolean(PropsUtil.get(
75                  "xss.allow.com.liferay.portlet.journal.model.JournalContentSearch.articleId"),
76              XSS_ALLOW_BY_MODEL);
77      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
78                  "lock.expiration.time.com.liferay.portlet.journal.model.JournalContentSearchModel"));
79  
80      public JournalContentSearchModelImpl() {
81      }
82  
83      public long getPrimaryKey() {
84          return _contentSearchId;
85      }
86  
87      public void setPrimaryKey(long pk) {
88          setContentSearchId(pk);
89      }
90  
91      public Serializable getPrimaryKeyObj() {
92          return new Long(_contentSearchId);
93      }
94  
95      public long getContentSearchId() {
96          return _contentSearchId;
97      }
98  
99      public void setContentSearchId(long contentSearchId) {
100         if (contentSearchId != _contentSearchId) {
101             _contentSearchId = contentSearchId;
102         }
103     }
104 
105     public long getGroupId() {
106         return _groupId;
107     }
108 
109     public void setGroupId(long groupId) {
110         if (groupId != _groupId) {
111             _groupId = groupId;
112         }
113     }
114 
115     public long getCompanyId() {
116         return _companyId;
117     }
118 
119     public void setCompanyId(long companyId) {
120         if (companyId != _companyId) {
121             _companyId = companyId;
122         }
123     }
124 
125     public boolean getPrivateLayout() {
126         return _privateLayout;
127     }
128 
129     public boolean isPrivateLayout() {
130         return _privateLayout;
131     }
132 
133     public void setPrivateLayout(boolean privateLayout) {
134         if (privateLayout != _privateLayout) {
135             _privateLayout = privateLayout;
136         }
137     }
138 
139     public long getLayoutId() {
140         return _layoutId;
141     }
142 
143     public void setLayoutId(long layoutId) {
144         if (layoutId != _layoutId) {
145             _layoutId = layoutId;
146         }
147     }
148 
149     public String getPortletId() {
150         return GetterUtil.getString(_portletId);
151     }
152 
153     public void setPortletId(String portletId) {
154         if (((portletId == null) && (_portletId != null)) ||
155                 ((portletId != null) && (_portletId == null)) ||
156                 ((portletId != null) && (_portletId != null) &&
157                 !portletId.equals(_portletId))) {
158             if (!XSS_ALLOW_PORTLETID) {
159                 portletId = XSSUtil.strip(portletId);
160             }
161 
162             _portletId = portletId;
163         }
164     }
165 
166     public String getArticleId() {
167         return GetterUtil.getString(_articleId);
168     }
169 
170     public void setArticleId(String articleId) {
171         if (((articleId == null) && (_articleId != null)) ||
172                 ((articleId != null) && (_articleId == null)) ||
173                 ((articleId != null) && (_articleId != null) &&
174                 !articleId.equals(_articleId))) {
175             if (!XSS_ALLOW_ARTICLEID) {
176                 articleId = XSSUtil.strip(articleId);
177             }
178 
179             _articleId = articleId;
180         }
181     }
182 
183     public Object clone() {
184         JournalContentSearchImpl clone = new JournalContentSearchImpl();
185         clone.setContentSearchId(getContentSearchId());
186         clone.setGroupId(getGroupId());
187         clone.setCompanyId(getCompanyId());
188         clone.setPrivateLayout(getPrivateLayout());
189         clone.setLayoutId(getLayoutId());
190         clone.setPortletId(getPortletId());
191         clone.setArticleId(getArticleId());
192 
193         return clone;
194     }
195 
196     public int compareTo(Object obj) {
197         if (obj == null) {
198             return -1;
199         }
200 
201         JournalContentSearchImpl journalContentSearch = (JournalContentSearchImpl)obj;
202         long pk = journalContentSearch.getPrimaryKey();
203 
204         if (getPrimaryKey() < pk) {
205             return -1;
206         }
207         else if (getPrimaryKey() > pk) {
208             return 1;
209         }
210         else {
211             return 0;
212         }
213     }
214 
215     public boolean equals(Object obj) {
216         if (obj == null) {
217             return false;
218         }
219 
220         JournalContentSearchImpl journalContentSearch = null;
221 
222         try {
223             journalContentSearch = (JournalContentSearchImpl)obj;
224         }
225         catch (ClassCastException cce) {
226             return false;
227         }
228 
229         long pk = journalContentSearch.getPrimaryKey();
230 
231         if (getPrimaryKey() == pk) {
232             return true;
233         }
234         else {
235             return false;
236         }
237     }
238 
239     public int hashCode() {
240         return (int)getPrimaryKey();
241     }
242 
243     private long _contentSearchId;
244     private long _groupId;
245     private long _companyId;
246     private boolean _privateLayout;
247     private long _layoutId;
248     private String _portletId;
249     private String _articleId;
250 }