1
22
23 package com.liferay.portlet.social.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.kernel.util.HtmlUtil;
28 import com.liferay.portal.kernel.util.StringPool;
29 import com.liferay.portal.model.impl.BaseModelImpl;
30 import com.liferay.portal.util.PortalUtil;
31
32 import com.liferay.portlet.expando.model.ExpandoBridge;
33 import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
34 import com.liferay.portlet.social.model.SocialRequest;
35 import com.liferay.portlet.social.model.SocialRequestSoap;
36
37 import java.io.Serializable;
38
39 import java.lang.reflect.Proxy;
40
41 import java.sql.Types;
42
43 import java.util.ArrayList;
44 import java.util.Date;
45 import java.util.List;
46
47
67 public class SocialRequestModelImpl extends BaseModelImpl {
68 public static final String TABLE_NAME = "SocialRequest";
69 public static final Object[][] TABLE_COLUMNS = {
70 { "uuid_", new Integer(Types.VARCHAR) },
71
72
73 { "requestId", new Integer(Types.BIGINT) },
74
75
76 { "groupId", new Integer(Types.BIGINT) },
77
78
79 { "companyId", new Integer(Types.BIGINT) },
80
81
82 { "userId", new Integer(Types.BIGINT) },
83
84
85 { "createDate", new Integer(Types.TIMESTAMP) },
86
87
88 { "modifiedDate", new Integer(Types.TIMESTAMP) },
89
90
91 { "classNameId", new Integer(Types.BIGINT) },
92
93
94 { "classPK", new Integer(Types.BIGINT) },
95
96
97 { "type_", new Integer(Types.INTEGER) },
98
99
100 { "extraData", new Integer(Types.VARCHAR) },
101
102
103 { "receiverUserId", new Integer(Types.BIGINT) },
104
105
106 { "status", new Integer(Types.INTEGER) }
107 };
108 public static final String TABLE_SQL_CREATE = "create table SocialRequest (uuid_ VARCHAR(75) null,requestId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,type_ INTEGER,extraData STRING null,receiverUserId LONG,status INTEGER)";
109 public static final String TABLE_SQL_DROP = "drop table SocialRequest";
110 public static final String DATA_SOURCE = "liferayDataSource";
111 public static final String SESSION_FACTORY = "liferaySessionFactory";
112 public static final String TX_MANAGER = "liferayTransactionManager";
113 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
114 "value.object.finder.cache.enabled.com.liferay.portlet.social.model.SocialRequest"),
115 true);
116
117 public static SocialRequest toModel(SocialRequestSoap soapModel) {
118 SocialRequest model = new SocialRequestImpl();
119
120 model.setUuid(soapModel.getUuid());
121 model.setRequestId(soapModel.getRequestId());
122 model.setGroupId(soapModel.getGroupId());
123 model.setCompanyId(soapModel.getCompanyId());
124 model.setUserId(soapModel.getUserId());
125 model.setCreateDate(soapModel.getCreateDate());
126 model.setModifiedDate(soapModel.getModifiedDate());
127 model.setClassNameId(soapModel.getClassNameId());
128 model.setClassPK(soapModel.getClassPK());
129 model.setType(soapModel.getType());
130 model.setExtraData(soapModel.getExtraData());
131 model.setReceiverUserId(soapModel.getReceiverUserId());
132 model.setStatus(soapModel.getStatus());
133
134 return model;
135 }
136
137 public static List<SocialRequest> toModels(SocialRequestSoap[] soapModels) {
138 List<SocialRequest> models = new ArrayList<SocialRequest>(soapModels.length);
139
140 for (SocialRequestSoap soapModel : soapModels) {
141 models.add(toModel(soapModel));
142 }
143
144 return models;
145 }
146
147 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
148 "lock.expiration.time.com.liferay.portlet.social.model.SocialRequest"));
149
150 public SocialRequestModelImpl() {
151 }
152
153 public long getPrimaryKey() {
154 return _requestId;
155 }
156
157 public void setPrimaryKey(long pk) {
158 setRequestId(pk);
159 }
160
161 public Serializable getPrimaryKeyObj() {
162 return new Long(_requestId);
163 }
164
165 public String getUuid() {
166 return GetterUtil.getString(_uuid);
167 }
168
169 public void setUuid(String uuid) {
170 if ((uuid != null) && (uuid != _uuid)) {
171 _uuid = uuid;
172 }
173 }
174
175 public long getRequestId() {
176 return _requestId;
177 }
178
179 public void setRequestId(long requestId) {
180 if (requestId != _requestId) {
181 _requestId = requestId;
182 }
183 }
184
185 public long getGroupId() {
186 return _groupId;
187 }
188
189 public void setGroupId(long groupId) {
190 if (groupId != _groupId) {
191 _groupId = groupId;
192 }
193 }
194
195 public long getCompanyId() {
196 return _companyId;
197 }
198
199 public void setCompanyId(long companyId) {
200 if (companyId != _companyId) {
201 _companyId = companyId;
202 }
203 }
204
205 public long getUserId() {
206 return _userId;
207 }
208
209 public void setUserId(long userId) {
210 if (userId != _userId) {
211 _userId = userId;
212 }
213 }
214
215 public Date getCreateDate() {
216 return _createDate;
217 }
218
219 public void setCreateDate(Date createDate) {
220 if (((createDate == null) && (_createDate != null)) ||
221 ((createDate != null) && (_createDate == null)) ||
222 ((createDate != null) && (_createDate != null) &&
223 !createDate.equals(_createDate))) {
224 _createDate = createDate;
225 }
226 }
227
228 public Date getModifiedDate() {
229 return _modifiedDate;
230 }
231
232 public void setModifiedDate(Date modifiedDate) {
233 if (((modifiedDate == null) && (_modifiedDate != null)) ||
234 ((modifiedDate != null) && (_modifiedDate == null)) ||
235 ((modifiedDate != null) && (_modifiedDate != null) &&
236 !modifiedDate.equals(_modifiedDate))) {
237 _modifiedDate = modifiedDate;
238 }
239 }
240
241 public String getClassName() {
242 if (getClassNameId() <= 0) {
243 return StringPool.BLANK;
244 }
245
246 return PortalUtil.getClassName(getClassNameId());
247 }
248
249 public long getClassNameId() {
250 return _classNameId;
251 }
252
253 public void setClassNameId(long classNameId) {
254 if (classNameId != _classNameId) {
255 _classNameId = classNameId;
256 }
257 }
258
259 public long getClassPK() {
260 return _classPK;
261 }
262
263 public void setClassPK(long classPK) {
264 if (classPK != _classPK) {
265 _classPK = classPK;
266 }
267 }
268
269 public int getType() {
270 return _type;
271 }
272
273 public void setType(int type) {
274 if (type != _type) {
275 _type = type;
276 }
277 }
278
279 public String getExtraData() {
280 return GetterUtil.getString(_extraData);
281 }
282
283 public void setExtraData(String extraData) {
284 if (((extraData == null) && (_extraData != null)) ||
285 ((extraData != null) && (_extraData == null)) ||
286 ((extraData != null) && (_extraData != null) &&
287 !extraData.equals(_extraData))) {
288 _extraData = extraData;
289 }
290 }
291
292 public long getReceiverUserId() {
293 return _receiverUserId;
294 }
295
296 public void setReceiverUserId(long receiverUserId) {
297 if (receiverUserId != _receiverUserId) {
298 _receiverUserId = receiverUserId;
299 }
300 }
301
302 public int getStatus() {
303 return _status;
304 }
305
306 public void setStatus(int status) {
307 if (status != _status) {
308 _status = status;
309 }
310 }
311
312 public SocialRequest toEscapedModel() {
313 if (isEscapedModel()) {
314 return (SocialRequest)this;
315 }
316 else {
317 SocialRequest model = new SocialRequestImpl();
318
319 model.setNew(isNew());
320 model.setEscapedModel(true);
321
322 model.setUuid(HtmlUtil.escape(getUuid()));
323 model.setRequestId(getRequestId());
324 model.setGroupId(getGroupId());
325 model.setCompanyId(getCompanyId());
326 model.setUserId(getUserId());
327 model.setCreateDate(getCreateDate());
328 model.setModifiedDate(getModifiedDate());
329 model.setClassNameId(getClassNameId());
330 model.setClassPK(getClassPK());
331 model.setType(getType());
332 model.setExtraData(HtmlUtil.escape(getExtraData()));
333 model.setReceiverUserId(getReceiverUserId());
334 model.setStatus(getStatus());
335
336 model = (SocialRequest)Proxy.newProxyInstance(SocialRequest.class.getClassLoader(),
337 new Class[] { SocialRequest.class },
338 new ReadOnlyBeanHandler(model));
339
340 return model;
341 }
342 }
343
344 public ExpandoBridge getExpandoBridge() {
345 if (_expandoBridge == null) {
346 _expandoBridge = new ExpandoBridgeImpl(SocialRequest.class.getName(),
347 getPrimaryKey());
348 }
349
350 return _expandoBridge;
351 }
352
353 public Object clone() {
354 SocialRequestImpl clone = new SocialRequestImpl();
355
356 clone.setUuid(getUuid());
357 clone.setRequestId(getRequestId());
358 clone.setGroupId(getGroupId());
359 clone.setCompanyId(getCompanyId());
360 clone.setUserId(getUserId());
361 clone.setCreateDate(getCreateDate());
362 clone.setModifiedDate(getModifiedDate());
363 clone.setClassNameId(getClassNameId());
364 clone.setClassPK(getClassPK());
365 clone.setType(getType());
366 clone.setExtraData(getExtraData());
367 clone.setReceiverUserId(getReceiverUserId());
368 clone.setStatus(getStatus());
369
370 return clone;
371 }
372
373 public int compareTo(Object obj) {
374 if (obj == null) {
375 return -1;
376 }
377
378 SocialRequestImpl socialRequest = (SocialRequestImpl)obj;
379
380 int value = 0;
381
382 if (getRequestId() < socialRequest.getRequestId()) {
383 value = -1;
384 }
385 else if (getRequestId() > socialRequest.getRequestId()) {
386 value = 1;
387 }
388 else {
389 value = 0;
390 }
391
392 value = value * -1;
393
394 if (value != 0) {
395 return value;
396 }
397
398 return 0;
399 }
400
401 public boolean equals(Object obj) {
402 if (obj == null) {
403 return false;
404 }
405
406 SocialRequestImpl socialRequest = null;
407
408 try {
409 socialRequest = (SocialRequestImpl)obj;
410 }
411 catch (ClassCastException cce) {
412 return false;
413 }
414
415 long pk = socialRequest.getPrimaryKey();
416
417 if (getPrimaryKey() == pk) {
418 return true;
419 }
420 else {
421 return false;
422 }
423 }
424
425 public int hashCode() {
426 return (int)getPrimaryKey();
427 }
428
429 private String _uuid;
430 private long _requestId;
431 private long _groupId;
432 private long _companyId;
433 private long _userId;
434 private Date _createDate;
435 private Date _modifiedDate;
436 private long _classNameId;
437 private long _classPK;
438 private int _type;
439 private String _extraData;
440 private long _receiverUserId;
441 private int _status;
442 private transient ExpandoBridge _expandoBridge;
443 }