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