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.TasksReview;
030    import com.liferay.portlet.tasks.model.TasksReviewModel;
031    import com.liferay.portlet.tasks.model.TasksReviewSoap;
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 TasksReview service. Represents a row in the "TasksReview" 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.TasksReviewModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link TasksReviewImpl}.
048     * </p>
049     *
050     * <p>
051     * Never modify or reference this class directly. All methods that expect a tasks review model instance should use the {@link com.liferay.portlet.tasks.model.TasksReview} interface instead.
052     * </p>
053     *
054     * @author Brian Wing Shun Chan
055     * @see TasksReviewImpl
056     * @see com.liferay.portlet.tasks.model.TasksReview
057     * @see com.liferay.portlet.tasks.model.TasksReviewModel
058     * @generated
059     */
060    public class TasksReviewModelImpl extends BaseModelImpl<TasksReview>
061            implements TasksReviewModel {
062            public static final String TABLE_NAME = "TasksReview";
063            public static final Object[][] TABLE_COLUMNS = {
064                            { "reviewId", 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                            { "proposalId", new Integer(Types.BIGINT) },
072                            { "assignedByUserId", new Integer(Types.BIGINT) },
073                            { "assignedByUserName", new Integer(Types.VARCHAR) },
074                            { "stage", new Integer(Types.INTEGER) },
075                            { "completed", new Integer(Types.BOOLEAN) },
076                            { "rejected", new Integer(Types.BOOLEAN) }
077                    };
078            public static final String TABLE_SQL_CREATE = "create table TasksReview (reviewId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,proposalId LONG,assignedByUserId LONG,assignedByUserName VARCHAR(75) null,stage INTEGER,completed BOOLEAN,rejected BOOLEAN)";
079            public static final String TABLE_SQL_DROP = "drop table TasksReview";
080            public static final String ORDER_BY_JPQL = " ORDER BY tasksReview.createDate ASC";
081            public static final String ORDER_BY_SQL = " ORDER BY TasksReview.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.TasksReview"),
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.TasksReview"),
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 TasksReview toModel(TasksReviewSoap soapModel) {
099                    TasksReview model = new TasksReviewImpl();
100    
101                    model.setReviewId(soapModel.getReviewId());
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.setProposalId(soapModel.getProposalId());
109                    model.setAssignedByUserId(soapModel.getAssignedByUserId());
110                    model.setAssignedByUserName(soapModel.getAssignedByUserName());
111                    model.setStage(soapModel.getStage());
112                    model.setCompleted(soapModel.getCompleted());
113                    model.setRejected(soapModel.getRejected());
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<TasksReview> toModels(TasksReviewSoap[] soapModels) {
125                    List<TasksReview> models = new ArrayList<TasksReview>(soapModels.length);
126    
127                    for (TasksReviewSoap 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.TasksReview"));
136    
137            public TasksReviewModelImpl() {
138            }
139    
140            public long getPrimaryKey() {
141                    return _reviewId;
142            }
143    
144            public void setPrimaryKey(long pk) {
145                    setReviewId(pk);
146            }
147    
148            public Serializable getPrimaryKeyObj() {
149                    return new Long(_reviewId);
150            }
151    
152            public long getReviewId() {
153                    return _reviewId;
154            }
155    
156            public void setReviewId(long reviewId) {
157                    _reviewId = reviewId;
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                    if (!_setOriginalUserId) {
184                            _setOriginalUserId = true;
185    
186                            _originalUserId = userId;
187                    }
188            }
189    
190            public String getUserUuid() throws SystemException {
191                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
192            }
193    
194            public void setUserUuid(String userUuid) {
195                    _userUuid = userUuid;
196            }
197    
198            public long getOriginalUserId() {
199                    return _originalUserId;
200            }
201    
202            public String getUserName() {
203                    if (_userName == null) {
204                            return StringPool.BLANK;
205                    }
206                    else {
207                            return _userName;
208                    }
209            }
210    
211            public void setUserName(String userName) {
212                    _userName = userName;
213            }
214    
215            public Date getCreateDate() {
216                    return _createDate;
217            }
218    
219            public void setCreateDate(Date createDate) {
220                    _createDate = createDate;
221            }
222    
223            public Date getModifiedDate() {
224                    return _modifiedDate;
225            }
226    
227            public void setModifiedDate(Date modifiedDate) {
228                    _modifiedDate = modifiedDate;
229            }
230    
231            public long getProposalId() {
232                    return _proposalId;
233            }
234    
235            public void setProposalId(long proposalId) {
236                    _proposalId = proposalId;
237    
238                    if (!_setOriginalProposalId) {
239                            _setOriginalProposalId = true;
240    
241                            _originalProposalId = proposalId;
242                    }
243            }
244    
245            public long getOriginalProposalId() {
246                    return _originalProposalId;
247            }
248    
249            public long getAssignedByUserId() {
250                    return _assignedByUserId;
251            }
252    
253            public void setAssignedByUserId(long assignedByUserId) {
254                    _assignedByUserId = assignedByUserId;
255            }
256    
257            public String getAssignedByUserUuid() throws SystemException {
258                    return PortalUtil.getUserValue(getAssignedByUserId(), "uuid",
259                            _assignedByUserUuid);
260            }
261    
262            public void setAssignedByUserUuid(String assignedByUserUuid) {
263                    _assignedByUserUuid = assignedByUserUuid;
264            }
265    
266            public String getAssignedByUserName() {
267                    if (_assignedByUserName == null) {
268                            return StringPool.BLANK;
269                    }
270                    else {
271                            return _assignedByUserName;
272                    }
273            }
274    
275            public void setAssignedByUserName(String assignedByUserName) {
276                    _assignedByUserName = assignedByUserName;
277            }
278    
279            public int getStage() {
280                    return _stage;
281            }
282    
283            public void setStage(int stage) {
284                    _stage = stage;
285            }
286    
287            public boolean getCompleted() {
288                    return _completed;
289            }
290    
291            public boolean isCompleted() {
292                    return _completed;
293            }
294    
295            public void setCompleted(boolean completed) {
296                    _completed = completed;
297            }
298    
299            public boolean getRejected() {
300                    return _rejected;
301            }
302    
303            public boolean isRejected() {
304                    return _rejected;
305            }
306    
307            public void setRejected(boolean rejected) {
308                    _rejected = rejected;
309            }
310    
311            public TasksReview toEscapedModel() {
312                    if (isEscapedModel()) {
313                            return (TasksReview)this;
314                    }
315                    else {
316                            return (TasksReview)Proxy.newProxyInstance(TasksReview.class.getClassLoader(),
317                                    new Class[] { TasksReview.class },
318                                    new AutoEscapeBeanHandler(this));
319                    }
320            }
321    
322            public ExpandoBridge getExpandoBridge() {
323                    if (_expandoBridge == null) {
324                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
325                                            TasksReview.class.getName(), getPrimaryKey());
326                    }
327    
328                    return _expandoBridge;
329            }
330    
331            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
332                    getExpandoBridge().setAttributes(serviceContext);
333            }
334    
335            public Object clone() {
336                    TasksReviewImpl clone = new TasksReviewImpl();
337    
338                    clone.setReviewId(getReviewId());
339                    clone.setGroupId(getGroupId());
340                    clone.setCompanyId(getCompanyId());
341                    clone.setUserId(getUserId());
342                    clone.setUserName(getUserName());
343                    clone.setCreateDate(getCreateDate());
344                    clone.setModifiedDate(getModifiedDate());
345                    clone.setProposalId(getProposalId());
346                    clone.setAssignedByUserId(getAssignedByUserId());
347                    clone.setAssignedByUserName(getAssignedByUserName());
348                    clone.setStage(getStage());
349                    clone.setCompleted(getCompleted());
350                    clone.setRejected(getRejected());
351    
352                    return clone;
353            }
354    
355            public int compareTo(TasksReview tasksReview) {
356                    int value = 0;
357    
358                    value = DateUtil.compareTo(getCreateDate(), tasksReview.getCreateDate());
359    
360                    if (value != 0) {
361                            return value;
362                    }
363    
364                    return 0;
365            }
366    
367            public boolean equals(Object obj) {
368                    if (obj == null) {
369                            return false;
370                    }
371    
372                    TasksReview tasksReview = null;
373    
374                    try {
375                            tasksReview = (TasksReview)obj;
376                    }
377                    catch (ClassCastException cce) {
378                            return false;
379                    }
380    
381                    long pk = tasksReview.getPrimaryKey();
382    
383                    if (getPrimaryKey() == pk) {
384                            return true;
385                    }
386                    else {
387                            return false;
388                    }
389            }
390    
391            public int hashCode() {
392                    return (int)getPrimaryKey();
393            }
394    
395            public String toString() {
396                    StringBundler sb = new StringBundler(27);
397    
398                    sb.append("{reviewId=");
399                    sb.append(getReviewId());
400                    sb.append(", groupId=");
401                    sb.append(getGroupId());
402                    sb.append(", companyId=");
403                    sb.append(getCompanyId());
404                    sb.append(", userId=");
405                    sb.append(getUserId());
406                    sb.append(", userName=");
407                    sb.append(getUserName());
408                    sb.append(", createDate=");
409                    sb.append(getCreateDate());
410                    sb.append(", modifiedDate=");
411                    sb.append(getModifiedDate());
412                    sb.append(", proposalId=");
413                    sb.append(getProposalId());
414                    sb.append(", assignedByUserId=");
415                    sb.append(getAssignedByUserId());
416                    sb.append(", assignedByUserName=");
417                    sb.append(getAssignedByUserName());
418                    sb.append(", stage=");
419                    sb.append(getStage());
420                    sb.append(", completed=");
421                    sb.append(getCompleted());
422                    sb.append(", rejected=");
423                    sb.append(getRejected());
424                    sb.append("}");
425    
426                    return sb.toString();
427            }
428    
429            public String toXmlString() {
430                    StringBundler sb = new StringBundler(43);
431    
432                    sb.append("<model><model-name>");
433                    sb.append("com.liferay.portlet.tasks.model.TasksReview");
434                    sb.append("</model-name>");
435    
436                    sb.append(
437                            "<column><column-name>reviewId</column-name><column-value><![CDATA[");
438                    sb.append(getReviewId());
439                    sb.append("]]></column-value></column>");
440                    sb.append(
441                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
442                    sb.append(getGroupId());
443                    sb.append("]]></column-value></column>");
444                    sb.append(
445                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
446                    sb.append(getCompanyId());
447                    sb.append("]]></column-value></column>");
448                    sb.append(
449                            "<column><column-name>userId</column-name><column-value><![CDATA[");
450                    sb.append(getUserId());
451                    sb.append("]]></column-value></column>");
452                    sb.append(
453                            "<column><column-name>userName</column-name><column-value><![CDATA[");
454                    sb.append(getUserName());
455                    sb.append("]]></column-value></column>");
456                    sb.append(
457                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
458                    sb.append(getCreateDate());
459                    sb.append("]]></column-value></column>");
460                    sb.append(
461                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
462                    sb.append(getModifiedDate());
463                    sb.append("]]></column-value></column>");
464                    sb.append(
465                            "<column><column-name>proposalId</column-name><column-value><![CDATA[");
466                    sb.append(getProposalId());
467                    sb.append("]]></column-value></column>");
468                    sb.append(
469                            "<column><column-name>assignedByUserId</column-name><column-value><![CDATA[");
470                    sb.append(getAssignedByUserId());
471                    sb.append("]]></column-value></column>");
472                    sb.append(
473                            "<column><column-name>assignedByUserName</column-name><column-value><![CDATA[");
474                    sb.append(getAssignedByUserName());
475                    sb.append("]]></column-value></column>");
476                    sb.append(
477                            "<column><column-name>stage</column-name><column-value><![CDATA[");
478                    sb.append(getStage());
479                    sb.append("]]></column-value></column>");
480                    sb.append(
481                            "<column><column-name>completed</column-name><column-value><![CDATA[");
482                    sb.append(getCompleted());
483                    sb.append("]]></column-value></column>");
484                    sb.append(
485                            "<column><column-name>rejected</column-name><column-value><![CDATA[");
486                    sb.append(getRejected());
487                    sb.append("]]></column-value></column>");
488    
489                    sb.append("</model>");
490    
491                    return sb.toString();
492            }
493    
494            private long _reviewId;
495            private long _groupId;
496            private long _companyId;
497            private long _userId;
498            private String _userUuid;
499            private long _originalUserId;
500            private boolean _setOriginalUserId;
501            private String _userName;
502            private Date _createDate;
503            private Date _modifiedDate;
504            private long _proposalId;
505            private long _originalProposalId;
506            private boolean _setOriginalProposalId;
507            private long _assignedByUserId;
508            private String _assignedByUserUuid;
509            private String _assignedByUserName;
510            private int _stage;
511            private boolean _completed;
512            private boolean _rejected;
513            private transient ExpandoBridge _expandoBridge;
514    }