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