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