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