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.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.asset.model.AssetTagStats;
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(9);
067    
068                    sb.append("{tagStatsId=");
069                    sb.append(tagStatsId);
070                    sb.append(", tagId=");
071                    sb.append(tagId);
072                    sb.append(", classNameId=");
073                    sb.append(classNameId);
074                    sb.append(", assetCount=");
075                    sb.append(assetCount);
076                    sb.append("}");
077    
078                    return sb.toString();
079            }
080    
081            @Override
082            public AssetTagStats toEntityModel() {
083                    AssetTagStatsImpl assetTagStatsImpl = new AssetTagStatsImpl();
084    
085                    assetTagStatsImpl.setTagStatsId(tagStatsId);
086                    assetTagStatsImpl.setTagId(tagId);
087                    assetTagStatsImpl.setClassNameId(classNameId);
088                    assetTagStatsImpl.setAssetCount(assetCount);
089    
090                    assetTagStatsImpl.resetOriginalValues();
091    
092                    return assetTagStatsImpl;
093            }
094    
095            @Override
096            public void readExternal(ObjectInput objectInput) throws IOException {
097                    tagStatsId = objectInput.readLong();
098                    tagId = objectInput.readLong();
099                    classNameId = objectInput.readLong();
100                    assetCount = objectInput.readInt();
101            }
102    
103            @Override
104            public void writeExternal(ObjectOutput objectOutput)
105                    throws IOException {
106                    objectOutput.writeLong(tagStatsId);
107                    objectOutput.writeLong(tagId);
108                    objectOutput.writeLong(classNameId);
109                    objectOutput.writeInt(assetCount);
110            }
111    
112            public long tagStatsId;
113            public long tagId;
114            public long classNameId;
115            public int assetCount;
116    }