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.document.library.kernel.model.DLFileRank;
020    
021    import com.liferay.portal.kernel.model.CacheModel;
022    import com.liferay.portal.kernel.util.HashUtil;
023    import com.liferay.portal.kernel.util.StringBundler;
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 DLFileRank in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see DLFileRank
037     * @generated
038     */
039    @ProviderType
040    public class DLFileRankCacheModel implements CacheModel<DLFileRank>,
041            Externalizable {
042            @Override
043            public boolean equals(Object obj) {
044                    if (this == obj) {
045                            return true;
046                    }
047    
048                    if (!(obj instanceof DLFileRankCacheModel)) {
049                            return false;
050                    }
051    
052                    DLFileRankCacheModel dlFileRankCacheModel = (DLFileRankCacheModel)obj;
053    
054                    if (fileRankId == dlFileRankCacheModel.fileRankId) {
055                            return true;
056                    }
057    
058                    return false;
059            }
060    
061            @Override
062            public int hashCode() {
063                    return HashUtil.hash(0, fileRankId);
064            }
065    
066            @Override
067            public String toString() {
068                    StringBundler sb = new StringBundler(15);
069    
070                    sb.append("{fileRankId=");
071                    sb.append(fileRankId);
072                    sb.append(", groupId=");
073                    sb.append(groupId);
074                    sb.append(", companyId=");
075                    sb.append(companyId);
076                    sb.append(", userId=");
077                    sb.append(userId);
078                    sb.append(", createDate=");
079                    sb.append(createDate);
080                    sb.append(", fileEntryId=");
081                    sb.append(fileEntryId);
082                    sb.append(", active=");
083                    sb.append(active);
084                    sb.append("}");
085    
086                    return sb.toString();
087            }
088    
089            @Override
090            public DLFileRank toEntityModel() {
091                    DLFileRankImpl dlFileRankImpl = new DLFileRankImpl();
092    
093                    dlFileRankImpl.setFileRankId(fileRankId);
094                    dlFileRankImpl.setGroupId(groupId);
095                    dlFileRankImpl.setCompanyId(companyId);
096                    dlFileRankImpl.setUserId(userId);
097    
098                    if (createDate == Long.MIN_VALUE) {
099                            dlFileRankImpl.setCreateDate(null);
100                    }
101                    else {
102                            dlFileRankImpl.setCreateDate(new Date(createDate));
103                    }
104    
105                    dlFileRankImpl.setFileEntryId(fileEntryId);
106                    dlFileRankImpl.setActive(active);
107    
108                    dlFileRankImpl.resetOriginalValues();
109    
110                    return dlFileRankImpl;
111            }
112    
113            @Override
114            public void readExternal(ObjectInput objectInput) throws IOException {
115                    fileRankId = objectInput.readLong();
116    
117                    groupId = objectInput.readLong();
118    
119                    companyId = objectInput.readLong();
120    
121                    userId = objectInput.readLong();
122                    createDate = objectInput.readLong();
123    
124                    fileEntryId = objectInput.readLong();
125    
126                    active = objectInput.readBoolean();
127            }
128    
129            @Override
130            public void writeExternal(ObjectOutput objectOutput)
131                    throws IOException {
132                    objectOutput.writeLong(fileRankId);
133    
134                    objectOutput.writeLong(groupId);
135    
136                    objectOutput.writeLong(companyId);
137    
138                    objectOutput.writeLong(userId);
139                    objectOutput.writeLong(createDate);
140    
141                    objectOutput.writeLong(fileEntryId);
142    
143                    objectOutput.writeBoolean(active);
144            }
145    
146            public long fileRankId;
147            public long groupId;
148            public long companyId;
149            public long userId;
150            public long createDate;
151            public long fileEntryId;
152            public boolean active;
153    }