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.BookmarksFolder;
31 import com.liferay.portlet.bookmarks.model.BookmarksFolderSoap;
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
65 public class BookmarksFolderModelImpl extends BaseModelImpl {
66 public static final String TABLE_NAME = "BookmarksFolder";
67 public static final Object[][] TABLE_COLUMNS = {
68 { "uuid_", new Integer(Types.VARCHAR) },
69
70
71 { "folderId", new Integer(Types.BIGINT) },
72
73
74 { "groupId", new Integer(Types.BIGINT) },
75
76
77 { "companyId", new Integer(Types.BIGINT) },
78
79
80 { "userId", new Integer(Types.BIGINT) },
81
82
83 { "createDate", new Integer(Types.TIMESTAMP) },
84
85
86 { "modifiedDate", new Integer(Types.TIMESTAMP) },
87
88
89 { "parentFolderId", new Integer(Types.BIGINT) },
90
91
92 { "name", new Integer(Types.VARCHAR) },
93
94
95 { "description", new Integer(Types.VARCHAR) }
96 };
97 public static final String TABLE_SQL_CREATE = "create table BookmarksFolder (uuid_ VARCHAR(75) null,folderId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,createDate DATE null,modifiedDate DATE null,parentFolderId LONG,name VARCHAR(75) null,description STRING null)";
98 public static final String TABLE_SQL_DROP = "drop table BookmarksFolder";
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.portlet.bookmarks.model.BookmarksFolder"),
104 true);
105
106 public static BookmarksFolder toModel(BookmarksFolderSoap soapModel) {
107 BookmarksFolder model = new BookmarksFolderImpl();
108
109 model.setUuid(soapModel.getUuid());
110 model.setFolderId(soapModel.getFolderId());
111 model.setGroupId(soapModel.getGroupId());
112 model.setCompanyId(soapModel.getCompanyId());
113 model.setUserId(soapModel.getUserId());
114 model.setCreateDate(soapModel.getCreateDate());
115 model.setModifiedDate(soapModel.getModifiedDate());
116 model.setParentFolderId(soapModel.getParentFolderId());
117 model.setName(soapModel.getName());
118 model.setDescription(soapModel.getDescription());
119
120 return model;
121 }
122
123 public static List<BookmarksFolder> toModels(
124 BookmarksFolderSoap[] soapModels) {
125 List<BookmarksFolder> models = new ArrayList<BookmarksFolder>(soapModels.length);
126
127 for (BookmarksFolderSoap 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.portlet.bookmarks.model.BookmarksFolder"));
136
137 public BookmarksFolderModelImpl() {
138 }
139
140 public long getPrimaryKey() {
141 return _folderId;
142 }
143
144 public void setPrimaryKey(long pk) {
145 setFolderId(pk);
146 }
147
148 public Serializable getPrimaryKeyObj() {
149 return new Long(_folderId);
150 }
151
152 public String getUuid() {
153 return GetterUtil.getString(_uuid);
154 }
155
156 public void setUuid(String uuid) {
157 if ((uuid != null) && (uuid != _uuid)) {
158 _uuid = uuid;
159 }
160 }
161
162 public long getFolderId() {
163 return _folderId;
164 }
165
166 public void setFolderId(long folderId) {
167 if (folderId != _folderId) {
168 _folderId = folderId;
169 }
170 }
171
172 public long getGroupId() {
173 return _groupId;
174 }
175
176 public void setGroupId(long groupId) {
177 if (groupId != _groupId) {
178 _groupId = groupId;
179 }
180 }
181
182 public long getCompanyId() {
183 return _companyId;
184 }
185
186 public void setCompanyId(long companyId) {
187 if (companyId != _companyId) {
188 _companyId = companyId;
189 }
190 }
191
192 public long getUserId() {
193 return _userId;
194 }
195
196 public void setUserId(long userId) {
197 if (userId != _userId) {
198 _userId = userId;
199 }
200 }
201
202 public Date getCreateDate() {
203 return _createDate;
204 }
205
206 public void setCreateDate(Date createDate) {
207 if (((createDate == null) && (_createDate != null)) ||
208 ((createDate != null) && (_createDate == null)) ||
209 ((createDate != null) && (_createDate != null) &&
210 !createDate.equals(_createDate))) {
211 _createDate = createDate;
212 }
213 }
214
215 public Date getModifiedDate() {
216 return _modifiedDate;
217 }
218
219 public void setModifiedDate(Date modifiedDate) {
220 if (((modifiedDate == null) && (_modifiedDate != null)) ||
221 ((modifiedDate != null) && (_modifiedDate == null)) ||
222 ((modifiedDate != null) && (_modifiedDate != null) &&
223 !modifiedDate.equals(_modifiedDate))) {
224 _modifiedDate = modifiedDate;
225 }
226 }
227
228 public long getParentFolderId() {
229 return _parentFolderId;
230 }
231
232 public void setParentFolderId(long parentFolderId) {
233 if (parentFolderId != _parentFolderId) {
234 _parentFolderId = parentFolderId;
235 }
236 }
237
238 public String getName() {
239 return GetterUtil.getString(_name);
240 }
241
242 public void setName(String name) {
243 if (((name == null) && (_name != null)) ||
244 ((name != null) && (_name == null)) ||
245 ((name != null) && (_name != null) && !name.equals(_name))) {
246 _name = name;
247 }
248 }
249
250 public String getDescription() {
251 return GetterUtil.getString(_description);
252 }
253
254 public void setDescription(String description) {
255 if (((description == null) && (_description != null)) ||
256 ((description != null) && (_description == null)) ||
257 ((description != null) && (_description != null) &&
258 !description.equals(_description))) {
259 _description = description;
260 }
261 }
262
263 public BookmarksFolder toEscapedModel() {
264 if (isEscapedModel()) {
265 return (BookmarksFolder)this;
266 }
267 else {
268 BookmarksFolder model = new BookmarksFolderImpl();
269
270 model.setNew(isNew());
271 model.setEscapedModel(true);
272
273 model.setUuid(HtmlUtil.escape(getUuid()));
274 model.setFolderId(getFolderId());
275 model.setGroupId(getGroupId());
276 model.setCompanyId(getCompanyId());
277 model.setUserId(getUserId());
278 model.setCreateDate(getCreateDate());
279 model.setModifiedDate(getModifiedDate());
280 model.setParentFolderId(getParentFolderId());
281 model.setName(HtmlUtil.escape(getName()));
282 model.setDescription(HtmlUtil.escape(getDescription()));
283
284 model = (BookmarksFolder)Proxy.newProxyInstance(BookmarksFolder.class.getClassLoader(),
285 new Class[] { BookmarksFolder.class },
286 new ReadOnlyBeanHandler(model));
287
288 return model;
289 }
290 }
291
292 public ExpandoBridge getExpandoBridge() {
293 if (_expandoBridge == null) {
294 _expandoBridge = new ExpandoBridgeImpl(BookmarksFolder.class.getName(),
295 getPrimaryKey());
296 }
297
298 return _expandoBridge;
299 }
300
301 public Object clone() {
302 BookmarksFolderImpl clone = new BookmarksFolderImpl();
303
304 clone.setUuid(getUuid());
305 clone.setFolderId(getFolderId());
306 clone.setGroupId(getGroupId());
307 clone.setCompanyId(getCompanyId());
308 clone.setUserId(getUserId());
309 clone.setCreateDate(getCreateDate());
310 clone.setModifiedDate(getModifiedDate());
311 clone.setParentFolderId(getParentFolderId());
312 clone.setName(getName());
313 clone.setDescription(getDescription());
314
315 return clone;
316 }
317
318 public int compareTo(Object obj) {
319 if (obj == null) {
320 return -1;
321 }
322
323 BookmarksFolderImpl bookmarksFolder = (BookmarksFolderImpl)obj;
324
325 int value = 0;
326
327 if (getParentFolderId() < bookmarksFolder.getParentFolderId()) {
328 value = -1;
329 }
330 else if (getParentFolderId() > bookmarksFolder.getParentFolderId()) {
331 value = 1;
332 }
333 else {
334 value = 0;
335 }
336
337 if (value != 0) {
338 return value;
339 }
340
341 value = getName().toLowerCase()
342 .compareTo(bookmarksFolder.getName().toLowerCase());
343
344 if (value != 0) {
345 return value;
346 }
347
348 return 0;
349 }
350
351 public boolean equals(Object obj) {
352 if (obj == null) {
353 return false;
354 }
355
356 BookmarksFolderImpl bookmarksFolder = null;
357
358 try {
359 bookmarksFolder = (BookmarksFolderImpl)obj;
360 }
361 catch (ClassCastException cce) {
362 return false;
363 }
364
365 long pk = bookmarksFolder.getPrimaryKey();
366
367 if (getPrimaryKey() == pk) {
368 return true;
369 }
370 else {
371 return false;
372 }
373 }
374
375 public int hashCode() {
376 return (int)getPrimaryKey();
377 }
378
379 private String _uuid;
380 private long _folderId;
381 private long _groupId;
382 private long _companyId;
383 private long _userId;
384 private Date _createDate;
385 private Date _modifiedDate;
386 private long _parentFolderId;
387 private String _name;
388 private String _description;
389 private transient ExpandoBridge _expandoBridge;
390 }