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