001
014
015 package com.liferay.portal.model.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.util.StringBundler;
020 import com.liferay.portal.kernel.util.StringPool;
021 import com.liferay.portal.model.CacheModel;
022 import com.liferay.portal.model.Country;
023 import com.liferay.portal.model.MVCCModel;
024
025 import java.io.Externalizable;
026 import java.io.IOException;
027 import java.io.ObjectInput;
028 import java.io.ObjectOutput;
029
030
037 @ProviderType
038 public class CountryCacheModel implements CacheModel<Country>, Externalizable,
039 MVCCModel {
040 @Override
041 public long getMvccVersion() {
042 return mvccVersion;
043 }
044
045 @Override
046 public void setMvccVersion(long mvccVersion) {
047 this.mvccVersion = mvccVersion;
048 }
049
050 @Override
051 public String toString() {
052 StringBundler sb = new StringBundler(19);
053
054 sb.append("{mvccVersion=");
055 sb.append(mvccVersion);
056 sb.append(", countryId=");
057 sb.append(countryId);
058 sb.append(", name=");
059 sb.append(name);
060 sb.append(", a2=");
061 sb.append(a2);
062 sb.append(", a3=");
063 sb.append(a3);
064 sb.append(", number=");
065 sb.append(number);
066 sb.append(", idd=");
067 sb.append(idd);
068 sb.append(", zipRequired=");
069 sb.append(zipRequired);
070 sb.append(", active=");
071 sb.append(active);
072 sb.append("}");
073
074 return sb.toString();
075 }
076
077 @Override
078 public Country toEntityModel() {
079 CountryImpl countryImpl = new CountryImpl();
080
081 countryImpl.setMvccVersion(mvccVersion);
082 countryImpl.setCountryId(countryId);
083
084 if (name == null) {
085 countryImpl.setName(StringPool.BLANK);
086 }
087 else {
088 countryImpl.setName(name);
089 }
090
091 if (a2 == null) {
092 countryImpl.setA2(StringPool.BLANK);
093 }
094 else {
095 countryImpl.setA2(a2);
096 }
097
098 if (a3 == null) {
099 countryImpl.setA3(StringPool.BLANK);
100 }
101 else {
102 countryImpl.setA3(a3);
103 }
104
105 if (number == null) {
106 countryImpl.setNumber(StringPool.BLANK);
107 }
108 else {
109 countryImpl.setNumber(number);
110 }
111
112 if (idd == null) {
113 countryImpl.setIdd(StringPool.BLANK);
114 }
115 else {
116 countryImpl.setIdd(idd);
117 }
118
119 countryImpl.setZipRequired(zipRequired);
120 countryImpl.setActive(active);
121
122 countryImpl.resetOriginalValues();
123
124 return countryImpl;
125 }
126
127 @Override
128 public void readExternal(ObjectInput objectInput) throws IOException {
129 mvccVersion = objectInput.readLong();
130 countryId = objectInput.readLong();
131 name = objectInput.readUTF();
132 a2 = objectInput.readUTF();
133 a3 = objectInput.readUTF();
134 number = objectInput.readUTF();
135 idd = objectInput.readUTF();
136 zipRequired = objectInput.readBoolean();
137 active = objectInput.readBoolean();
138 }
139
140 @Override
141 public void writeExternal(ObjectOutput objectOutput)
142 throws IOException {
143 objectOutput.writeLong(mvccVersion);
144 objectOutput.writeLong(countryId);
145
146 if (name == null) {
147 objectOutput.writeUTF(StringPool.BLANK);
148 }
149 else {
150 objectOutput.writeUTF(name);
151 }
152
153 if (a2 == null) {
154 objectOutput.writeUTF(StringPool.BLANK);
155 }
156 else {
157 objectOutput.writeUTF(a2);
158 }
159
160 if (a3 == null) {
161 objectOutput.writeUTF(StringPool.BLANK);
162 }
163 else {
164 objectOutput.writeUTF(a3);
165 }
166
167 if (number == null) {
168 objectOutput.writeUTF(StringPool.BLANK);
169 }
170 else {
171 objectOutput.writeUTF(number);
172 }
173
174 if (idd == null) {
175 objectOutput.writeUTF(StringPool.BLANK);
176 }
177 else {
178 objectOutput.writeUTF(idd);
179 }
180
181 objectOutput.writeBoolean(zipRequired);
182 objectOutput.writeBoolean(active);
183 }
184
185 public long mvccVersion;
186 public long countryId;
187 public String name;
188 public String a2;
189 public String a3;
190 public String number;
191 public String idd;
192 public boolean zipRequired;
193 public boolean active;
194 }