001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    
023    import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    import java.util.Date;
031    
032    /**
033     * The cache model class for representing DLFileShortcut in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see DLFileShortcut
037     * @generated
038     */
039    @ProviderType
040    public class DLFileShortcutCacheModel implements CacheModel<DLFileShortcut>,
041            Externalizable {
042            @Override
043            public String toString() {
044                    StringBundler sb = new StringBundler(35);
045    
046                    sb.append("{uuid=");
047                    sb.append(uuid);
048                    sb.append(", fileShortcutId=");
049                    sb.append(fileShortcutId);
050                    sb.append(", groupId=");
051                    sb.append(groupId);
052                    sb.append(", companyId=");
053                    sb.append(companyId);
054                    sb.append(", userId=");
055                    sb.append(userId);
056                    sb.append(", userName=");
057                    sb.append(userName);
058                    sb.append(", createDate=");
059                    sb.append(createDate);
060                    sb.append(", modifiedDate=");
061                    sb.append(modifiedDate);
062                    sb.append(", repositoryId=");
063                    sb.append(repositoryId);
064                    sb.append(", folderId=");
065                    sb.append(folderId);
066                    sb.append(", toFileEntryId=");
067                    sb.append(toFileEntryId);
068                    sb.append(", treePath=");
069                    sb.append(treePath);
070                    sb.append(", active=");
071                    sb.append(active);
072                    sb.append(", status=");
073                    sb.append(status);
074                    sb.append(", statusByUserId=");
075                    sb.append(statusByUserId);
076                    sb.append(", statusByUserName=");
077                    sb.append(statusByUserName);
078                    sb.append(", statusDate=");
079                    sb.append(statusDate);
080                    sb.append("}");
081    
082                    return sb.toString();
083            }
084    
085            @Override
086            public DLFileShortcut toEntityModel() {
087                    DLFileShortcutImpl dlFileShortcutImpl = new DLFileShortcutImpl();
088    
089                    if (uuid == null) {
090                            dlFileShortcutImpl.setUuid(StringPool.BLANK);
091                    }
092                    else {
093                            dlFileShortcutImpl.setUuid(uuid);
094                    }
095    
096                    dlFileShortcutImpl.setFileShortcutId(fileShortcutId);
097                    dlFileShortcutImpl.setGroupId(groupId);
098                    dlFileShortcutImpl.setCompanyId(companyId);
099                    dlFileShortcutImpl.setUserId(userId);
100    
101                    if (userName == null) {
102                            dlFileShortcutImpl.setUserName(StringPool.BLANK);
103                    }
104                    else {
105                            dlFileShortcutImpl.setUserName(userName);
106                    }
107    
108                    if (createDate == Long.MIN_VALUE) {
109                            dlFileShortcutImpl.setCreateDate(null);
110                    }
111                    else {
112                            dlFileShortcutImpl.setCreateDate(new Date(createDate));
113                    }
114    
115                    if (modifiedDate == Long.MIN_VALUE) {
116                            dlFileShortcutImpl.setModifiedDate(null);
117                    }
118                    else {
119                            dlFileShortcutImpl.setModifiedDate(new Date(modifiedDate));
120                    }
121    
122                    dlFileShortcutImpl.setRepositoryId(repositoryId);
123                    dlFileShortcutImpl.setFolderId(folderId);
124                    dlFileShortcutImpl.setToFileEntryId(toFileEntryId);
125    
126                    if (treePath == null) {
127                            dlFileShortcutImpl.setTreePath(StringPool.BLANK);
128                    }
129                    else {
130                            dlFileShortcutImpl.setTreePath(treePath);
131                    }
132    
133                    dlFileShortcutImpl.setActive(active);
134                    dlFileShortcutImpl.setStatus(status);
135                    dlFileShortcutImpl.setStatusByUserId(statusByUserId);
136    
137                    if (statusByUserName == null) {
138                            dlFileShortcutImpl.setStatusByUserName(StringPool.BLANK);
139                    }
140                    else {
141                            dlFileShortcutImpl.setStatusByUserName(statusByUserName);
142                    }
143    
144                    if (statusDate == Long.MIN_VALUE) {
145                            dlFileShortcutImpl.setStatusDate(null);
146                    }
147                    else {
148                            dlFileShortcutImpl.setStatusDate(new Date(statusDate));
149                    }
150    
151                    dlFileShortcutImpl.resetOriginalValues();
152    
153                    return dlFileShortcutImpl;
154            }
155    
156            @Override
157            public void readExternal(ObjectInput objectInput) throws IOException {
158                    uuid = objectInput.readUTF();
159                    fileShortcutId = objectInput.readLong();
160                    groupId = objectInput.readLong();
161                    companyId = objectInput.readLong();
162                    userId = objectInput.readLong();
163                    userName = objectInput.readUTF();
164                    createDate = objectInput.readLong();
165                    modifiedDate = objectInput.readLong();
166                    repositoryId = objectInput.readLong();
167                    folderId = objectInput.readLong();
168                    toFileEntryId = objectInput.readLong();
169                    treePath = objectInput.readUTF();
170                    active = objectInput.readBoolean();
171                    status = objectInput.readInt();
172                    statusByUserId = objectInput.readLong();
173                    statusByUserName = objectInput.readUTF();
174                    statusDate = objectInput.readLong();
175            }
176    
177            @Override
178            public void writeExternal(ObjectOutput objectOutput)
179                    throws IOException {
180                    if (uuid == null) {
181                            objectOutput.writeUTF(StringPool.BLANK);
182                    }
183                    else {
184                            objectOutput.writeUTF(uuid);
185                    }
186    
187                    objectOutput.writeLong(fileShortcutId);
188                    objectOutput.writeLong(groupId);
189                    objectOutput.writeLong(companyId);
190                    objectOutput.writeLong(userId);
191    
192                    if (userName == null) {
193                            objectOutput.writeUTF(StringPool.BLANK);
194                    }
195                    else {
196                            objectOutput.writeUTF(userName);
197                    }
198    
199                    objectOutput.writeLong(createDate);
200                    objectOutput.writeLong(modifiedDate);
201                    objectOutput.writeLong(repositoryId);
202                    objectOutput.writeLong(folderId);
203                    objectOutput.writeLong(toFileEntryId);
204    
205                    if (treePath == null) {
206                            objectOutput.writeUTF(StringPool.BLANK);
207                    }
208                    else {
209                            objectOutput.writeUTF(treePath);
210                    }
211    
212                    objectOutput.writeBoolean(active);
213                    objectOutput.writeInt(status);
214                    objectOutput.writeLong(statusByUserId);
215    
216                    if (statusByUserName == null) {
217                            objectOutput.writeUTF(StringPool.BLANK);
218                    }
219                    else {
220                            objectOutput.writeUTF(statusByUserName);
221                    }
222    
223                    objectOutput.writeLong(statusDate);
224            }
225    
226            public String uuid;
227            public long fileShortcutId;
228            public long groupId;
229            public long companyId;
230            public long userId;
231            public String userName;
232            public long createDate;
233            public long modifiedDate;
234            public long repositoryId;
235            public long folderId;
236            public long toFileEntryId;
237            public String treePath;
238            public boolean active;
239            public int status;
240            public long statusByUserId;
241            public String statusByUserName;
242            public long statusDate;
243    }