1
22
23 package com.liferay.portlet.wiki.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 import com.liferay.portal.util.PropsUtil;
30
31 import com.liferay.portlet.wiki.model.WikiNode;
32 import com.liferay.portlet.wiki.model.WikiNodeSoap;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.ArrayList;
41 import java.util.Date;
42 import java.util.List;
43
44
64 public class WikiNodeModelImpl extends BaseModelImpl {
65 public static final String TABLE_NAME = "WikiNode";
66 public static final Object[][] TABLE_COLUMNS = {
67 { "uuid_", new Integer(Types.VARCHAR) },
68
69
70 { "nodeId", new Integer(Types.BIGINT) },
71
72
73 { "groupId", new Integer(Types.BIGINT) },
74
75
76 { "companyId", new Integer(Types.BIGINT) },
77
78
79 { "userId", new Integer(Types.BIGINT) },
80
81
82 { "userName", new Integer(Types.VARCHAR) },
83
84
85 { "createDate", new Integer(Types.TIMESTAMP) },
86
87
88 { "modifiedDate", new Integer(Types.TIMESTAMP) },
89
90
91 { "name", new Integer(Types.VARCHAR) },
92
93
94 { "description", new Integer(Types.VARCHAR) },
95
96
97 { "lastPostDate", new Integer(Types.TIMESTAMP) }
98 };
99 public static final String TABLE_SQL_CREATE = "create table WikiNode (uuid_ VARCHAR(75) null,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)";
100 public static final String TABLE_SQL_DROP = "drop table WikiNode";
101 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
102 "value.object.finder.cache.enabled.com.liferay.portlet.wiki.model.WikiNode"),
103 true);
104
105 public static WikiNode toModel(WikiNodeSoap soapModel) {
106 WikiNode model = new WikiNodeImpl();
107
108 model.setUuid(soapModel.getUuid());
109 model.setNodeId(soapModel.getNodeId());
110 model.setGroupId(soapModel.getGroupId());
111 model.setCompanyId(soapModel.getCompanyId());
112 model.setUserId(soapModel.getUserId());
113 model.setUserName(soapModel.getUserName());
114 model.setCreateDate(soapModel.getCreateDate());
115 model.setModifiedDate(soapModel.getModifiedDate());
116 model.setName(soapModel.getName());
117 model.setDescription(soapModel.getDescription());
118 model.setLastPostDate(soapModel.getLastPostDate());
119
120 return model;
121 }
122
123 public static List<WikiNode> toModels(WikiNodeSoap[] soapModels) {
124 List<WikiNode> models = new ArrayList<WikiNode>(soapModels.length);
125
126 for (WikiNodeSoap soapModel : soapModels) {
127 models.add(toModel(soapModel));
128 }
129
130 return models;
131 }
132
133 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
134 "lock.expiration.time.com.liferay.portlet.wiki.model.WikiNode"));
135
136 public WikiNodeModelImpl() {
137 }
138
139 public long getPrimaryKey() {
140 return _nodeId;
141 }
142
143 public void setPrimaryKey(long pk) {
144 setNodeId(pk);
145 }
146
147 public Serializable getPrimaryKeyObj() {
148 return new Long(_nodeId);
149 }
150
151 public String getUuid() {
152 return GetterUtil.getString(_uuid);
153 }
154
155 public void setUuid(String uuid) {
156 if ((uuid != null) && (uuid != _uuid)) {
157 _uuid = uuid;
158 }
159 }
160
161 public long getNodeId() {
162 return _nodeId;
163 }
164
165 public void setNodeId(long nodeId) {
166 if (nodeId != _nodeId) {
167 _nodeId = nodeId;
168 }
169 }
170
171 public long getGroupId() {
172 return _groupId;
173 }
174
175 public void setGroupId(long groupId) {
176 if (groupId != _groupId) {
177 _groupId = groupId;
178 }
179 }
180
181 public long getCompanyId() {
182 return _companyId;
183 }
184
185 public void setCompanyId(long companyId) {
186 if (companyId != _companyId) {
187 _companyId = companyId;
188 }
189 }
190
191 public long getUserId() {
192 return _userId;
193 }
194
195 public void setUserId(long userId) {
196 if (userId != _userId) {
197 _userId = userId;
198 }
199 }
200
201 public String getUserName() {
202 return GetterUtil.getString(_userName);
203 }
204
205 public void setUserName(String userName) {
206 if (((userName == null) && (_userName != null)) ||
207 ((userName != null) && (_userName == null)) ||
208 ((userName != null) && (_userName != null) &&
209 !userName.equals(_userName))) {
210 _userName = userName;
211 }
212 }
213
214 public Date getCreateDate() {
215 return _createDate;
216 }
217
218 public void setCreateDate(Date createDate) {
219 if (((createDate == null) && (_createDate != null)) ||
220 ((createDate != null) && (_createDate == null)) ||
221 ((createDate != null) && (_createDate != null) &&
222 !createDate.equals(_createDate))) {
223 _createDate = createDate;
224 }
225 }
226
227 public Date getModifiedDate() {
228 return _modifiedDate;
229 }
230
231 public void setModifiedDate(Date modifiedDate) {
232 if (((modifiedDate == null) && (_modifiedDate != null)) ||
233 ((modifiedDate != null) && (_modifiedDate == null)) ||
234 ((modifiedDate != null) && (_modifiedDate != null) &&
235 !modifiedDate.equals(_modifiedDate))) {
236 _modifiedDate = modifiedDate;
237 }
238 }
239
240 public String getName() {
241 return GetterUtil.getString(_name);
242 }
243
244 public void setName(String name) {
245 if (((name == null) && (_name != null)) ||
246 ((name != null) && (_name == null)) ||
247 ((name != null) && (_name != null) && !name.equals(_name))) {
248 _name = name;
249 }
250 }
251
252 public String getDescription() {
253 return GetterUtil.getString(_description);
254 }
255
256 public void setDescription(String description) {
257 if (((description == null) && (_description != null)) ||
258 ((description != null) && (_description == null)) ||
259 ((description != null) && (_description != null) &&
260 !description.equals(_description))) {
261 _description = description;
262 }
263 }
264
265 public Date getLastPostDate() {
266 return _lastPostDate;
267 }
268
269 public void setLastPostDate(Date lastPostDate) {
270 if (((lastPostDate == null) && (_lastPostDate != null)) ||
271 ((lastPostDate != null) && (_lastPostDate == null)) ||
272 ((lastPostDate != null) && (_lastPostDate != null) &&
273 !lastPostDate.equals(_lastPostDate))) {
274 _lastPostDate = lastPostDate;
275 }
276 }
277
278 public WikiNode toEscapedModel() {
279 if (isEscapedModel()) {
280 return (WikiNode)this;
281 }
282 else {
283 WikiNode model = new WikiNodeImpl();
284
285 model.setEscapedModel(true);
286
287 model.setUuid(HtmlUtil.escape(getUuid()));
288 model.setNodeId(getNodeId());
289 model.setGroupId(getGroupId());
290 model.setCompanyId(getCompanyId());
291 model.setUserId(getUserId());
292 model.setUserName(HtmlUtil.escape(getUserName()));
293 model.setCreateDate(getCreateDate());
294 model.setModifiedDate(getModifiedDate());
295 model.setName(HtmlUtil.escape(getName()));
296 model.setDescription(HtmlUtil.escape(getDescription()));
297 model.setLastPostDate(getLastPostDate());
298
299 model = (WikiNode)Proxy.newProxyInstance(WikiNode.class.getClassLoader(),
300 new Class[] { WikiNode.class },
301 new ReadOnlyBeanHandler(model));
302
303 return model;
304 }
305 }
306
307 public Object clone() {
308 WikiNodeImpl clone = new WikiNodeImpl();
309
310 clone.setUuid(getUuid());
311 clone.setNodeId(getNodeId());
312 clone.setGroupId(getGroupId());
313 clone.setCompanyId(getCompanyId());
314 clone.setUserId(getUserId());
315 clone.setUserName(getUserName());
316 clone.setCreateDate(getCreateDate());
317 clone.setModifiedDate(getModifiedDate());
318 clone.setName(getName());
319 clone.setDescription(getDescription());
320 clone.setLastPostDate(getLastPostDate());
321
322 return clone;
323 }
324
325 public int compareTo(Object obj) {
326 if (obj == null) {
327 return -1;
328 }
329
330 WikiNodeImpl wikiNode = (WikiNodeImpl)obj;
331
332 int value = 0;
333
334 value = getName().toLowerCase()
335 .compareTo(wikiNode.getName().toLowerCase());
336
337 if (value != 0) {
338 return value;
339 }
340
341 return 0;
342 }
343
344 public boolean equals(Object obj) {
345 if (obj == null) {
346 return false;
347 }
348
349 WikiNodeImpl wikiNode = null;
350
351 try {
352 wikiNode = (WikiNodeImpl)obj;
353 }
354 catch (ClassCastException cce) {
355 return false;
356 }
357
358 long pk = wikiNode.getPrimaryKey();
359
360 if (getPrimaryKey() == pk) {
361 return true;
362 }
363 else {
364 return false;
365 }
366 }
367
368 public int hashCode() {
369 return (int)getPrimaryKey();
370 }
371
372 private String _uuid;
373 private long _nodeId;
374 private long _groupId;
375 private long _companyId;
376 private long _userId;
377 private String _userName;
378 private Date _createDate;
379 private Date _modifiedDate;
380 private String _name;
381 private String _description;
382 private Date _lastPostDate;
383 }