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.HashUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.model.CacheModel;
022    
023    import com.liferay.portlet.documentlibrary.model.DLFileRank;
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                    groupId = objectInput.readLong();
117                    companyId = objectInput.readLong();
118                    userId = objectInput.readLong();
119                    createDate = objectInput.readLong();
120                    fileEntryId = objectInput.readLong();
121                    active = objectInput.readBoolean();
122            }
123    
124            @Override
125            public void writeExternal(ObjectOutput objectOutput)
126                    throws IOException {
127                    objectOutput.writeLong(fileRankId);
128                    objectOutput.writeLong(groupId);
129                    objectOutput.writeLong(companyId);
130                    objectOutput.writeLong(userId);
131                    objectOutput.writeLong(createDate);
132                    objectOutput.writeLong(fileEntryId);
133                    objectOutput.writeBoolean(active);
134            }
135    
136            public long fileRankId;
137            public long groupId;
138            public long companyId;
139            public long userId;
140            public long createDate;
141            public long fileEntryId;
142            public boolean active;
143    }