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