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