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