001
014
015 package com.liferay.portal.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 import com.liferay.portal.model.Country;
024 import com.liferay.portal.model.MVCCModel;
025
026 import java.io.Externalizable;
027 import java.io.IOException;
028 import java.io.ObjectInput;
029 import java.io.ObjectOutput;
030
031
038 @ProviderType
039 public class CountryCacheModel implements CacheModel<Country>, Externalizable,
040 MVCCModel {
041 @Override
042 public boolean equals(Object obj) {
043 if (this == obj) {
044 return true;
045 }
046
047 if (!(obj instanceof CountryCacheModel)) {
048 return false;
049 }
050
051 CountryCacheModel countryCacheModel = (CountryCacheModel)obj;
052
053 if ((countryId == countryCacheModel.countryId) &&
054 (mvccVersion == countryCacheModel.mvccVersion)) {
055 return true;
056 }
057
058 return false;
059 }
060
061 @Override
062 public int hashCode() {
063 int hashCode = HashUtil.hash(0, countryId);
064
065 return HashUtil.hash(hashCode, mvccVersion);
066 }
067
068 @Override
069 public long getMvccVersion() {
070 return mvccVersion;
071 }
072
073 @Override
074 public void setMvccVersion(long mvccVersion) {
075 this.mvccVersion = mvccVersion;
076 }
077
078 @Override
079 public String toString() {
080 StringBundler sb = new StringBundler(19);
081
082 sb.append("{mvccVersion=");
083 sb.append(mvccVersion);
084 sb.append(", countryId=");
085 sb.append(countryId);
086 sb.append(", name=");
087 sb.append(name);
088 sb.append(", a2=");
089 sb.append(a2);
090 sb.append(", a3=");
091 sb.append(a3);
092 sb.append(", number=");
093 sb.append(number);
094 sb.append(", idd=");
095 sb.append(idd);
096 sb.append(", zipRequired=");
097 sb.append(zipRequired);
098 sb.append(", active=");
099 sb.append(active);
100 sb.append("}");
101
102 return sb.toString();
103 }
104
105 @Override
106 public Country toEntityModel() {
107 CountryImpl countryImpl = new CountryImpl();
108
109 countryImpl.setMvccVersion(mvccVersion);
110 countryImpl.setCountryId(countryId);
111
112 if (name == null) {
113 countryImpl.setName(StringPool.BLANK);
114 }
115 else {
116 countryImpl.setName(name);
117 }
118
119 if (a2 == null) {
120 countryImpl.setA2(StringPool.BLANK);
121 }
122 else {
123 countryImpl.setA2(a2);
124 }
125
126 if (a3 == null) {
127 countryImpl.setA3(StringPool.BLANK);
128 }
129 else {
130 countryImpl.setA3(a3);
131 }
132
133 if (number == null) {
134 countryImpl.setNumber(StringPool.BLANK);
135 }
136 else {
137 countryImpl.setNumber(number);
138 }
139
140 if (idd == null) {
141 countryImpl.setIdd(StringPool.BLANK);
142 }
143 else {
144 countryImpl.setIdd(idd);
145 }
146
147 countryImpl.setZipRequired(zipRequired);
148 countryImpl.setActive(active);
149
150 countryImpl.resetOriginalValues();
151
152 return countryImpl;
153 }
154
155 @Override
156 public void readExternal(ObjectInput objectInput) throws IOException {
157 mvccVersion = objectInput.readLong();
158 countryId = objectInput.readLong();
159 name = objectInput.readUTF();
160 a2 = objectInput.readUTF();
161 a3 = objectInput.readUTF();
162 number = objectInput.readUTF();
163 idd = objectInput.readUTF();
164 zipRequired = objectInput.readBoolean();
165 active = objectInput.readBoolean();
166 }
167
168 @Override
169 public void writeExternal(ObjectOutput objectOutput)
170 throws IOException {
171 objectOutput.writeLong(mvccVersion);
172 objectOutput.writeLong(countryId);
173
174 if (name == null) {
175 objectOutput.writeUTF(StringPool.BLANK);
176 }
177 else {
178 objectOutput.writeUTF(name);
179 }
180
181 if (a2 == null) {
182 objectOutput.writeUTF(StringPool.BLANK);
183 }
184 else {
185 objectOutput.writeUTF(a2);
186 }
187
188 if (a3 == null) {
189 objectOutput.writeUTF(StringPool.BLANK);
190 }
191 else {
192 objectOutput.writeUTF(a3);
193 }
194
195 if (number == null) {
196 objectOutput.writeUTF(StringPool.BLANK);
197 }
198 else {
199 objectOutput.writeUTF(number);
200 }
201
202 if (idd == null) {
203 objectOutput.writeUTF(StringPool.BLANK);
204 }
205 else {
206 objectOutput.writeUTF(idd);
207 }
208
209 objectOutput.writeBoolean(zipRequired);
210 objectOutput.writeBoolean(active);
211 }
212
213 public long mvccVersion;
214 public long countryId;
215 public String name;
216 public String a2;
217 public String a3;
218 public String number;
219 public String idd;
220 public boolean zipRequired;
221 public boolean active;
222 }