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.social.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.kernel.util.StringPool;
022    import com.liferay.portal.model.CacheModel;
023    
024    import com.liferay.portlet.social.model.SocialActivitySetting;
025    
026    import java.io.Externalizable;
027    import java.io.IOException;
028    import java.io.ObjectInput;
029    import java.io.ObjectOutput;
030    
031    /**
032     * The cache model class for representing SocialActivitySetting in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see SocialActivitySetting
036     * @generated
037     */
038    @ProviderType
039    public class SocialActivitySettingCacheModel implements CacheModel<SocialActivitySetting>,
040            Externalizable {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof SocialActivitySettingCacheModel)) {
048                            return false;
049                    }
050    
051                    SocialActivitySettingCacheModel socialActivitySettingCacheModel = (SocialActivitySettingCacheModel)obj;
052    
053                    if (activitySettingId == socialActivitySettingCacheModel.activitySettingId) {
054                            return true;
055                    }
056    
057                    return false;
058            }
059    
060            @Override
061            public int hashCode() {
062                    return HashUtil.hash(0, activitySettingId);
063            }
064    
065            @Override
066            public String toString() {
067                    StringBundler sb = new StringBundler(15);
068    
069                    sb.append("{activitySettingId=");
070                    sb.append(activitySettingId);
071                    sb.append(", groupId=");
072                    sb.append(groupId);
073                    sb.append(", companyId=");
074                    sb.append(companyId);
075                    sb.append(", classNameId=");
076                    sb.append(classNameId);
077                    sb.append(", activityType=");
078                    sb.append(activityType);
079                    sb.append(", name=");
080                    sb.append(name);
081                    sb.append(", value=");
082                    sb.append(value);
083                    sb.append("}");
084    
085                    return sb.toString();
086            }
087    
088            @Override
089            public SocialActivitySetting toEntityModel() {
090                    SocialActivitySettingImpl socialActivitySettingImpl = new SocialActivitySettingImpl();
091    
092                    socialActivitySettingImpl.setActivitySettingId(activitySettingId);
093                    socialActivitySettingImpl.setGroupId(groupId);
094                    socialActivitySettingImpl.setCompanyId(companyId);
095                    socialActivitySettingImpl.setClassNameId(classNameId);
096                    socialActivitySettingImpl.setActivityType(activityType);
097    
098                    if (name == null) {
099                            socialActivitySettingImpl.setName(StringPool.BLANK);
100                    }
101                    else {
102                            socialActivitySettingImpl.setName(name);
103                    }
104    
105                    if (value == null) {
106                            socialActivitySettingImpl.setValue(StringPool.BLANK);
107                    }
108                    else {
109                            socialActivitySettingImpl.setValue(value);
110                    }
111    
112                    socialActivitySettingImpl.resetOriginalValues();
113    
114                    return socialActivitySettingImpl;
115            }
116    
117            @Override
118            public void readExternal(ObjectInput objectInput) throws IOException {
119                    activitySettingId = objectInput.readLong();
120                    groupId = objectInput.readLong();
121                    companyId = objectInput.readLong();
122                    classNameId = objectInput.readLong();
123                    activityType = objectInput.readInt();
124                    name = objectInput.readUTF();
125                    value = objectInput.readUTF();
126            }
127    
128            @Override
129            public void writeExternal(ObjectOutput objectOutput)
130                    throws IOException {
131                    objectOutput.writeLong(activitySettingId);
132                    objectOutput.writeLong(groupId);
133                    objectOutput.writeLong(companyId);
134                    objectOutput.writeLong(classNameId);
135                    objectOutput.writeInt(activityType);
136    
137                    if (name == null) {
138                            objectOutput.writeUTF(StringPool.BLANK);
139                    }
140                    else {
141                            objectOutput.writeUTF(name);
142                    }
143    
144                    if (value == null) {
145                            objectOutput.writeUTF(StringPool.BLANK);
146                    }
147                    else {
148                            objectOutput.writeUTF(value);
149                    }
150            }
151    
152            public long activitySettingId;
153            public long groupId;
154            public long companyId;
155            public long classNameId;
156            public int activityType;
157            public String name;
158            public String value;
159    }