001    /**
002     * Copyright (c) 2000-2012 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.DLFileRank;
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 DLFileRank in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see DLFileRank
035     * @generated
036     */
037    public class DLFileRankCacheModel implements CacheModel<DLFileRank>,
038            Externalizable {
039            @Override
040            public String toString() {
041                    StringBundler sb = new StringBundler(21);
042    
043                    sb.append("{uuid=");
044                    sb.append(uuid);
045                    sb.append(", fileRankId=");
046                    sb.append(fileRankId);
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(", fileEntryId=");
060                    sb.append(fileEntryId);
061                    sb.append(", active=");
062                    sb.append(active);
063                    sb.append("}");
064    
065                    return sb.toString();
066            }
067    
068            public DLFileRank toEntityModel() {
069                    DLFileRankImpl dlFileRankImpl = new DLFileRankImpl();
070    
071                    if (uuid == null) {
072                            dlFileRankImpl.setUuid(StringPool.BLANK);
073                    }
074                    else {
075                            dlFileRankImpl.setUuid(uuid);
076                    }
077    
078                    dlFileRankImpl.setFileRankId(fileRankId);
079                    dlFileRankImpl.setGroupId(groupId);
080                    dlFileRankImpl.setCompanyId(companyId);
081                    dlFileRankImpl.setUserId(userId);
082    
083                    if (userName == null) {
084                            dlFileRankImpl.setUserName(StringPool.BLANK);
085                    }
086                    else {
087                            dlFileRankImpl.setUserName(userName);
088                    }
089    
090                    if (createDate == Long.MIN_VALUE) {
091                            dlFileRankImpl.setCreateDate(null);
092                    }
093                    else {
094                            dlFileRankImpl.setCreateDate(new Date(createDate));
095                    }
096    
097                    if (modifiedDate == Long.MIN_VALUE) {
098                            dlFileRankImpl.setModifiedDate(null);
099                    }
100                    else {
101                            dlFileRankImpl.setModifiedDate(new Date(modifiedDate));
102                    }
103    
104                    dlFileRankImpl.setFileEntryId(fileEntryId);
105                    dlFileRankImpl.setActive(active);
106    
107                    dlFileRankImpl.resetOriginalValues();
108    
109                    return dlFileRankImpl;
110            }
111    
112            public void readExternal(ObjectInput objectInput) throws IOException {
113                    uuid = objectInput.readUTF();
114                    fileRankId = objectInput.readLong();
115                    groupId = objectInput.readLong();
116                    companyId = objectInput.readLong();
117                    userId = objectInput.readLong();
118                    userName = objectInput.readUTF();
119                    createDate = objectInput.readLong();
120                    modifiedDate = objectInput.readLong();
121                    fileEntryId = objectInput.readLong();
122                    active = objectInput.readBoolean();
123            }
124    
125            public void writeExternal(ObjectOutput objectOutput)
126                    throws IOException {
127                    if (uuid == null) {
128                            objectOutput.writeUTF(StringPool.BLANK);
129                    }
130                    else {
131                            objectOutput.writeUTF(uuid);
132                    }
133    
134                    objectOutput.writeLong(fileRankId);
135                    objectOutput.writeLong(groupId);
136                    objectOutput.writeLong(companyId);
137                    objectOutput.writeLong(userId);
138    
139                    if (userName == null) {
140                            objectOutput.writeUTF(StringPool.BLANK);
141                    }
142                    else {
143                            objectOutput.writeUTF(userName);
144                    }
145    
146                    objectOutput.writeLong(createDate);
147                    objectOutput.writeLong(modifiedDate);
148                    objectOutput.writeLong(fileEntryId);
149                    objectOutput.writeBoolean(active);
150            }
151    
152            public String uuid;
153            public long fileRankId;
154            public long groupId;
155            public long companyId;
156            public long userId;
157            public String userName;
158            public long createDate;
159            public long modifiedDate;
160            public long fileEntryId;
161            public boolean active;
162    }