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