1
22
23 package com.liferay.portlet.bookmarks.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 BookmarksFolderModelImpl extends BaseModelImpl {
58 public static String TABLE_NAME = "BookmarksFolder";
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 { "createDate", new Integer(Types.TIMESTAMP) },
65 { "modifiedDate", new Integer(Types.TIMESTAMP) },
66 { "parentFolderId", new Integer(Types.BIGINT) },
67 { "name", new Integer(Types.VARCHAR) },
68 { "description", new Integer(Types.VARCHAR) }
69 };
70 public static String TABLE_SQL_CREATE = "create table BookmarksFolder (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)";
71 public static String TABLE_SQL_DROP = "drop table BookmarksFolder";
72 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
73 "xss.allow.com.liferay.portlet.bookmarks.model.BookmarksFolder"),
74 XSS_ALLOW);
75 public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
76 "xss.allow.com.liferay.portlet.bookmarks.model.BookmarksFolder.name"),
77 XSS_ALLOW_BY_MODEL);
78 public static boolean XSS_ALLOW_DESCRIPTION = GetterUtil.getBoolean(PropsUtil.get(
79 "xss.allow.com.liferay.portlet.bookmarks.model.BookmarksFolder.description"),
80 XSS_ALLOW_BY_MODEL);
81 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
82 "lock.expiration.time.com.liferay.portlet.bookmarks.model.BookmarksFolderModel"));
83
84 public BookmarksFolderModelImpl() {
85 }
86
87 public long getPrimaryKey() {
88 return _folderId;
89 }
90
91 public void setPrimaryKey(long pk) {
92 setFolderId(pk);
93 }
94
95 public Serializable getPrimaryKeyObj() {
96 return new Long(_folderId);
97 }
98
99 public long getFolderId() {
100 return _folderId;
101 }
102
103 public void setFolderId(long folderId) {
104 if (folderId != _folderId) {
105 _folderId = folderId;
106 }
107 }
108
109 public long getGroupId() {
110 return _groupId;
111 }
112
113 public void setGroupId(long groupId) {
114 if (groupId != _groupId) {
115 _groupId = groupId;
116 }
117 }
118
119 public long getCompanyId() {
120 return _companyId;
121 }
122
123 public void setCompanyId(long companyId) {
124 if (companyId != _companyId) {
125 _companyId = companyId;
126 }
127 }
128
129 public long getUserId() {
130 return _userId;
131 }
132
133 public void setUserId(long userId) {
134 if (userId != _userId) {
135 _userId = userId;
136 }
137 }
138
139 public Date getCreateDate() {
140 return _createDate;
141 }
142
143 public void setCreateDate(Date createDate) {
144 if (((createDate == null) && (_createDate != null)) ||
145 ((createDate != null) && (_createDate == null)) ||
146 ((createDate != null) && (_createDate != null) &&
147 !createDate.equals(_createDate))) {
148 _createDate = createDate;
149 }
150 }
151
152 public Date getModifiedDate() {
153 return _modifiedDate;
154 }
155
156 public void setModifiedDate(Date modifiedDate) {
157 if (((modifiedDate == null) && (_modifiedDate != null)) ||
158 ((modifiedDate != null) && (_modifiedDate == null)) ||
159 ((modifiedDate != null) && (_modifiedDate != null) &&
160 !modifiedDate.equals(_modifiedDate))) {
161 _modifiedDate = modifiedDate;
162 }
163 }
164
165 public long getParentFolderId() {
166 return _parentFolderId;
167 }
168
169 public void setParentFolderId(long parentFolderId) {
170 if (parentFolderId != _parentFolderId) {
171 _parentFolderId = parentFolderId;
172 }
173 }
174
175 public String getName() {
176 return GetterUtil.getString(_name);
177 }
178
179 public void setName(String name) {
180 if (((name == null) && (_name != null)) ||
181 ((name != null) && (_name == null)) ||
182 ((name != null) && (_name != null) && !name.equals(_name))) {
183 if (!XSS_ALLOW_NAME) {
184 name = XSSUtil.strip(name);
185 }
186
187 _name = name;
188 }
189 }
190
191 public String getDescription() {
192 return GetterUtil.getString(_description);
193 }
194
195 public void setDescription(String description) {
196 if (((description == null) && (_description != null)) ||
197 ((description != null) && (_description == null)) ||
198 ((description != null) && (_description != null) &&
199 !description.equals(_description))) {
200 if (!XSS_ALLOW_DESCRIPTION) {
201 description = XSSUtil.strip(description);
202 }
203
204 _description = description;
205 }
206 }
207
208 public Object clone() {
209 BookmarksFolderImpl clone = new BookmarksFolderImpl();
210 clone.setFolderId(getFolderId());
211 clone.setGroupId(getGroupId());
212 clone.setCompanyId(getCompanyId());
213 clone.setUserId(getUserId());
214 clone.setCreateDate(getCreateDate());
215 clone.setModifiedDate(getModifiedDate());
216 clone.setParentFolderId(getParentFolderId());
217 clone.setName(getName());
218 clone.setDescription(getDescription());
219
220 return clone;
221 }
222
223 public int compareTo(Object obj) {
224 if (obj == null) {
225 return -1;
226 }
227
228 BookmarksFolderImpl bookmarksFolder = (BookmarksFolderImpl)obj;
229 int value = 0;
230
231 if (getParentFolderId() < bookmarksFolder.getParentFolderId()) {
232 value = -1;
233 }
234 else if (getParentFolderId() > bookmarksFolder.getParentFolderId()) {
235 value = 1;
236 }
237 else {
238 value = 0;
239 }
240
241 if (value != 0) {
242 return value;
243 }
244
245 value = getName().toLowerCase().compareTo(bookmarksFolder.getName()
246 .toLowerCase());
247
248 if (value != 0) {
249 return value;
250 }
251
252 return 0;
253 }
254
255 public boolean equals(Object obj) {
256 if (obj == null) {
257 return false;
258 }
259
260 BookmarksFolderImpl bookmarksFolder = null;
261
262 try {
263 bookmarksFolder = (BookmarksFolderImpl)obj;
264 }
265 catch (ClassCastException cce) {
266 return false;
267 }
268
269 long pk = bookmarksFolder.getPrimaryKey();
270
271 if (getPrimaryKey() == pk) {
272 return true;
273 }
274 else {
275 return false;
276 }
277 }
278
279 public int hashCode() {
280 return (int)getPrimaryKey();
281 }
282
283 private long _folderId;
284 private long _groupId;
285 private long _companyId;
286 private long _userId;
287 private Date _createDate;
288 private Date _modifiedDate;
289 private long _parentFolderId;
290 private String _name;
291 private String _description;
292 }