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