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