1
22
23 package com.liferay.portlet.tasks.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.DateUtil;
27 import com.liferay.portal.kernel.util.GetterUtil;
28 import com.liferay.portal.kernel.util.HtmlUtil;
29 import com.liferay.portal.kernel.util.StringPool;
30 import com.liferay.portal.model.impl.BaseModelImpl;
31 import com.liferay.portal.util.PortalUtil;
32
33 import com.liferay.portlet.tasks.model.TasksProposal;
34 import com.liferay.portlet.tasks.model.TasksProposalSoap;
35
36 import java.io.Serializable;
37
38 import java.lang.reflect.Proxy;
39
40 import java.sql.Types;
41
42 import java.util.ArrayList;
43 import java.util.Date;
44 import java.util.List;
45
46
66 public class TasksProposalModelImpl extends BaseModelImpl {
67 public static final String TABLE_NAME = "TasksProposal";
68 public static final Object[][] TABLE_COLUMNS = {
69 { "proposalId", 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 { "classNameId", new Integer(Types.BIGINT) },
91
92
93 { "classPK", new Integer(Types.VARCHAR) },
94
95
96 { "name", new Integer(Types.VARCHAR) },
97
98
99 { "description", new Integer(Types.VARCHAR) },
100
101
102 { "publishDate", new Integer(Types.TIMESTAMP) },
103
104
105 { "dueDate", new Integer(Types.TIMESTAMP) }
106 };
107 public static final String TABLE_SQL_CREATE = "create table TasksProposal (proposalId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK VARCHAR(75) null,name VARCHAR(75) null,description STRING null,publishDate DATE null,dueDate DATE null)";
108 public static final String TABLE_SQL_DROP = "drop table TasksProposal";
109 public static final String DATA_SOURCE = "liferayDataSource";
110 public static final String SESSION_FACTORY = "liferaySessionFactory";
111 public static final String TX_MANAGER = "liferayTransactionManager";
112 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
113 "value.object.finder.cache.enabled.com.liferay.portlet.tasks.model.TasksProposal"),
114 true);
115
116 public static TasksProposal toModel(TasksProposalSoap soapModel) {
117 TasksProposal model = new TasksProposalImpl();
118
119 model.setProposalId(soapModel.getProposalId());
120 model.setGroupId(soapModel.getGroupId());
121 model.setCompanyId(soapModel.getCompanyId());
122 model.setUserId(soapModel.getUserId());
123 model.setUserName(soapModel.getUserName());
124 model.setCreateDate(soapModel.getCreateDate());
125 model.setModifiedDate(soapModel.getModifiedDate());
126 model.setClassNameId(soapModel.getClassNameId());
127 model.setClassPK(soapModel.getClassPK());
128 model.setName(soapModel.getName());
129 model.setDescription(soapModel.getDescription());
130 model.setPublishDate(soapModel.getPublishDate());
131 model.setDueDate(soapModel.getDueDate());
132
133 return model;
134 }
135
136 public static List<TasksProposal> toModels(TasksProposalSoap[] soapModels) {
137 List<TasksProposal> models = new ArrayList<TasksProposal>(soapModels.length);
138
139 for (TasksProposalSoap soapModel : soapModels) {
140 models.add(toModel(soapModel));
141 }
142
143 return models;
144 }
145
146 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
147 "lock.expiration.time.com.liferay.portlet.tasks.model.TasksProposal"));
148
149 public TasksProposalModelImpl() {
150 }
151
152 public long getPrimaryKey() {
153 return _proposalId;
154 }
155
156 public void setPrimaryKey(long pk) {
157 setProposalId(pk);
158 }
159
160 public Serializable getPrimaryKeyObj() {
161 return new Long(_proposalId);
162 }
163
164 public long getProposalId() {
165 return _proposalId;
166 }
167
168 public void setProposalId(long proposalId) {
169 if (proposalId != _proposalId) {
170 _proposalId = proposalId;
171 }
172 }
173
174 public long getGroupId() {
175 return _groupId;
176 }
177
178 public void setGroupId(long groupId) {
179 if (groupId != _groupId) {
180 _groupId = groupId;
181 }
182 }
183
184 public long getCompanyId() {
185 return _companyId;
186 }
187
188 public void setCompanyId(long companyId) {
189 if (companyId != _companyId) {
190 _companyId = companyId;
191 }
192 }
193
194 public long getUserId() {
195 return _userId;
196 }
197
198 public void setUserId(long userId) {
199 if (userId != _userId) {
200 _userId = userId;
201 }
202 }
203
204 public String getUserName() {
205 return GetterUtil.getString(_userName);
206 }
207
208 public void setUserName(String userName) {
209 if (((userName == null) && (_userName != null)) ||
210 ((userName != null) && (_userName == null)) ||
211 ((userName != null) && (_userName != null) &&
212 !userName.equals(_userName))) {
213 _userName = userName;
214 }
215 }
216
217 public Date getCreateDate() {
218 return _createDate;
219 }
220
221 public void setCreateDate(Date createDate) {
222 if (((createDate == null) && (_createDate != null)) ||
223 ((createDate != null) && (_createDate == null)) ||
224 ((createDate != null) && (_createDate != null) &&
225 !createDate.equals(_createDate))) {
226 _createDate = createDate;
227 }
228 }
229
230 public Date getModifiedDate() {
231 return _modifiedDate;
232 }
233
234 public void setModifiedDate(Date modifiedDate) {
235 if (((modifiedDate == null) && (_modifiedDate != null)) ||
236 ((modifiedDate != null) && (_modifiedDate == null)) ||
237 ((modifiedDate != null) && (_modifiedDate != null) &&
238 !modifiedDate.equals(_modifiedDate))) {
239 _modifiedDate = modifiedDate;
240 }
241 }
242
243 public String getClassName() {
244 if (getClassNameId() <= 0) {
245 return StringPool.BLANK;
246 }
247
248 return PortalUtil.getClassName(getClassNameId());
249 }
250
251 public long getClassNameId() {
252 return _classNameId;
253 }
254
255 public void setClassNameId(long classNameId) {
256 if (classNameId != _classNameId) {
257 _classNameId = classNameId;
258 }
259 }
260
261 public String getClassPK() {
262 return GetterUtil.getString(_classPK);
263 }
264
265 public void setClassPK(String classPK) {
266 if (((classPK == null) && (_classPK != null)) ||
267 ((classPK != null) && (_classPK == null)) ||
268 ((classPK != null) && (_classPK != null) &&
269 !classPK.equals(_classPK))) {
270 _classPK = classPK;
271 }
272 }
273
274 public String getName() {
275 return GetterUtil.getString(_name);
276 }
277
278 public void setName(String name) {
279 if (((name == null) && (_name != null)) ||
280 ((name != null) && (_name == null)) ||
281 ((name != null) && (_name != null) && !name.equals(_name))) {
282 _name = name;
283 }
284 }
285
286 public String getDescription() {
287 return GetterUtil.getString(_description);
288 }
289
290 public void setDescription(String description) {
291 if (((description == null) && (_description != null)) ||
292 ((description != null) && (_description == null)) ||
293 ((description != null) && (_description != null) &&
294 !description.equals(_description))) {
295 _description = description;
296 }
297 }
298
299 public Date getPublishDate() {
300 return _publishDate;
301 }
302
303 public void setPublishDate(Date publishDate) {
304 if (((publishDate == null) && (_publishDate != null)) ||
305 ((publishDate != null) && (_publishDate == null)) ||
306 ((publishDate != null) && (_publishDate != null) &&
307 !publishDate.equals(_publishDate))) {
308 _publishDate = publishDate;
309 }
310 }
311
312 public Date getDueDate() {
313 return _dueDate;
314 }
315
316 public void setDueDate(Date dueDate) {
317 if (((dueDate == null) && (_dueDate != null)) ||
318 ((dueDate != null) && (_dueDate == null)) ||
319 ((dueDate != null) && (_dueDate != null) &&
320 !dueDate.equals(_dueDate))) {
321 _dueDate = dueDate;
322 }
323 }
324
325 public TasksProposal toEscapedModel() {
326 if (isEscapedModel()) {
327 return (TasksProposal)this;
328 }
329 else {
330 TasksProposal model = new TasksProposalImpl();
331
332 model.setNew(isNew());
333 model.setEscapedModel(true);
334
335 model.setProposalId(getProposalId());
336 model.setGroupId(getGroupId());
337 model.setCompanyId(getCompanyId());
338 model.setUserId(getUserId());
339 model.setUserName(HtmlUtil.escape(getUserName()));
340 model.setCreateDate(getCreateDate());
341 model.setModifiedDate(getModifiedDate());
342 model.setClassNameId(getClassNameId());
343 model.setClassPK(HtmlUtil.escape(getClassPK()));
344 model.setName(HtmlUtil.escape(getName()));
345 model.setDescription(HtmlUtil.escape(getDescription()));
346 model.setPublishDate(getPublishDate());
347 model.setDueDate(getDueDate());
348
349 model = (TasksProposal)Proxy.newProxyInstance(TasksProposal.class.getClassLoader(),
350 new Class[] { TasksProposal.class },
351 new ReadOnlyBeanHandler(model));
352
353 return model;
354 }
355 }
356
357 public Object clone() {
358 TasksProposalImpl clone = new TasksProposalImpl();
359
360 clone.setProposalId(getProposalId());
361 clone.setGroupId(getGroupId());
362 clone.setCompanyId(getCompanyId());
363 clone.setUserId(getUserId());
364 clone.setUserName(getUserName());
365 clone.setCreateDate(getCreateDate());
366 clone.setModifiedDate(getModifiedDate());
367 clone.setClassNameId(getClassNameId());
368 clone.setClassPK(getClassPK());
369 clone.setName(getName());
370 clone.setDescription(getDescription());
371 clone.setPublishDate(getPublishDate());
372 clone.setDueDate(getDueDate());
373
374 return clone;
375 }
376
377 public int compareTo(Object obj) {
378 if (obj == null) {
379 return -1;
380 }
381
382 TasksProposalImpl tasksProposal = (TasksProposalImpl)obj;
383
384 int value = 0;
385
386 value = DateUtil.compareTo(getDueDate(), tasksProposal.getDueDate());
387
388 if (value != 0) {
389 return value;
390 }
391
392 value = DateUtil.compareTo(getCreateDate(),
393 tasksProposal.getCreateDate());
394
395 if (value != 0) {
396 return value;
397 }
398
399 return 0;
400 }
401
402 public boolean equals(Object obj) {
403 if (obj == null) {
404 return false;
405 }
406
407 TasksProposalImpl tasksProposal = null;
408
409 try {
410 tasksProposal = (TasksProposalImpl)obj;
411 }
412 catch (ClassCastException cce) {
413 return false;
414 }
415
416 long pk = tasksProposal.getPrimaryKey();
417
418 if (getPrimaryKey() == pk) {
419 return true;
420 }
421 else {
422 return false;
423 }
424 }
425
426 public int hashCode() {
427 return (int)getPrimaryKey();
428 }
429
430 private long _proposalId;
431 private long _groupId;
432 private long _companyId;
433 private long _userId;
434 private String _userName;
435 private Date _createDate;
436 private Date _modifiedDate;
437 private long _classNameId;
438 private String _classPK;
439 private String _name;
440 private String _description;
441 private Date _publishDate;
442 private Date _dueDate;
443 }