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