001    /**
002     * Copyright (c) 2000-2011 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.documentlibrary.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.GetterUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.kernel.workflow.WorkflowConstants;
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.documentlibrary.model.DLFileShortcut;
028    import com.liferay.portlet.documentlibrary.model.DLFileShortcutModel;
029    import com.liferay.portlet.documentlibrary.model.DLFileShortcutSoap;
030    import com.liferay.portlet.expando.model.ExpandoBridge;
031    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
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 DLFileShortcut service. Represents a row in the "DLFileShortcut" 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.documentlibrary.model.DLFileShortcutModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link DLFileShortcutImpl}.
048     * </p>
049     *
050     * <p>
051     * Never modify or reference this class directly. All methods that expect a d l file shortcut model instance should use the {@link com.liferay.portlet.documentlibrary.model.DLFileShortcut} interface instead.
052     * </p>
053     *
054     * @author Brian Wing Shun Chan
055     * @see DLFileShortcutImpl
056     * @see com.liferay.portlet.documentlibrary.model.DLFileShortcut
057     * @see com.liferay.portlet.documentlibrary.model.DLFileShortcutModel
058     * @generated
059     */
060    public class DLFileShortcutModelImpl extends BaseModelImpl<DLFileShortcut>
061            implements DLFileShortcutModel {
062            public static final String TABLE_NAME = "DLFileShortcut";
063            public static final Object[][] TABLE_COLUMNS = {
064                            { "uuid_", new Integer(Types.VARCHAR) },
065                            { "fileShortcutId", new Integer(Types.BIGINT) },
066                            { "groupId", new Integer(Types.BIGINT) },
067                            { "companyId", new Integer(Types.BIGINT) },
068                            { "userId", new Integer(Types.BIGINT) },
069                            { "userName", new Integer(Types.VARCHAR) },
070                            { "createDate", new Integer(Types.TIMESTAMP) },
071                            { "modifiedDate", new Integer(Types.TIMESTAMP) },
072                            { "folderId", new Integer(Types.BIGINT) },
073                            { "toFolderId", new Integer(Types.BIGINT) },
074                            { "toName", new Integer(Types.VARCHAR) },
075                            { "status", new Integer(Types.INTEGER) },
076                            { "statusByUserId", new Integer(Types.BIGINT) },
077                            { "statusByUserName", new Integer(Types.VARCHAR) },
078                            { "statusDate", new Integer(Types.TIMESTAMP) }
079                    };
080            public static final String TABLE_SQL_CREATE = "create table DLFileShortcut (uuid_ VARCHAR(75) null,fileShortcutId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,folderId LONG,toFolderId LONG,toName VARCHAR(255) null,status INTEGER,statusByUserId LONG,statusByUserName VARCHAR(75) null,statusDate DATE null)";
081            public static final String TABLE_SQL_DROP = "drop table DLFileShortcut";
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.documentlibrary.model.DLFileShortcut"),
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.documentlibrary.model.DLFileShortcut"),
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 DLFileShortcut toModel(DLFileShortcutSoap soapModel) {
099                    DLFileShortcut model = new DLFileShortcutImpl();
100    
101                    model.setUuid(soapModel.getUuid());
102                    model.setFileShortcutId(soapModel.getFileShortcutId());
103                    model.setGroupId(soapModel.getGroupId());
104                    model.setCompanyId(soapModel.getCompanyId());
105                    model.setUserId(soapModel.getUserId());
106                    model.setUserName(soapModel.getUserName());
107                    model.setCreateDate(soapModel.getCreateDate());
108                    model.setModifiedDate(soapModel.getModifiedDate());
109                    model.setFolderId(soapModel.getFolderId());
110                    model.setToFolderId(soapModel.getToFolderId());
111                    model.setToName(soapModel.getToName());
112                    model.setStatus(soapModel.getStatus());
113                    model.setStatusByUserId(soapModel.getStatusByUserId());
114                    model.setStatusByUserName(soapModel.getStatusByUserName());
115                    model.setStatusDate(soapModel.getStatusDate());
116    
117                    return model;
118            }
119    
120            /**
121             * Converts the soap model instances into normal model instances.
122             *
123             * @param soapModels the soap model instances to convert
124             * @return the normal model instances
125             */
126            public static List<DLFileShortcut> toModels(DLFileShortcutSoap[] soapModels) {
127                    List<DLFileShortcut> models = new ArrayList<DLFileShortcut>(soapModels.length);
128    
129                    for (DLFileShortcutSoap soapModel : soapModels) {
130                            models.add(toModel(soapModel));
131                    }
132    
133                    return models;
134            }
135    
136            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
137                                    "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileShortcut"));
138    
139            public DLFileShortcutModelImpl() {
140            }
141    
142            public long getPrimaryKey() {
143                    return _fileShortcutId;
144            }
145    
146            public void setPrimaryKey(long pk) {
147                    setFileShortcutId(pk);
148            }
149    
150            public Serializable getPrimaryKeyObj() {
151                    return new Long(_fileShortcutId);
152            }
153    
154            public String getUuid() {
155                    if (_uuid == null) {
156                            return StringPool.BLANK;
157                    }
158                    else {
159                            return _uuid;
160                    }
161            }
162    
163            public void setUuid(String uuid) {
164                    if (_originalUuid == null) {
165                            _originalUuid = _uuid;
166                    }
167    
168                    _uuid = uuid;
169            }
170    
171            public String getOriginalUuid() {
172                    return GetterUtil.getString(_originalUuid);
173            }
174    
175            public long getFileShortcutId() {
176                    return _fileShortcutId;
177            }
178    
179            public void setFileShortcutId(long fileShortcutId) {
180                    _fileShortcutId = fileShortcutId;
181            }
182    
183            public long getGroupId() {
184                    return _groupId;
185            }
186    
187            public void setGroupId(long groupId) {
188                    if (!_setOriginalGroupId) {
189                            _setOriginalGroupId = true;
190    
191                            _originalGroupId = _groupId;
192                    }
193    
194                    _groupId = groupId;
195            }
196    
197            public long getOriginalGroupId() {
198                    return _originalGroupId;
199            }
200    
201            public long getCompanyId() {
202                    return _companyId;
203            }
204    
205            public void setCompanyId(long companyId) {
206                    _companyId = companyId;
207            }
208    
209            public long getUserId() {
210                    return _userId;
211            }
212    
213            public void setUserId(long userId) {
214                    _userId = userId;
215            }
216    
217            public String getUserUuid() throws SystemException {
218                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
219            }
220    
221            public void setUserUuid(String userUuid) {
222                    _userUuid = userUuid;
223            }
224    
225            public String getUserName() {
226                    if (_userName == null) {
227                            return StringPool.BLANK;
228                    }
229                    else {
230                            return _userName;
231                    }
232            }
233    
234            public void setUserName(String userName) {
235                    _userName = userName;
236            }
237    
238            public Date getCreateDate() {
239                    return _createDate;
240            }
241    
242            public void setCreateDate(Date createDate) {
243                    _createDate = createDate;
244            }
245    
246            public Date getModifiedDate() {
247                    return _modifiedDate;
248            }
249    
250            public void setModifiedDate(Date modifiedDate) {
251                    _modifiedDate = modifiedDate;
252            }
253    
254            public long getFolderId() {
255                    return _folderId;
256            }
257    
258            public void setFolderId(long folderId) {
259                    _folderId = folderId;
260            }
261    
262            public long getToFolderId() {
263                    return _toFolderId;
264            }
265    
266            public void setToFolderId(long toFolderId) {
267                    _toFolderId = toFolderId;
268            }
269    
270            public String getToName() {
271                    if (_toName == null) {
272                            return StringPool.BLANK;
273                    }
274                    else {
275                            return _toName;
276                    }
277            }
278    
279            public void setToName(String toName) {
280                    _toName = toName;
281            }
282    
283            public int getStatus() {
284                    return _status;
285            }
286    
287            public void setStatus(int status) {
288                    _status = status;
289            }
290    
291            public long getStatusByUserId() {
292                    return _statusByUserId;
293            }
294    
295            public void setStatusByUserId(long statusByUserId) {
296                    _statusByUserId = statusByUserId;
297            }
298    
299            public String getStatusByUserUuid() throws SystemException {
300                    return PortalUtil.getUserValue(getStatusByUserId(), "uuid",
301                            _statusByUserUuid);
302            }
303    
304            public void setStatusByUserUuid(String statusByUserUuid) {
305                    _statusByUserUuid = statusByUserUuid;
306            }
307    
308            public String getStatusByUserName() {
309                    if (_statusByUserName == null) {
310                            return StringPool.BLANK;
311                    }
312                    else {
313                            return _statusByUserName;
314                    }
315            }
316    
317            public void setStatusByUserName(String statusByUserName) {
318                    _statusByUserName = statusByUserName;
319            }
320    
321            public Date getStatusDate() {
322                    return _statusDate;
323            }
324    
325            public void setStatusDate(Date statusDate) {
326                    _statusDate = statusDate;
327            }
328    
329            public boolean isApproved() {
330                    if (getStatus() == WorkflowConstants.STATUS_APPROVED) {
331                            return true;
332                    }
333                    else {
334                            return false;
335                    }
336            }
337    
338            public boolean isDraft() {
339                    if (getStatus() == WorkflowConstants.STATUS_DRAFT) {
340                            return true;
341                    }
342                    else {
343                            return false;
344                    }
345            }
346    
347            public boolean isExpired() {
348                    if (getStatus() == WorkflowConstants.STATUS_EXPIRED) {
349                            return true;
350                    }
351                    else {
352                            return false;
353                    }
354            }
355    
356            public boolean isPending() {
357                    if (getStatus() == WorkflowConstants.STATUS_PENDING) {
358                            return true;
359                    }
360                    else {
361                            return false;
362                    }
363            }
364    
365            public DLFileShortcut toEscapedModel() {
366                    if (isEscapedModel()) {
367                            return (DLFileShortcut)this;
368                    }
369                    else {
370                            return (DLFileShortcut)Proxy.newProxyInstance(DLFileShortcut.class.getClassLoader(),
371                                    new Class[] { DLFileShortcut.class },
372                                    new AutoEscapeBeanHandler(this));
373                    }
374            }
375    
376            public ExpandoBridge getExpandoBridge() {
377                    if (_expandoBridge == null) {
378                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
379                                            DLFileShortcut.class.getName(), getPrimaryKey());
380                    }
381    
382                    return _expandoBridge;
383            }
384    
385            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
386                    getExpandoBridge().setAttributes(serviceContext);
387            }
388    
389            public Object clone() {
390                    DLFileShortcutImpl dlFileShortcutImpl = new DLFileShortcutImpl();
391    
392                    dlFileShortcutImpl.setUuid(getUuid());
393    
394                    DLFileShortcutModelImpl dlFileShortcutModelImpl = dlFileShortcutImpl;
395    
396                    dlFileShortcutModelImpl._originalUuid = dlFileShortcutModelImpl._uuid;
397    
398                    dlFileShortcutImpl.setFileShortcutId(getFileShortcutId());
399    
400                    dlFileShortcutImpl.setGroupId(getGroupId());
401    
402                    dlFileShortcutModelImpl._originalGroupId = dlFileShortcutModelImpl._groupId;
403    
404                    dlFileShortcutModelImpl._setOriginalGroupId = false;
405                    dlFileShortcutImpl.setCompanyId(getCompanyId());
406    
407                    dlFileShortcutImpl.setUserId(getUserId());
408    
409                    dlFileShortcutImpl.setUserName(getUserName());
410    
411                    dlFileShortcutImpl.setCreateDate(getCreateDate());
412    
413                    dlFileShortcutImpl.setModifiedDate(getModifiedDate());
414    
415                    dlFileShortcutImpl.setFolderId(getFolderId());
416    
417                    dlFileShortcutImpl.setToFolderId(getToFolderId());
418    
419                    dlFileShortcutImpl.setToName(getToName());
420    
421                    dlFileShortcutImpl.setStatus(getStatus());
422    
423                    dlFileShortcutImpl.setStatusByUserId(getStatusByUserId());
424    
425                    dlFileShortcutImpl.setStatusByUserName(getStatusByUserName());
426    
427                    dlFileShortcutImpl.setStatusDate(getStatusDate());
428    
429                    return dlFileShortcutImpl;
430            }
431    
432            public int compareTo(DLFileShortcut dlFileShortcut) {
433                    long pk = dlFileShortcut.getPrimaryKey();
434    
435                    if (getPrimaryKey() < pk) {
436                            return -1;
437                    }
438                    else if (getPrimaryKey() > pk) {
439                            return 1;
440                    }
441                    else {
442                            return 0;
443                    }
444            }
445    
446            public boolean equals(Object obj) {
447                    if (obj == null) {
448                            return false;
449                    }
450    
451                    DLFileShortcut dlFileShortcut = null;
452    
453                    try {
454                            dlFileShortcut = (DLFileShortcut)obj;
455                    }
456                    catch (ClassCastException cce) {
457                            return false;
458                    }
459    
460                    long pk = dlFileShortcut.getPrimaryKey();
461    
462                    if (getPrimaryKey() == pk) {
463                            return true;
464                    }
465                    else {
466                            return false;
467                    }
468            }
469    
470            public int hashCode() {
471                    return (int)getPrimaryKey();
472            }
473    
474            public String toString() {
475                    StringBundler sb = new StringBundler(31);
476    
477                    sb.append("{uuid=");
478                    sb.append(getUuid());
479                    sb.append(", fileShortcutId=");
480                    sb.append(getFileShortcutId());
481                    sb.append(", groupId=");
482                    sb.append(getGroupId());
483                    sb.append(", companyId=");
484                    sb.append(getCompanyId());
485                    sb.append(", userId=");
486                    sb.append(getUserId());
487                    sb.append(", userName=");
488                    sb.append(getUserName());
489                    sb.append(", createDate=");
490                    sb.append(getCreateDate());
491                    sb.append(", modifiedDate=");
492                    sb.append(getModifiedDate());
493                    sb.append(", folderId=");
494                    sb.append(getFolderId());
495                    sb.append(", toFolderId=");
496                    sb.append(getToFolderId());
497                    sb.append(", toName=");
498                    sb.append(getToName());
499                    sb.append(", status=");
500                    sb.append(getStatus());
501                    sb.append(", statusByUserId=");
502                    sb.append(getStatusByUserId());
503                    sb.append(", statusByUserName=");
504                    sb.append(getStatusByUserName());
505                    sb.append(", statusDate=");
506                    sb.append(getStatusDate());
507                    sb.append("}");
508    
509                    return sb.toString();
510            }
511    
512            public String toXmlString() {
513                    StringBundler sb = new StringBundler(49);
514    
515                    sb.append("<model><model-name>");
516                    sb.append("com.liferay.portlet.documentlibrary.model.DLFileShortcut");
517                    sb.append("</model-name>");
518    
519                    sb.append(
520                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
521                    sb.append(getUuid());
522                    sb.append("]]></column-value></column>");
523                    sb.append(
524                            "<column><column-name>fileShortcutId</column-name><column-value><![CDATA[");
525                    sb.append(getFileShortcutId());
526                    sb.append("]]></column-value></column>");
527                    sb.append(
528                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
529                    sb.append(getGroupId());
530                    sb.append("]]></column-value></column>");
531                    sb.append(
532                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
533                    sb.append(getCompanyId());
534                    sb.append("]]></column-value></column>");
535                    sb.append(
536                            "<column><column-name>userId</column-name><column-value><![CDATA[");
537                    sb.append(getUserId());
538                    sb.append("]]></column-value></column>");
539                    sb.append(
540                            "<column><column-name>userName</column-name><column-value><![CDATA[");
541                    sb.append(getUserName());
542                    sb.append("]]></column-value></column>");
543                    sb.append(
544                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
545                    sb.append(getCreateDate());
546                    sb.append("]]></column-value></column>");
547                    sb.append(
548                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
549                    sb.append(getModifiedDate());
550                    sb.append("]]></column-value></column>");
551                    sb.append(
552                            "<column><column-name>folderId</column-name><column-value><![CDATA[");
553                    sb.append(getFolderId());
554                    sb.append("]]></column-value></column>");
555                    sb.append(
556                            "<column><column-name>toFolderId</column-name><column-value><![CDATA[");
557                    sb.append(getToFolderId());
558                    sb.append("]]></column-value></column>");
559                    sb.append(
560                            "<column><column-name>toName</column-name><column-value><![CDATA[");
561                    sb.append(getToName());
562                    sb.append("]]></column-value></column>");
563                    sb.append(
564                            "<column><column-name>status</column-name><column-value><![CDATA[");
565                    sb.append(getStatus());
566                    sb.append("]]></column-value></column>");
567                    sb.append(
568                            "<column><column-name>statusByUserId</column-name><column-value><![CDATA[");
569                    sb.append(getStatusByUserId());
570                    sb.append("]]></column-value></column>");
571                    sb.append(
572                            "<column><column-name>statusByUserName</column-name><column-value><![CDATA[");
573                    sb.append(getStatusByUserName());
574                    sb.append("]]></column-value></column>");
575                    sb.append(
576                            "<column><column-name>statusDate</column-name><column-value><![CDATA[");
577                    sb.append(getStatusDate());
578                    sb.append("]]></column-value></column>");
579    
580                    sb.append("</model>");
581    
582                    return sb.toString();
583            }
584    
585            private String _uuid;
586            private String _originalUuid;
587            private long _fileShortcutId;
588            private long _groupId;
589            private long _originalGroupId;
590            private boolean _setOriginalGroupId;
591            private long _companyId;
592            private long _userId;
593            private String _userUuid;
594            private String _userName;
595            private Date _createDate;
596            private Date _modifiedDate;
597            private long _folderId;
598            private long _toFolderId;
599            private String _toName;
600            private int _status;
601            private long _statusByUserId;
602            private String _statusByUserUuid;
603            private String _statusByUserName;
604            private Date _statusDate;
605            private transient ExpandoBridge _expandoBridge;
606    }