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