1
22
23 package com.liferay.portlet.documentlibrary.model.impl;
24
25 import com.liferay.portal.kernel.util.GetterUtil;
26 import com.liferay.portal.model.impl.BaseModelImpl;
27 import com.liferay.portal.util.PropsUtil;
28
29 import com.liferay.util.XSSUtil;
30
31 import java.io.Serializable;
32
33 import java.sql.Types;
34
35 import java.util.Date;
36
37
57 public class DLFolderModelImpl extends BaseModelImpl {
58 public static String TABLE_NAME = "DLFolder";
59 public static Object[][] TABLE_COLUMNS = {
60 { "folderId", new Integer(Types.BIGINT) },
61 { "groupId", new Integer(Types.BIGINT) },
62 { "companyId", new Integer(Types.BIGINT) },
63 { "userId", new Integer(Types.BIGINT) },
64 { "userName", new Integer(Types.VARCHAR) },
65 { "createDate", new Integer(Types.TIMESTAMP) },
66 { "modifiedDate", new Integer(Types.TIMESTAMP) },
67 { "parentFolderId", new Integer(Types.BIGINT) },
68 { "name", new Integer(Types.VARCHAR) },
69 { "description", new Integer(Types.VARCHAR) },
70 { "lastPostDate", new Integer(Types.TIMESTAMP) }
71 };
72 public static String TABLE_SQL_CREATE = "create table DLFolder (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)";
73 public static String TABLE_SQL_DROP = "drop table DLFolder";
74 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
75 "xss.allow.com.liferay.portlet.documentlibrary.model.DLFolder"),
76 XSS_ALLOW);
77 public static boolean XSS_ALLOW_USERNAME = GetterUtil.getBoolean(PropsUtil.get(
78 "xss.allow.com.liferay.portlet.documentlibrary.model.DLFolder.userName"),
79 XSS_ALLOW_BY_MODEL);
80 public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
81 "xss.allow.com.liferay.portlet.documentlibrary.model.DLFolder.name"),
82 XSS_ALLOW_BY_MODEL);
83 public static boolean XSS_ALLOW_DESCRIPTION = GetterUtil.getBoolean(PropsUtil.get(
84 "xss.allow.com.liferay.portlet.documentlibrary.model.DLFolder.description"),
85 XSS_ALLOW_BY_MODEL);
86 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
87 "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFolderModel"));
88
89 public DLFolderModelImpl() {
90 }
91
92 public long getPrimaryKey() {
93 return _folderId;
94 }
95
96 public void setPrimaryKey(long pk) {
97 setFolderId(pk);
98 }
99
100 public Serializable getPrimaryKeyObj() {
101 return new Long(_folderId);
102 }
103
104 public long getFolderId() {
105 return _folderId;
106 }
107
108 public void setFolderId(long folderId) {
109 if (folderId != _folderId) {
110 _folderId = folderId;
111 }
112 }
113
114 public long getGroupId() {
115 return _groupId;
116 }
117
118 public void setGroupId(long groupId) {
119 if (groupId != _groupId) {
120 _groupId = groupId;
121 }
122 }
123
124 public long getCompanyId() {
125 return _companyId;
126 }
127
128 public void setCompanyId(long companyId) {
129 if (companyId != _companyId) {
130 _companyId = companyId;
131 }
132 }
133
134 public long getUserId() {
135 return _userId;
136 }
137
138 public void setUserId(long userId) {
139 if (userId != _userId) {
140 _userId = userId;
141 }
142 }
143
144 public String getUserName() {
145 return GetterUtil.getString(_userName);
146 }
147
148 public void setUserName(String userName) {
149 if (((userName == null) && (_userName != null)) ||
150 ((userName != null) && (_userName == null)) ||
151 ((userName != null) && (_userName != null) &&
152 !userName.equals(_userName))) {
153 if (!XSS_ALLOW_USERNAME) {
154 userName = XSSUtil.strip(userName);
155 }
156
157 _userName = userName;
158 }
159 }
160
161 public Date getCreateDate() {
162 return _createDate;
163 }
164
165 public void setCreateDate(Date createDate) {
166 if (((createDate == null) && (_createDate != null)) ||
167 ((createDate != null) && (_createDate == null)) ||
168 ((createDate != null) && (_createDate != null) &&
169 !createDate.equals(_createDate))) {
170 _createDate = createDate;
171 }
172 }
173
174 public Date getModifiedDate() {
175 return _modifiedDate;
176 }
177
178 public void setModifiedDate(Date modifiedDate) {
179 if (((modifiedDate == null) && (_modifiedDate != null)) ||
180 ((modifiedDate != null) && (_modifiedDate == null)) ||
181 ((modifiedDate != null) && (_modifiedDate != null) &&
182 !modifiedDate.equals(_modifiedDate))) {
183 _modifiedDate = modifiedDate;
184 }
185 }
186
187 public long getParentFolderId() {
188 return _parentFolderId;
189 }
190
191 public void setParentFolderId(long parentFolderId) {
192 if (parentFolderId != _parentFolderId) {
193 _parentFolderId = parentFolderId;
194 }
195 }
196
197 public String getName() {
198 return GetterUtil.getString(_name);
199 }
200
201 public void setName(String name) {
202 if (((name == null) && (_name != null)) ||
203 ((name != null) && (_name == null)) ||
204 ((name != null) && (_name != null) && !name.equals(_name))) {
205 if (!XSS_ALLOW_NAME) {
206 name = XSSUtil.strip(name);
207 }
208
209 _name = name;
210 }
211 }
212
213 public String getDescription() {
214 return GetterUtil.getString(_description);
215 }
216
217 public void setDescription(String description) {
218 if (((description == null) && (_description != null)) ||
219 ((description != null) && (_description == null)) ||
220 ((description != null) && (_description != null) &&
221 !description.equals(_description))) {
222 if (!XSS_ALLOW_DESCRIPTION) {
223 description = XSSUtil.strip(description);
224 }
225
226 _description = description;
227 }
228 }
229
230 public Date getLastPostDate() {
231 return _lastPostDate;
232 }
233
234 public void setLastPostDate(Date lastPostDate) {
235 if (((lastPostDate == null) && (_lastPostDate != null)) ||
236 ((lastPostDate != null) && (_lastPostDate == null)) ||
237 ((lastPostDate != null) && (_lastPostDate != null) &&
238 !lastPostDate.equals(_lastPostDate))) {
239 _lastPostDate = lastPostDate;
240 }
241 }
242
243 public Object clone() {
244 DLFolderImpl clone = new DLFolderImpl();
245 clone.setFolderId(getFolderId());
246 clone.setGroupId(getGroupId());
247 clone.setCompanyId(getCompanyId());
248 clone.setUserId(getUserId());
249 clone.setUserName(getUserName());
250 clone.setCreateDate(getCreateDate());
251 clone.setModifiedDate(getModifiedDate());
252 clone.setParentFolderId(getParentFolderId());
253 clone.setName(getName());
254 clone.setDescription(getDescription());
255 clone.setLastPostDate(getLastPostDate());
256
257 return clone;
258 }
259
260 public int compareTo(Object obj) {
261 if (obj == null) {
262 return -1;
263 }
264
265 DLFolderImpl dlFolder = (DLFolderImpl)obj;
266 int value = 0;
267
268 if (getParentFolderId() < dlFolder.getParentFolderId()) {
269 value = -1;
270 }
271 else if (getParentFolderId() > dlFolder.getParentFolderId()) {
272 value = 1;
273 }
274 else {
275 value = 0;
276 }
277
278 if (value != 0) {
279 return value;
280 }
281
282 value = getName().toLowerCase().compareTo(dlFolder.getName()
283 .toLowerCase());
284
285 if (value != 0) {
286 return value;
287 }
288
289 return 0;
290 }
291
292 public boolean equals(Object obj) {
293 if (obj == null) {
294 return false;
295 }
296
297 DLFolderImpl dlFolder = null;
298
299 try {
300 dlFolder = (DLFolderImpl)obj;
301 }
302 catch (ClassCastException cce) {
303 return false;
304 }
305
306 long pk = dlFolder.getPrimaryKey();
307
308 if (getPrimaryKey() == pk) {
309 return true;
310 }
311 else {
312 return false;
313 }
314 }
315
316 public int hashCode() {
317 return (int)getPrimaryKey();
318 }
319
320 private long _folderId;
321 private long _groupId;
322 private long _companyId;
323 private long _userId;
324 private String _userName;
325 private Date _createDate;
326 private Date _modifiedDate;
327 private long _parentFolderId;
328 private String _name;
329 private String _description;
330 private Date _lastPostDate;
331 }