001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.tasks.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.util.DateUtil;
020    import com.liferay.portal.kernel.util.GetterUtil;
021    import com.liferay.portal.kernel.util.StringBundler;
022    import com.liferay.portal.kernel.util.StringPool;
023    import com.liferay.portal.model.impl.BaseModelImpl;
024    import com.liferay.portal.service.ServiceContext;
025    import com.liferay.portal.util.PortalUtil;
026    
027    import com.liferay.portlet.expando.model.ExpandoBridge;
028    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
029    import com.liferay.portlet.tasks.model.TasksProposal;
030    import com.liferay.portlet.tasks.model.TasksProposalModel;
031    import com.liferay.portlet.tasks.model.TasksProposalSoap;
032    
033    import java.io.Serializable;
034    
035    import java.lang.reflect.Proxy;
036    
037    import java.sql.Types;
038    
039    import java.util.ArrayList;
040    import java.util.Date;
041    import java.util.List;
042    
043    /**
044     * The base model implementation for the TasksProposal service. Represents a row in the "TasksProposal" database table, with each column mapped to a property of this class.
045     *
046     * <p>
047     * This implementation and its corresponding interface {@link com.liferay.portlet.tasks.model.TasksProposalModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link TasksProposalImpl}.
048     * </p>
049     *
050     * <p>
051     * Never modify or reference this class directly. All methods that expect a tasks proposal model instance should use the {@link com.liferay.portlet.tasks.model.TasksProposal} interface instead.
052     * </p>
053     *
054     * @author Brian Wing Shun Chan
055     * @see TasksProposalImpl
056     * @see com.liferay.portlet.tasks.model.TasksProposal
057     * @see com.liferay.portlet.tasks.model.TasksProposalModel
058     * @generated
059     */
060    public class TasksProposalModelImpl extends BaseModelImpl<TasksProposal>
061            implements TasksProposalModel {
062            public static final String TABLE_NAME = "TasksProposal";
063            public static final Object[][] TABLE_COLUMNS = {
064                            { "proposalId", new Integer(Types.BIGINT) },
065                            { "groupId", new Integer(Types.BIGINT) },
066                            { "companyId", new Integer(Types.BIGINT) },
067                            { "userId", new Integer(Types.BIGINT) },
068                            { "userName", new Integer(Types.VARCHAR) },
069                            { "createDate", new Integer(Types.TIMESTAMP) },
070                            { "modifiedDate", new Integer(Types.TIMESTAMP) },
071                            { "classNameId", new Integer(Types.BIGINT) },
072                            { "classPK", new Integer(Types.VARCHAR) },
073                            { "name", new Integer(Types.VARCHAR) },
074                            { "description", new Integer(Types.VARCHAR) },
075                            { "publishDate", new Integer(Types.TIMESTAMP) },
076                            { "dueDate", new Integer(Types.TIMESTAMP) }
077                    };
078            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)";
079            public static final String TABLE_SQL_DROP = "drop table TasksProposal";
080            public static final String ORDER_BY_JPQL = " ORDER BY tasksProposal.dueDate ASC, tasksProposal.createDate ASC";
081            public static final String ORDER_BY_SQL = " ORDER BY TasksProposal.dueDate ASC, TasksProposal.createDate ASC";
082            public static final String DATA_SOURCE = "liferayDataSource";
083            public static final String SESSION_FACTORY = "liferaySessionFactory";
084            public static final String TX_MANAGER = "liferayTransactionManager";
085            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
086                                    "value.object.entity.cache.enabled.com.liferay.portlet.tasks.model.TasksProposal"),
087                            true);
088            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
089                                    "value.object.finder.cache.enabled.com.liferay.portlet.tasks.model.TasksProposal"),
090                            true);
091    
092            /**
093             * Converts the soap model instance into a normal model instance.
094             *
095             * @param soapModel the soap model instance to convert
096             * @return the normal model instance
097             */
098            public static TasksProposal toModel(TasksProposalSoap soapModel) {
099                    TasksProposal model = new TasksProposalImpl();
100    
101                    model.setProposalId(soapModel.getProposalId());
102                    model.setGroupId(soapModel.getGroupId());
103                    model.setCompanyId(soapModel.getCompanyId());
104                    model.setUserId(soapModel.getUserId());
105                    model.setUserName(soapModel.getUserName());
106                    model.setCreateDate(soapModel.getCreateDate());
107                    model.setModifiedDate(soapModel.getModifiedDate());
108                    model.setClassNameId(soapModel.getClassNameId());
109                    model.setClassPK(soapModel.getClassPK());
110                    model.setName(soapModel.getName());
111                    model.setDescription(soapModel.getDescription());
112                    model.setPublishDate(soapModel.getPublishDate());
113                    model.setDueDate(soapModel.getDueDate());
114    
115                    return model;
116            }
117    
118            /**
119             * Converts the soap model instances into normal model instances.
120             *
121             * @param soapModels the soap model instances to convert
122             * @return the normal model instances
123             */
124            public static List<TasksProposal> toModels(TasksProposalSoap[] soapModels) {
125                    List<TasksProposal> models = new ArrayList<TasksProposal>(soapModels.length);
126    
127                    for (TasksProposalSoap soapModel : soapModels) {
128                            models.add(toModel(soapModel));
129                    }
130    
131                    return models;
132            }
133    
134            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
135                                    "lock.expiration.time.com.liferay.portlet.tasks.model.TasksProposal"));
136    
137            public TasksProposalModelImpl() {
138            }
139    
140            public long getPrimaryKey() {
141                    return _proposalId;
142            }
143    
144            public void setPrimaryKey(long pk) {
145                    setProposalId(pk);
146            }
147    
148            public Serializable getPrimaryKeyObj() {
149                    return new Long(_proposalId);
150            }
151    
152            public long getProposalId() {
153                    return _proposalId;
154            }
155    
156            public void setProposalId(long proposalId) {
157                    _proposalId = proposalId;
158            }
159    
160            public long getGroupId() {
161                    return _groupId;
162            }
163    
164            public void setGroupId(long groupId) {
165                    _groupId = groupId;
166            }
167    
168            public long getCompanyId() {
169                    return _companyId;
170            }
171    
172            public void setCompanyId(long companyId) {
173                    _companyId = companyId;
174            }
175    
176            public long getUserId() {
177                    return _userId;
178            }
179    
180            public void setUserId(long userId) {
181                    _userId = userId;
182            }
183    
184            public String getUserUuid() throws SystemException {
185                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
186            }
187    
188            public void setUserUuid(String userUuid) {
189                    _userUuid = userUuid;
190            }
191    
192            public String getUserName() {
193                    if (_userName == null) {
194                            return StringPool.BLANK;
195                    }
196                    else {
197                            return _userName;
198                    }
199            }
200    
201            public void setUserName(String userName) {
202                    _userName = userName;
203            }
204    
205            public Date getCreateDate() {
206                    return _createDate;
207            }
208    
209            public void setCreateDate(Date createDate) {
210                    _createDate = createDate;
211            }
212    
213            public Date getModifiedDate() {
214                    return _modifiedDate;
215            }
216    
217            public void setModifiedDate(Date modifiedDate) {
218                    _modifiedDate = modifiedDate;
219            }
220    
221            public String getClassName() {
222                    if (getClassNameId() <= 0) {
223                            return StringPool.BLANK;
224                    }
225    
226                    return PortalUtil.getClassName(getClassNameId());
227            }
228    
229            public long getClassNameId() {
230                    return _classNameId;
231            }
232    
233            public void setClassNameId(long classNameId) {
234                    _classNameId = classNameId;
235    
236                    if (!_setOriginalClassNameId) {
237                            _setOriginalClassNameId = true;
238    
239                            _originalClassNameId = classNameId;
240                    }
241            }
242    
243            public long getOriginalClassNameId() {
244                    return _originalClassNameId;
245            }
246    
247            public String getClassPK() {
248                    if (_classPK == null) {
249                            return StringPool.BLANK;
250                    }
251                    else {
252                            return _classPK;
253                    }
254            }
255    
256            public void setClassPK(String classPK) {
257                    _classPK = classPK;
258    
259                    if (_originalClassPK == null) {
260                            _originalClassPK = classPK;
261                    }
262            }
263    
264            public String getOriginalClassPK() {
265                    return GetterUtil.getString(_originalClassPK);
266            }
267    
268            public String getName() {
269                    if (_name == null) {
270                            return StringPool.BLANK;
271                    }
272                    else {
273                            return _name;
274                    }
275            }
276    
277            public void setName(String name) {
278                    _name = name;
279            }
280    
281            public String getDescription() {
282                    if (_description == null) {
283                            return StringPool.BLANK;
284                    }
285                    else {
286                            return _description;
287                    }
288            }
289    
290            public void setDescription(String description) {
291                    _description = description;
292            }
293    
294            public Date getPublishDate() {
295                    return _publishDate;
296            }
297    
298            public void setPublishDate(Date publishDate) {
299                    _publishDate = publishDate;
300            }
301    
302            public Date getDueDate() {
303                    return _dueDate;
304            }
305    
306            public void setDueDate(Date dueDate) {
307                    _dueDate = dueDate;
308            }
309    
310            public TasksProposal toEscapedModel() {
311                    if (isEscapedModel()) {
312                            return (TasksProposal)this;
313                    }
314                    else {
315                            return (TasksProposal)Proxy.newProxyInstance(TasksProposal.class.getClassLoader(),
316                                    new Class[] { TasksProposal.class },
317                                    new AutoEscapeBeanHandler(this));
318                    }
319            }
320    
321            public ExpandoBridge getExpandoBridge() {
322                    if (_expandoBridge == null) {
323                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
324                                            TasksProposal.class.getName(), getPrimaryKey());
325                    }
326    
327                    return _expandoBridge;
328            }
329    
330            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
331                    getExpandoBridge().setAttributes(serviceContext);
332            }
333    
334            public Object clone() {
335                    TasksProposalImpl clone = new TasksProposalImpl();
336    
337                    clone.setProposalId(getProposalId());
338                    clone.setGroupId(getGroupId());
339                    clone.setCompanyId(getCompanyId());
340                    clone.setUserId(getUserId());
341                    clone.setUserName(getUserName());
342                    clone.setCreateDate(getCreateDate());
343                    clone.setModifiedDate(getModifiedDate());
344                    clone.setClassNameId(getClassNameId());
345                    clone.setClassPK(getClassPK());
346                    clone.setName(getName());
347                    clone.setDescription(getDescription());
348                    clone.setPublishDate(getPublishDate());
349                    clone.setDueDate(getDueDate());
350    
351                    return clone;
352            }
353    
354            public int compareTo(TasksProposal tasksProposal) {
355                    int value = 0;
356    
357                    value = DateUtil.compareTo(getDueDate(), tasksProposal.getDueDate());
358    
359                    if (value != 0) {
360                            return value;
361                    }
362    
363                    value = DateUtil.compareTo(getCreateDate(),
364                                    tasksProposal.getCreateDate());
365    
366                    if (value != 0) {
367                            return value;
368                    }
369    
370                    return 0;
371            }
372    
373            public boolean equals(Object obj) {
374                    if (obj == null) {
375                            return false;
376                    }
377    
378                    TasksProposal tasksProposal = null;
379    
380                    try {
381                            tasksProposal = (TasksProposal)obj;
382                    }
383                    catch (ClassCastException cce) {
384                            return false;
385                    }
386    
387                    long pk = tasksProposal.getPrimaryKey();
388    
389                    if (getPrimaryKey() == pk) {
390                            return true;
391                    }
392                    else {
393                            return false;
394                    }
395            }
396    
397            public int hashCode() {
398                    return (int)getPrimaryKey();
399            }
400    
401            public String toString() {
402                    StringBundler sb = new StringBundler(27);
403    
404                    sb.append("{proposalId=");
405                    sb.append(getProposalId());
406                    sb.append(", groupId=");
407                    sb.append(getGroupId());
408                    sb.append(", companyId=");
409                    sb.append(getCompanyId());
410                    sb.append(", userId=");
411                    sb.append(getUserId());
412                    sb.append(", userName=");
413                    sb.append(getUserName());
414                    sb.append(", createDate=");
415                    sb.append(getCreateDate());
416                    sb.append(", modifiedDate=");
417                    sb.append(getModifiedDate());
418                    sb.append(", classNameId=");
419                    sb.append(getClassNameId());
420                    sb.append(", classPK=");
421                    sb.append(getClassPK());
422                    sb.append(", name=");
423                    sb.append(getName());
424                    sb.append(", description=");
425                    sb.append(getDescription());
426                    sb.append(", publishDate=");
427                    sb.append(getPublishDate());
428                    sb.append(", dueDate=");
429                    sb.append(getDueDate());
430                    sb.append("}");
431    
432                    return sb.toString();
433            }
434    
435            public String toXmlString() {
436                    StringBundler sb = new StringBundler(43);
437    
438                    sb.append("<model><model-name>");
439                    sb.append("com.liferay.portlet.tasks.model.TasksProposal");
440                    sb.append("</model-name>");
441    
442                    sb.append(
443                            "<column><column-name>proposalId</column-name><column-value><![CDATA[");
444                    sb.append(getProposalId());
445                    sb.append("]]></column-value></column>");
446                    sb.append(
447                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
448                    sb.append(getGroupId());
449                    sb.append("]]></column-value></column>");
450                    sb.append(
451                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
452                    sb.append(getCompanyId());
453                    sb.append("]]></column-value></column>");
454                    sb.append(
455                            "<column><column-name>userId</column-name><column-value><![CDATA[");
456                    sb.append(getUserId());
457                    sb.append("]]></column-value></column>");
458                    sb.append(
459                            "<column><column-name>userName</column-name><column-value><![CDATA[");
460                    sb.append(getUserName());
461                    sb.append("]]></column-value></column>");
462                    sb.append(
463                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
464                    sb.append(getCreateDate());
465                    sb.append("]]></column-value></column>");
466                    sb.append(
467                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
468                    sb.append(getModifiedDate());
469                    sb.append("]]></column-value></column>");
470                    sb.append(
471                            "<column><column-name>classNameId</column-name><column-value><![CDATA[");
472                    sb.append(getClassNameId());
473                    sb.append("]]></column-value></column>");
474                    sb.append(
475                            "<column><column-name>classPK</column-name><column-value><![CDATA[");
476                    sb.append(getClassPK());
477                    sb.append("]]></column-value></column>");
478                    sb.append(
479                            "<column><column-name>name</column-name><column-value><![CDATA[");
480                    sb.append(getName());
481                    sb.append("]]></column-value></column>");
482                    sb.append(
483                            "<column><column-name>description</column-name><column-value><![CDATA[");
484                    sb.append(getDescription());
485                    sb.append("]]></column-value></column>");
486                    sb.append(
487                            "<column><column-name>publishDate</column-name><column-value><![CDATA[");
488                    sb.append(getPublishDate());
489                    sb.append("]]></column-value></column>");
490                    sb.append(
491                            "<column><column-name>dueDate</column-name><column-value><![CDATA[");
492                    sb.append(getDueDate());
493                    sb.append("]]></column-value></column>");
494    
495                    sb.append("</model>");
496    
497                    return sb.toString();
498            }
499    
500            private long _proposalId;
501            private long _groupId;
502            private long _companyId;
503            private long _userId;
504            private String _userUuid;
505            private String _userName;
506            private Date _createDate;
507            private Date _modifiedDate;
508            private long _classNameId;
509            private long _originalClassNameId;
510            private boolean _setOriginalClassNameId;
511            private String _classPK;
512            private String _originalClassPK;
513            private String _name;
514            private String _description;
515            private Date _publishDate;
516            private Date _dueDate;
517            private transient ExpandoBridge _expandoBridge;
518    }