1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.kernel.util.HtmlUtil;
28 import com.liferay.portal.model.Country;
29 import com.liferay.portal.model.CountrySoap;
30
31 import java.io.Serializable;
32
33 import java.lang.reflect.Proxy;
34
35 import java.sql.Types;
36
37 import java.util.ArrayList;
38 import java.util.List;
39
40
59 public class CountryModelImpl extends BaseModelImpl<Country> {
60 public static final String TABLE_NAME = "Country";
61 public static final Object[][] TABLE_COLUMNS = {
62 { "countryId", new Integer(Types.BIGINT) },
63 { "name", new Integer(Types.VARCHAR) },
64 { "a2", new Integer(Types.VARCHAR) },
65 { "a3", new Integer(Types.VARCHAR) },
66 { "number_", new Integer(Types.VARCHAR) },
67 { "idd_", new Integer(Types.VARCHAR) },
68 { "active_", new Integer(Types.BOOLEAN) }
69 };
70 public static final String TABLE_SQL_CREATE = "create table Country (countryId LONG not null primary key,name VARCHAR(75) null,a2 VARCHAR(75) null,a3 VARCHAR(75) null,number_ VARCHAR(75) null,idd_ VARCHAR(75) null,active_ BOOLEAN)";
71 public static final String TABLE_SQL_DROP = "drop table Country";
72 public static final String DATA_SOURCE = "liferayDataSource";
73 public static final String SESSION_FACTORY = "liferaySessionFactory";
74 public static final String TX_MANAGER = "liferayTransactionManager";
75 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
76 "value.object.entity.cache.enabled.com.liferay.portal.model.Country"),
77 true);
78 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
79 "value.object.finder.cache.enabled.com.liferay.portal.model.Country"),
80 true);
81
82 public static Country toModel(CountrySoap soapModel) {
83 Country model = new CountryImpl();
84
85 model.setCountryId(soapModel.getCountryId());
86 model.setName(soapModel.getName());
87 model.setA2(soapModel.getA2());
88 model.setA3(soapModel.getA3());
89 model.setNumber(soapModel.getNumber());
90 model.setIdd(soapModel.getIdd());
91 model.setActive(soapModel.getActive());
92
93 return model;
94 }
95
96 public static List<Country> toModels(CountrySoap[] soapModels) {
97 List<Country> models = new ArrayList<Country>(soapModels.length);
98
99 for (CountrySoap soapModel : soapModels) {
100 models.add(toModel(soapModel));
101 }
102
103 return models;
104 }
105
106 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
107 "lock.expiration.time.com.liferay.portal.model.Country"));
108
109 public CountryModelImpl() {
110 }
111
112 public long getPrimaryKey() {
113 return _countryId;
114 }
115
116 public void setPrimaryKey(long pk) {
117 setCountryId(pk);
118 }
119
120 public Serializable getPrimaryKeyObj() {
121 return new Long(_countryId);
122 }
123
124 public long getCountryId() {
125 return _countryId;
126 }
127
128 public void setCountryId(long countryId) {
129 _countryId = countryId;
130 }
131
132 public String getName() {
133 return GetterUtil.getString(_name);
134 }
135
136 public void setName(String name) {
137 _name = name;
138
139 if (_originalName == null) {
140 _originalName = name;
141 }
142 }
143
144 public String getOriginalName() {
145 return GetterUtil.getString(_originalName);
146 }
147
148 public String getA2() {
149 return GetterUtil.getString(_a2);
150 }
151
152 public void setA2(String a2) {
153 _a2 = a2;
154
155 if (_originalA2 == null) {
156 _originalA2 = a2;
157 }
158 }
159
160 public String getOriginalA2() {
161 return GetterUtil.getString(_originalA2);
162 }
163
164 public String getA3() {
165 return GetterUtil.getString(_a3);
166 }
167
168 public void setA3(String a3) {
169 _a3 = a3;
170
171 if (_originalA3 == null) {
172 _originalA3 = a3;
173 }
174 }
175
176 public String getOriginalA3() {
177 return GetterUtil.getString(_originalA3);
178 }
179
180 public String getNumber() {
181 return GetterUtil.getString(_number);
182 }
183
184 public void setNumber(String number) {
185 _number = number;
186 }
187
188 public String getIdd() {
189 return GetterUtil.getString(_idd);
190 }
191
192 public void setIdd(String idd) {
193 _idd = idd;
194 }
195
196 public boolean getActive() {
197 return _active;
198 }
199
200 public boolean isActive() {
201 return _active;
202 }
203
204 public void setActive(boolean active) {
205 _active = active;
206 }
207
208 public Country toEscapedModel() {
209 if (isEscapedModel()) {
210 return (Country)this;
211 }
212 else {
213 Country model = new CountryImpl();
214
215 model.setNew(isNew());
216 model.setEscapedModel(true);
217
218 model.setCountryId(getCountryId());
219 model.setName(HtmlUtil.escape(getName()));
220 model.setA2(HtmlUtil.escape(getA2()));
221 model.setA3(HtmlUtil.escape(getA3()));
222 model.setNumber(HtmlUtil.escape(getNumber()));
223 model.setIdd(HtmlUtil.escape(getIdd()));
224 model.setActive(getActive());
225
226 model = (Country)Proxy.newProxyInstance(Country.class.getClassLoader(),
227 new Class[] { Country.class },
228 new ReadOnlyBeanHandler(model));
229
230 return model;
231 }
232 }
233
234 public Object clone() {
235 CountryImpl clone = new CountryImpl();
236
237 clone.setCountryId(getCountryId());
238 clone.setName(getName());
239 clone.setA2(getA2());
240 clone.setA3(getA3());
241 clone.setNumber(getNumber());
242 clone.setIdd(getIdd());
243 clone.setActive(getActive());
244
245 return clone;
246 }
247
248 public int compareTo(Country country) {
249 int value = 0;
250
251 value = getName().compareTo(country.getName());
252
253 if (value != 0) {
254 return value;
255 }
256
257 return 0;
258 }
259
260 public boolean equals(Object obj) {
261 if (obj == null) {
262 return false;
263 }
264
265 Country country = null;
266
267 try {
268 country = (Country)obj;
269 }
270 catch (ClassCastException cce) {
271 return false;
272 }
273
274 long pk = country.getPrimaryKey();
275
276 if (getPrimaryKey() == pk) {
277 return true;
278 }
279 else {
280 return false;
281 }
282 }
283
284 public int hashCode() {
285 return (int)getPrimaryKey();
286 }
287
288 public String toString() {
289 StringBuilder sb = new StringBuilder();
290
291 sb.append("{countryId=");
292 sb.append(getCountryId());
293 sb.append(", name=");
294 sb.append(getName());
295 sb.append(", a2=");
296 sb.append(getA2());
297 sb.append(", a3=");
298 sb.append(getA3());
299 sb.append(", number=");
300 sb.append(getNumber());
301 sb.append(", idd=");
302 sb.append(getIdd());
303 sb.append(", active=");
304 sb.append(getActive());
305 sb.append("}");
306
307 return sb.toString();
308 }
309
310 public String toXmlString() {
311 StringBuilder sb = new StringBuilder();
312
313 sb.append("<model><model-name>");
314 sb.append("com.liferay.portal.model.Country");
315 sb.append("</model-name>");
316
317 sb.append(
318 "<column><column-name>countryId</column-name><column-value><![CDATA[");
319 sb.append(getCountryId());
320 sb.append("]]></column-value></column>");
321 sb.append(
322 "<column><column-name>name</column-name><column-value><![CDATA[");
323 sb.append(getName());
324 sb.append("]]></column-value></column>");
325 sb.append(
326 "<column><column-name>a2</column-name><column-value><![CDATA[");
327 sb.append(getA2());
328 sb.append("]]></column-value></column>");
329 sb.append(
330 "<column><column-name>a3</column-name><column-value><![CDATA[");
331 sb.append(getA3());
332 sb.append("]]></column-value></column>");
333 sb.append(
334 "<column><column-name>number</column-name><column-value><![CDATA[");
335 sb.append(getNumber());
336 sb.append("]]></column-value></column>");
337 sb.append(
338 "<column><column-name>idd</column-name><column-value><![CDATA[");
339 sb.append(getIdd());
340 sb.append("]]></column-value></column>");
341 sb.append(
342 "<column><column-name>active</column-name><column-value><![CDATA[");
343 sb.append(getActive());
344 sb.append("]]></column-value></column>");
345
346 sb.append("</model>");
347
348 return sb.toString();
349 }
350
351 private long _countryId;
352 private String _name;
353 private String _originalName;
354 private String _a2;
355 private String _originalA2;
356 private String _a3;
357 private String _originalA3;
358 private String _number;
359 private String _idd;
360 private boolean _active;
361 }