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.portal.model.impl;
24  
25  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26  import com.liferay.portal.kernel.util.DateUtil;
27  import com.liferay.portal.kernel.util.GetterUtil;
28  import com.liferay.portal.model.MembershipRequest;
29  import com.liferay.portal.util.PropsUtil;
30  
31  import com.liferay.util.Html;
32  
33  import java.io.Serializable;
34  
35  import java.lang.reflect.Proxy;
36  
37  import java.sql.Types;
38  
39  import java.util.Date;
40  
41  /**
42   * <a href="MembershipRequestModelImpl.java.html"><b><i>View Source</i></b></a>
43   *
44   * <p>
45   * ServiceBuilder generated this class. Modifications in this class will be
46   * overwritten the next time is generated.
47   * </p>
48   *
49   * <p>
50   * This class is a model that represents the <code>MembershipRequest</code> table
51   * in the database.
52   * </p>
53   *
54   * @author Brian Wing Shun Chan
55   *
56   * @see com.liferay.portal.service.model.MembershipRequest
57   * @see com.liferay.portal.service.model.MembershipRequestModel
58   * @see com.liferay.portal.service.model.impl.MembershipRequestImpl
59   *
60   */
61  public class MembershipRequestModelImpl extends BaseModelImpl {
62      public static final String TABLE_NAME = "MembershipRequest";
63      public static final Object[][] TABLE_COLUMNS = {
64              { "membershipRequestId", new Integer(Types.BIGINT) },
65              
66  
67              { "companyId", new Integer(Types.BIGINT) },
68              
69  
70              { "userId", new Integer(Types.BIGINT) },
71              
72  
73              { "createDate", new Integer(Types.TIMESTAMP) },
74              
75  
76              { "groupId", new Integer(Types.BIGINT) },
77              
78  
79              { "comments", new Integer(Types.VARCHAR) },
80              
81  
82              { "replyComments", new Integer(Types.VARCHAR) },
83              
84  
85              { "replyDate", new Integer(Types.TIMESTAMP) },
86              
87  
88              { "replierUserId", new Integer(Types.BIGINT) },
89              
90  
91              { "statusId", new Integer(Types.INTEGER) }
92          };
93      public static final String TABLE_SQL_CREATE = "create table MembershipRequest (membershipRequestId LONG not null primary key,companyId LONG,userId LONG,createDate DATE null,groupId LONG,comments STRING null,replyComments STRING null,replyDate DATE null,replierUserId LONG,statusId INTEGER)";
94      public static final String TABLE_SQL_DROP = "drop table MembershipRequest";
95      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
96                  "value.object.finder.cache.enabled.com.liferay.portal.model.MembershipRequest"),
97              true);
98      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
99                  "lock.expiration.time.com.liferay.portal.model.MembershipRequest"));
100 
101     public MembershipRequestModelImpl() {
102     }
103 
104     public long getPrimaryKey() {
105         return _membershipRequestId;
106     }
107 
108     public void setPrimaryKey(long pk) {
109         setMembershipRequestId(pk);
110     }
111 
112     public Serializable getPrimaryKeyObj() {
113         return new Long(_membershipRequestId);
114     }
115 
116     public long getMembershipRequestId() {
117         return _membershipRequestId;
118     }
119 
120     public void setMembershipRequestId(long membershipRequestId) {
121         if (membershipRequestId != _membershipRequestId) {
122             _membershipRequestId = membershipRequestId;
123         }
124     }
125 
126     public long getCompanyId() {
127         return _companyId;
128     }
129 
130     public void setCompanyId(long companyId) {
131         if (companyId != _companyId) {
132             _companyId = companyId;
133         }
134     }
135 
136     public long getUserId() {
137         return _userId;
138     }
139 
140     public void setUserId(long userId) {
141         if (userId != _userId) {
142             _userId = userId;
143         }
144     }
145 
146     public Date getCreateDate() {
147         return _createDate;
148     }
149 
150     public void setCreateDate(Date createDate) {
151         if (((createDate == null) && (_createDate != null)) ||
152                 ((createDate != null) && (_createDate == null)) ||
153                 ((createDate != null) && (_createDate != null) &&
154                 !createDate.equals(_createDate))) {
155             _createDate = createDate;
156         }
157     }
158 
159     public long getGroupId() {
160         return _groupId;
161     }
162 
163     public void setGroupId(long groupId) {
164         if (groupId != _groupId) {
165             _groupId = groupId;
166         }
167     }
168 
169     public String getComments() {
170         return GetterUtil.getString(_comments);
171     }
172 
173     public void setComments(String comments) {
174         if (((comments == null) && (_comments != null)) ||
175                 ((comments != null) && (_comments == null)) ||
176                 ((comments != null) && (_comments != null) &&
177                 !comments.equals(_comments))) {
178             _comments = comments;
179         }
180     }
181 
182     public String getReplyComments() {
183         return GetterUtil.getString(_replyComments);
184     }
185 
186     public void setReplyComments(String replyComments) {
187         if (((replyComments == null) && (_replyComments != null)) ||
188                 ((replyComments != null) && (_replyComments == null)) ||
189                 ((replyComments != null) && (_replyComments != null) &&
190                 !replyComments.equals(_replyComments))) {
191             _replyComments = replyComments;
192         }
193     }
194 
195     public Date getReplyDate() {
196         return _replyDate;
197     }
198 
199     public void setReplyDate(Date replyDate) {
200         if (((replyDate == null) && (_replyDate != null)) ||
201                 ((replyDate != null) && (_replyDate == null)) ||
202                 ((replyDate != null) && (_replyDate != null) &&
203                 !replyDate.equals(_replyDate))) {
204             _replyDate = replyDate;
205         }
206     }
207 
208     public long getReplierUserId() {
209         return _replierUserId;
210     }
211 
212     public void setReplierUserId(long replierUserId) {
213         if (replierUserId != _replierUserId) {
214             _replierUserId = replierUserId;
215         }
216     }
217 
218     public int getStatusId() {
219         return _statusId;
220     }
221 
222     public void setStatusId(int statusId) {
223         if (statusId != _statusId) {
224             _statusId = statusId;
225         }
226     }
227 
228     public MembershipRequest toEscapedModel() {
229         if (isEscapedModel()) {
230             return (MembershipRequest)this;
231         }
232         else {
233             MembershipRequest model = new MembershipRequestImpl();
234 
235             model.setEscapedModel(true);
236 
237             model.setMembershipRequestId(getMembershipRequestId());
238             model.setCompanyId(getCompanyId());
239             model.setUserId(getUserId());
240             model.setCreateDate(getCreateDate());
241             model.setGroupId(getGroupId());
242             model.setComments(Html.escape(getComments()));
243             model.setReplyComments(Html.escape(getReplyComments()));
244             model.setReplyDate(getReplyDate());
245             model.setReplierUserId(getReplierUserId());
246             model.setStatusId(getStatusId());
247 
248             model = (MembershipRequest)Proxy.newProxyInstance(MembershipRequest.class.getClassLoader(),
249                     new Class[] { MembershipRequest.class },
250                     new ReadOnlyBeanHandler(model));
251 
252             return model;
253         }
254     }
255 
256     public Object clone() {
257         MembershipRequestImpl clone = new MembershipRequestImpl();
258 
259         clone.setMembershipRequestId(getMembershipRequestId());
260         clone.setCompanyId(getCompanyId());
261         clone.setUserId(getUserId());
262         clone.setCreateDate(getCreateDate());
263         clone.setGroupId(getGroupId());
264         clone.setComments(getComments());
265         clone.setReplyComments(getReplyComments());
266         clone.setReplyDate(getReplyDate());
267         clone.setReplierUserId(getReplierUserId());
268         clone.setStatusId(getStatusId());
269 
270         return clone;
271     }
272 
273     public int compareTo(Object obj) {
274         if (obj == null) {
275             return -1;
276         }
277 
278         MembershipRequestImpl membershipRequest = (MembershipRequestImpl)obj;
279 
280         int value = 0;
281 
282         value = DateUtil.compareTo(getCreateDate(),
283                 membershipRequest.getCreateDate());
284 
285         value = value * -1;
286 
287         if (value != 0) {
288             return value;
289         }
290 
291         return 0;
292     }
293 
294     public boolean equals(Object obj) {
295         if (obj == null) {
296             return false;
297         }
298 
299         MembershipRequestImpl membershipRequest = null;
300 
301         try {
302             membershipRequest = (MembershipRequestImpl)obj;
303         }
304         catch (ClassCastException cce) {
305             return false;
306         }
307 
308         long pk = membershipRequest.getPrimaryKey();
309 
310         if (getPrimaryKey() == pk) {
311             return true;
312         }
313         else {
314             return false;
315         }
316     }
317 
318     public int hashCode() {
319         return (int)getPrimaryKey();
320     }
321 
322     private long _membershipRequestId;
323     private long _companyId;
324     private long _userId;
325     private Date _createDate;
326     private long _groupId;
327     private String _comments;
328     private String _replyComments;
329     private Date _replyDate;
330     private long _replierUserId;
331     private int _statusId;
332 }