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.asset.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.asset.kernel.model.AssetTagStats;
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    /**
031     * The cache model class for representing AssetTagStats in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see AssetTagStats
035     * @generated
036     */
037    @ProviderType
038    public class AssetTagStatsCacheModel implements CacheModel<AssetTagStats>,
039            Externalizable {
040            @Override
041            public boolean equals(Object obj) {
042                    if (this == obj) {
043                            return true;
044                    }
045    
046                    if (!(obj instanceof AssetTagStatsCacheModel)) {
047                            return false;
048                    }
049    
050                    AssetTagStatsCacheModel assetTagStatsCacheModel = (AssetTagStatsCacheModel)obj;
051    
052                    if (tagStatsId == assetTagStatsCacheModel.tagStatsId) {
053                            return true;
054                    }
055    
056                    return false;
057            }
058    
059            @Override
060            public int hashCode() {
061                    return HashUtil.hash(0, tagStatsId);
062            }
063    
064            @Override
065            public String toString() {
066                    StringBundler sb = new StringBundler(11);
067    
068                    sb.append("{tagStatsId=");
069                    sb.append(tagStatsId);
070                    sb.append(", companyId=");
071                    sb.append(companyId);
072                    sb.append(", tagId=");
073                    sb.append(tagId);
074                    sb.append(", classNameId=");
075                    sb.append(classNameId);
076                    sb.append(", assetCount=");
077                    sb.append(assetCount);
078                    sb.append("}");
079    
080                    return sb.toString();
081            }
082    
083            @Override
084            public AssetTagStats toEntityModel() {
085                    AssetTagStatsImpl assetTagStatsImpl = new AssetTagStatsImpl();
086    
087                    assetTagStatsImpl.setTagStatsId(tagStatsId);
088                    assetTagStatsImpl.setCompanyId(companyId);
089                    assetTagStatsImpl.setTagId(tagId);
090                    assetTagStatsImpl.setClassNameId(classNameId);
091                    assetTagStatsImpl.setAssetCount(assetCount);
092    
093                    assetTagStatsImpl.resetOriginalValues();
094    
095                    return assetTagStatsImpl;
096            }
097    
098            @Override
099            public void readExternal(ObjectInput objectInput) throws IOException {
100                    tagStatsId = objectInput.readLong();
101    
102                    companyId = objectInput.readLong();
103    
104                    tagId = objectInput.readLong();
105    
106                    classNameId = objectInput.readLong();
107    
108                    assetCount = objectInput.readInt();
109            }
110    
111            @Override
112            public void writeExternal(ObjectOutput objectOutput)
113                    throws IOException {
114                    objectOutput.writeLong(tagStatsId);
115    
116                    objectOutput.writeLong(companyId);
117    
118                    objectOutput.writeLong(tagId);
119    
120                    objectOutput.writeLong(classNameId);
121    
122                    objectOutput.writeInt(assetCount);
123            }
124    
125            public long tagStatsId;
126            public long companyId;
127            public long tagId;
128            public long classNameId;
129            public int assetCount;
130    }