1
19
20 package com.liferay.portlet.bookmarks.model.impl;
21
22 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23 import com.liferay.portal.kernel.util.GetterUtil;
24 import com.liferay.portal.kernel.util.HtmlUtil;
25 import com.liferay.portal.model.impl.BaseModelImpl;
26
27 import com.liferay.portlet.bookmarks.model.BookmarksEntry;
28 import com.liferay.portlet.bookmarks.model.BookmarksEntrySoap;
29
30 import java.io.Serializable;
31
32 import java.lang.reflect.Proxy;
33
34 import java.sql.Types;
35
36 import java.util.ArrayList;
37 import java.util.Date;
38 import java.util.List;
39
40
60 public class BookmarksEntryModelImpl extends BaseModelImpl {
61 public static final String TABLE_NAME = "BookmarksEntry";
62 public static final Object[][] TABLE_COLUMNS = {
63 { "uuid_", new Integer(Types.VARCHAR) },
64
65
66 { "entryId", new Integer(Types.BIGINT) },
67
68
69 { "companyId", new Integer(Types.BIGINT) },
70
71
72 { "userId", new Integer(Types.BIGINT) },
73
74
75 { "createDate", new Integer(Types.TIMESTAMP) },
76
77
78 { "modifiedDate", new Integer(Types.TIMESTAMP) },
79
80
81 { "folderId", new Integer(Types.BIGINT) },
82
83
84 { "name", new Integer(Types.VARCHAR) },
85
86
87 { "url", new Integer(Types.VARCHAR) },
88
89
90 { "comments", new Integer(Types.VARCHAR) },
91
92
93 { "visits", new Integer(Types.INTEGER) },
94
95
96 { "priority", new Integer(Types.INTEGER) }
97 };
98 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)";
99 public static final String TABLE_SQL_DROP = "drop table BookmarksEntry";
100 public static final String DATA_SOURCE = "liferayDataSource";
101 public static final String SESSION_FACTORY = "liferaySessionFactory";
102 public static final String TX_MANAGER = "liferayTransactionManager";
103 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
104 "value.object.finder.cache.enabled.com.liferay.portlet.bookmarks.model.BookmarksEntry"),
105 true);
106
107 public static BookmarksEntry toModel(BookmarksEntrySoap soapModel) {
108 BookmarksEntry model = new BookmarksEntryImpl();
109
110 model.setUuid(soapModel.getUuid());
111 model.setEntryId(soapModel.getEntryId());
112 model.setCompanyId(soapModel.getCompanyId());
113 model.setUserId(soapModel.getUserId());
114 model.setCreateDate(soapModel.getCreateDate());
115 model.setModifiedDate(soapModel.getModifiedDate());
116 model.setFolderId(soapModel.getFolderId());
117 model.setName(soapModel.getName());
118 model.setUrl(soapModel.getUrl());
119 model.setComments(soapModel.getComments());
120 model.setVisits(soapModel.getVisits());
121 model.setPriority(soapModel.getPriority());
122
123 return model;
124 }
125
126 public static List<BookmarksEntry> toModels(BookmarksEntrySoap[] soapModels) {
127 List<BookmarksEntry> models = new ArrayList<BookmarksEntry>(soapModels.length);
128
129 for (BookmarksEntrySoap soapModel : soapModels) {
130 models.add(toModel(soapModel));
131 }
132
133 return models;
134 }
135
136 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
137 "lock.expiration.time.com.liferay.portlet.bookmarks.model.BookmarksEntry"));
138
139 public BookmarksEntryModelImpl() {
140 }
141
142 public long getPrimaryKey() {
143 return _entryId;
144 }
145
146 public void setPrimaryKey(long pk) {
147 setEntryId(pk);
148 }
149
150 public Serializable getPrimaryKeyObj() {
151 return new Long(_entryId);
152 }
153
154 public String getUuid() {
155 return GetterUtil.getString(_uuid);
156 }
157
158 public void setUuid(String uuid) {
159 if ((uuid != null) && (uuid != _uuid)) {
160 _uuid = uuid;
161 }
162 }
163
164 public long getEntryId() {
165 return _entryId;
166 }
167
168 public void setEntryId(long entryId) {
169 if (entryId != _entryId) {
170 _entryId = entryId;
171 }
172 }
173
174 public long getCompanyId() {
175 return _companyId;
176 }
177
178 public void setCompanyId(long companyId) {
179 if (companyId != _companyId) {
180 _companyId = companyId;
181 }
182 }
183
184 public long getUserId() {
185 return _userId;
186 }
187
188 public void setUserId(long userId) {
189 if (userId != _userId) {
190 _userId = userId;
191 }
192 }
193
194 public Date getCreateDate() {
195 return _createDate;
196 }
197
198 public void setCreateDate(Date createDate) {
199 if (((createDate == null) && (_createDate != null)) ||
200 ((createDate != null) && (_createDate == null)) ||
201 ((createDate != null) && (_createDate != null) &&
202 !createDate.equals(_createDate))) {
203 _createDate = createDate;
204 }
205 }
206
207 public Date getModifiedDate() {
208 return _modifiedDate;
209 }
210
211 public void setModifiedDate(Date modifiedDate) {
212 if (((modifiedDate == null) && (_modifiedDate != null)) ||
213 ((modifiedDate != null) && (_modifiedDate == null)) ||
214 ((modifiedDate != null) && (_modifiedDate != null) &&
215 !modifiedDate.equals(_modifiedDate))) {
216 _modifiedDate = modifiedDate;
217 }
218 }
219
220 public long getFolderId() {
221 return _folderId;
222 }
223
224 public void setFolderId(long folderId) {
225 if (folderId != _folderId) {
226 _folderId = folderId;
227 }
228 }
229
230 public String getName() {
231 return GetterUtil.getString(_name);
232 }
233
234 public void setName(String name) {
235 if (((name == null) && (_name != null)) ||
236 ((name != null) && (_name == null)) ||
237 ((name != null) && (_name != null) && !name.equals(_name))) {
238 _name = name;
239 }
240 }
241
242 public String getUrl() {
243 return GetterUtil.getString(_url);
244 }
245
246 public void setUrl(String url) {
247 if (((url == null) && (_url != null)) ||
248 ((url != null) && (_url == null)) ||
249 ((url != null) && (_url != null) && !url.equals(_url))) {
250 _url = url;
251 }
252 }
253
254 public String getComments() {
255 return GetterUtil.getString(_comments);
256 }
257
258 public void setComments(String comments) {
259 if (((comments == null) && (_comments != null)) ||
260 ((comments != null) && (_comments == null)) ||
261 ((comments != null) && (_comments != null) &&
262 !comments.equals(_comments))) {
263 _comments = comments;
264 }
265 }
266
267 public int getVisits() {
268 return _visits;
269 }
270
271 public void setVisits(int visits) {
272 if (visits != _visits) {
273 _visits = visits;
274 }
275 }
276
277 public int getPriority() {
278 return _priority;
279 }
280
281 public void setPriority(int priority) {
282 if (priority != _priority) {
283 _priority = priority;
284 }
285 }
286
287 public BookmarksEntry toEscapedModel() {
288 if (isEscapedModel()) {
289 return (BookmarksEntry)this;
290 }
291 else {
292 BookmarksEntry model = new BookmarksEntryImpl();
293
294 model.setNew(isNew());
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 }