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