1
22
23 package com.liferay.portlet.bookmarks.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.model.impl.BaseModelImpl;
29 import com.liferay.portal.util.PropsUtil;
30
31 import com.liferay.portlet.bookmarks.model.BookmarksEntry;
32 import com.liferay.portlet.bookmarks.model.BookmarksEntrySoap;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.ArrayList;
41 import java.util.Date;
42 import java.util.List;
43
44
64 public class BookmarksEntryModelImpl extends BaseModelImpl {
65 public static final String TABLE_NAME = "BookmarksEntry";
66 public static final Object[][] TABLE_COLUMNS = {
67 { "uuid_", new Integer(Types.VARCHAR) },
68
69
70 { "entryId", new Integer(Types.BIGINT) },
71
72
73 { "companyId", new Integer(Types.BIGINT) },
74
75
76 { "userId", new Integer(Types.BIGINT) },
77
78
79 { "createDate", new Integer(Types.TIMESTAMP) },
80
81
82 { "modifiedDate", new Integer(Types.TIMESTAMP) },
83
84
85 { "folderId", new Integer(Types.BIGINT) },
86
87
88 { "name", new Integer(Types.VARCHAR) },
89
90
91 { "url", new Integer(Types.VARCHAR) },
92
93
94 { "comments", new Integer(Types.VARCHAR) },
95
96
97 { "visits", new Integer(Types.INTEGER) },
98
99
100 { "priority", new Integer(Types.INTEGER) }
101 };
102 public static final String TABLE_SQL_CREATE = "create table BookmarksEntry (uuid_ VARCHAR(75) null,entryId LONG not null primary key,companyId LONG,userId LONG,createDate DATE null,modifiedDate DATE null,folderId LONG,name VARCHAR(300) null,url STRING null,comments STRING null,visits INTEGER,priority INTEGER)";
103 public static final String TABLE_SQL_DROP = "drop table BookmarksEntry";
104 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
105 "value.object.finder.cache.enabled.com.liferay.portlet.bookmarks.model.BookmarksEntry"),
106 true);
107
108 public static BookmarksEntry toModel(BookmarksEntrySoap soapModel) {
109 BookmarksEntry model = new BookmarksEntryImpl();
110
111 model.setUuid(soapModel.getUuid());
112 model.setEntryId(soapModel.getEntryId());
113 model.setCompanyId(soapModel.getCompanyId());
114 model.setUserId(soapModel.getUserId());
115 model.setCreateDate(soapModel.getCreateDate());
116 model.setModifiedDate(soapModel.getModifiedDate());
117 model.setFolderId(soapModel.getFolderId());
118 model.setName(soapModel.getName());
119 model.setUrl(soapModel.getUrl());
120 model.setComments(soapModel.getComments());
121 model.setVisits(soapModel.getVisits());
122 model.setPriority(soapModel.getPriority());
123
124 return model;
125 }
126
127 public static List<BookmarksEntry> toModels(BookmarksEntrySoap[] soapModels) {
128 List<BookmarksEntry> models = new ArrayList<BookmarksEntry>(soapModels.length);
129
130 for (BookmarksEntrySoap soapModel : soapModels) {
131 models.add(toModel(soapModel));
132 }
133
134 return models;
135 }
136
137 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
138 "lock.expiration.time.com.liferay.portlet.bookmarks.model.BookmarksEntry"));
139
140 public BookmarksEntryModelImpl() {
141 }
142
143 public long getPrimaryKey() {
144 return _entryId;
145 }
146
147 public void setPrimaryKey(long pk) {
148 setEntryId(pk);
149 }
150
151 public Serializable getPrimaryKeyObj() {
152 return new Long(_entryId);
153 }
154
155 public String getUuid() {
156 return GetterUtil.getString(_uuid);
157 }
158
159 public void setUuid(String uuid) {
160 if ((uuid != null) && (uuid != _uuid)) {
161 _uuid = uuid;
162 }
163 }
164
165 public long getEntryId() {
166 return _entryId;
167 }
168
169 public void setEntryId(long entryId) {
170 if (entryId != _entryId) {
171 _entryId = entryId;
172 }
173 }
174
175 public long getCompanyId() {
176 return _companyId;
177 }
178
179 public void setCompanyId(long companyId) {
180 if (companyId != _companyId) {
181 _companyId = companyId;
182 }
183 }
184
185 public long getUserId() {
186 return _userId;
187 }
188
189 public void setUserId(long userId) {
190 if (userId != _userId) {
191 _userId = userId;
192 }
193 }
194
195 public Date getCreateDate() {
196 return _createDate;
197 }
198
199 public void setCreateDate(Date createDate) {
200 if (((createDate == null) && (_createDate != null)) ||
201 ((createDate != null) && (_createDate == null)) ||
202 ((createDate != null) && (_createDate != null) &&
203 !createDate.equals(_createDate))) {
204 _createDate = createDate;
205 }
206 }
207
208 public Date getModifiedDate() {
209 return _modifiedDate;
210 }
211
212 public void setModifiedDate(Date modifiedDate) {
213 if (((modifiedDate == null) && (_modifiedDate != null)) ||
214 ((modifiedDate != null) && (_modifiedDate == null)) ||
215 ((modifiedDate != null) && (_modifiedDate != null) &&
216 !modifiedDate.equals(_modifiedDate))) {
217 _modifiedDate = modifiedDate;
218 }
219 }
220
221 public long getFolderId() {
222 return _folderId;
223 }
224
225 public void setFolderId(long folderId) {
226 if (folderId != _folderId) {
227 _folderId = folderId;
228 }
229 }
230
231 public String getName() {
232 return GetterUtil.getString(_name);
233 }
234
235 public void setName(String name) {
236 if (((name == null) && (_name != null)) ||
237 ((name != null) && (_name == null)) ||
238 ((name != null) && (_name != null) && !name.equals(_name))) {
239 _name = name;
240 }
241 }
242
243 public String getUrl() {
244 return GetterUtil.getString(_url);
245 }
246
247 public void setUrl(String url) {
248 if (((url == null) && (_url != null)) ||
249 ((url != null) && (_url == null)) ||
250 ((url != null) && (_url != null) && !url.equals(_url))) {
251 _url = url;
252 }
253 }
254
255 public String getComments() {
256 return GetterUtil.getString(_comments);
257 }
258
259 public void setComments(String comments) {
260 if (((comments == null) && (_comments != null)) ||
261 ((comments != null) && (_comments == null)) ||
262 ((comments != null) && (_comments != null) &&
263 !comments.equals(_comments))) {
264 _comments = comments;
265 }
266 }
267
268 public int getVisits() {
269 return _visits;
270 }
271
272 public void setVisits(int visits) {
273 if (visits != _visits) {
274 _visits = visits;
275 }
276 }
277
278 public int getPriority() {
279 return _priority;
280 }
281
282 public void setPriority(int priority) {
283 if (priority != _priority) {
284 _priority = priority;
285 }
286 }
287
288 public BookmarksEntry toEscapedModel() {
289 if (isEscapedModel()) {
290 return (BookmarksEntry)this;
291 }
292 else {
293 BookmarksEntry model = new BookmarksEntryImpl();
294
295 model.setEscapedModel(true);
296
297 model.setUuid(HtmlUtil.escape(getUuid()));
298 model.setEntryId(getEntryId());
299 model.setCompanyId(getCompanyId());
300 model.setUserId(getUserId());
301 model.setCreateDate(getCreateDate());
302 model.setModifiedDate(getModifiedDate());
303 model.setFolderId(getFolderId());
304 model.setName(HtmlUtil.escape(getName()));
305 model.setUrl(HtmlUtil.escape(getUrl()));
306 model.setComments(HtmlUtil.escape(getComments()));
307 model.setVisits(getVisits());
308 model.setPriority(getPriority());
309
310 model = (BookmarksEntry)Proxy.newProxyInstance(BookmarksEntry.class.getClassLoader(),
311 new Class[] { BookmarksEntry.class },
312 new ReadOnlyBeanHandler(model));
313
314 return model;
315 }
316 }
317
318 public Object clone() {
319 BookmarksEntryImpl clone = new BookmarksEntryImpl();
320
321 clone.setUuid(getUuid());
322 clone.setEntryId(getEntryId());
323 clone.setCompanyId(getCompanyId());
324 clone.setUserId(getUserId());
325 clone.setCreateDate(getCreateDate());
326 clone.setModifiedDate(getModifiedDate());
327 clone.setFolderId(getFolderId());
328 clone.setName(getName());
329 clone.setUrl(getUrl());
330 clone.setComments(getComments());
331 clone.setVisits(getVisits());
332 clone.setPriority(getPriority());
333
334 return clone;
335 }
336
337 public int compareTo(Object obj) {
338 if (obj == null) {
339 return -1;
340 }
341
342 BookmarksEntryImpl bookmarksEntry = (BookmarksEntryImpl)obj;
343
344 int value = 0;
345
346 if (getFolderId() < bookmarksEntry.getFolderId()) {
347 value = -1;
348 }
349 else if (getFolderId() > bookmarksEntry.getFolderId()) {
350 value = 1;
351 }
352 else {
353 value = 0;
354 }
355
356 if (value != 0) {
357 return value;
358 }
359
360 value = getName().toLowerCase()
361 .compareTo(bookmarksEntry.getName().toLowerCase());
362
363 if (value != 0) {
364 return value;
365 }
366
367 return 0;
368 }
369
370 public boolean equals(Object obj) {
371 if (obj == null) {
372 return false;
373 }
374
375 BookmarksEntryImpl bookmarksEntry = null;
376
377 try {
378 bookmarksEntry = (BookmarksEntryImpl)obj;
379 }
380 catch (ClassCastException cce) {
381 return false;
382 }
383
384 long pk = bookmarksEntry.getPrimaryKey();
385
386 if (getPrimaryKey() == pk) {
387 return true;
388 }
389 else {
390 return false;
391 }
392 }
393
394 public int hashCode() {
395 return (int)getPrimaryKey();
396 }
397
398 private String _uuid;
399 private long _entryId;
400 private long _companyId;
401 private long _userId;
402 private Date _createDate;
403 private Date _modifiedDate;
404 private long _folderId;
405 private String _name;
406 private String _url;
407 private String _comments;
408 private int _visits;
409 private int _priority;
410 }