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