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