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.model.CacheModel;
021    
022    import com.liferay.portlet.documentlibrary.model.DLFileRank;
023    
024    import java.io.Externalizable;
025    import java.io.IOException;
026    import java.io.ObjectInput;
027    import java.io.ObjectOutput;
028    
029    import java.util.Date;
030    
031    /**
032     * The cache model class for representing DLFileRank in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see DLFileRank
036     * @generated
037     */
038    @ProviderType
039    public class DLFileRankCacheModel implements CacheModel<DLFileRank>,
040            Externalizable {
041            @Override
042            public String toString() {
043                    StringBundler sb = new StringBundler(15);
044    
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(", createDate=");
054                    sb.append(createDate);
055                    sb.append(", fileEntryId=");
056                    sb.append(fileEntryId);
057                    sb.append(", active=");
058                    sb.append(active);
059                    sb.append("}");
060    
061                    return sb.toString();
062            }
063    
064            @Override
065            public DLFileRank toEntityModel() {
066                    DLFileRankImpl dlFileRankImpl = new DLFileRankImpl();
067    
068                    dlFileRankImpl.setFileRankId(fileRankId);
069                    dlFileRankImpl.setGroupId(groupId);
070                    dlFileRankImpl.setCompanyId(companyId);
071                    dlFileRankImpl.setUserId(userId);
072    
073                    if (createDate == Long.MIN_VALUE) {
074                            dlFileRankImpl.setCreateDate(null);
075                    }
076                    else {
077                            dlFileRankImpl.setCreateDate(new Date(createDate));
078                    }
079    
080                    dlFileRankImpl.setFileEntryId(fileEntryId);
081                    dlFileRankImpl.setActive(active);
082    
083                    dlFileRankImpl.resetOriginalValues();
084    
085                    return dlFileRankImpl;
086            }
087    
088            @Override
089            public void readExternal(ObjectInput objectInput) throws IOException {
090                    fileRankId = objectInput.readLong();
091                    groupId = objectInput.readLong();
092                    companyId = objectInput.readLong();
093                    userId = objectInput.readLong();
094                    createDate = objectInput.readLong();
095                    fileEntryId = objectInput.readLong();
096                    active = objectInput.readBoolean();
097            }
098    
099            @Override
100            public void writeExternal(ObjectOutput objectOutput)
101                    throws IOException {
102                    objectOutput.writeLong(fileRankId);
103                    objectOutput.writeLong(groupId);
104                    objectOutput.writeLong(companyId);
105                    objectOutput.writeLong(userId);
106                    objectOutput.writeLong(createDate);
107                    objectOutput.writeLong(fileEntryId);
108                    objectOutput.writeBoolean(active);
109            }
110    
111            public long fileRankId;
112            public long groupId;
113            public long companyId;
114            public long userId;
115            public long createDate;
116            public long fileEntryId;
117            public boolean active;
118    }