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 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 return GetterUtil.getString(_name);
133 }
134
135 public void setName(String name) {
136 _name = name;
137
138 if (_originalName == null) {
139 _originalName = name;
140 }
141 }
142
143 public String getOriginalName() {
144 return GetterUtil.getString(_originalName);
145 }
146
147 public String getA2() {
148 return GetterUtil.getString(_a2);
149 }
150
151 public void setA2(String a2) {
152 _a2 = a2;
153
154 if (_originalA2 == null) {
155 _originalA2 = a2;
156 }
157 }
158
159 public String getOriginalA2() {
160 return GetterUtil.getString(_originalA2);
161 }
162
163 public String getA3() {
164 return GetterUtil.getString(_a3);
165 }
166
167 public void setA3(String a3) {
168 _a3 = a3;
169
170 if (_originalA3 == null) {
171 _originalA3 = a3;
172 }
173 }
174
175 public String getOriginalA3() {
176 return GetterUtil.getString(_originalA3);
177 }
178
179 public String getNumber() {
180 return GetterUtil.getString(_number);
181 }
182
183 public void setNumber(String number) {
184 _number = number;
185 }
186
187 public String getIdd() {
188 return GetterUtil.getString(_idd);
189 }
190
191 public void setIdd(String idd) {
192 _idd = idd;
193 }
194
195 public boolean getActive() {
196 return _active;
197 }
198
199 public boolean isActive() {
200 return _active;
201 }
202
203 public void setActive(boolean active) {
204 _active = active;
205 }
206
207 public Country toEscapedModel() {
208 if (isEscapedModel()) {
209 return (Country)this;
210 }
211 else {
212 Country model = new CountryImpl();
213
214 model.setNew(isNew());
215 model.setEscapedModel(true);
216
217 model.setCountryId(getCountryId());
218 model.setName(HtmlUtil.escape(getName()));
219 model.setA2(HtmlUtil.escape(getA2()));
220 model.setA3(HtmlUtil.escape(getA3()));
221 model.setNumber(HtmlUtil.escape(getNumber()));
222 model.setIdd(HtmlUtil.escape(getIdd()));
223 model.setActive(getActive());
224
225 model = (Country)Proxy.newProxyInstance(Country.class.getClassLoader(),
226 new Class[] { Country.class },
227 new ReadOnlyBeanHandler(model));
228
229 return model;
230 }
231 }
232
233 public ExpandoBridge getExpandoBridge() {
234 if (_expandoBridge == null) {
235 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
236 Country.class.getName(), getPrimaryKey());
237 }
238
239 return _expandoBridge;
240 }
241
242 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
243 getExpandoBridge().setAttributes(serviceContext);
244 }
245
246 public Object clone() {
247 CountryImpl clone = new CountryImpl();
248
249 clone.setCountryId(getCountryId());
250 clone.setName(getName());
251 clone.setA2(getA2());
252 clone.setA3(getA3());
253 clone.setNumber(getNumber());
254 clone.setIdd(getIdd());
255 clone.setActive(getActive());
256
257 return clone;
258 }
259
260 public int compareTo(Country country) {
261 int value = 0;
262
263 value = getName().compareTo(country.getName());
264
265 if (value != 0) {
266 return value;
267 }
268
269 return 0;
270 }
271
272 public boolean equals(Object obj) {
273 if (obj == null) {
274 return false;
275 }
276
277 Country country = null;
278
279 try {
280 country = (Country)obj;
281 }
282 catch (ClassCastException cce) {
283 return false;
284 }
285
286 long pk = country.getPrimaryKey();
287
288 if (getPrimaryKey() == pk) {
289 return true;
290 }
291 else {
292 return false;
293 }
294 }
295
296 public int hashCode() {
297 return (int)getPrimaryKey();
298 }
299
300 public String toString() {
301 StringBundler sb = new StringBundler(15);
302
303 sb.append("{countryId=");
304 sb.append(getCountryId());
305 sb.append(", name=");
306 sb.append(getName());
307 sb.append(", a2=");
308 sb.append(getA2());
309 sb.append(", a3=");
310 sb.append(getA3());
311 sb.append(", number=");
312 sb.append(getNumber());
313 sb.append(", idd=");
314 sb.append(getIdd());
315 sb.append(", active=");
316 sb.append(getActive());
317 sb.append("}");
318
319 return sb.toString();
320 }
321
322 public String toXmlString() {
323 StringBundler sb = new StringBundler(25);
324
325 sb.append("<model><model-name>");
326 sb.append("com.liferay.portal.model.Country");
327 sb.append("</model-name>");
328
329 sb.append(
330 "<column><column-name>countryId</column-name><column-value><![CDATA[");
331 sb.append(getCountryId());
332 sb.append("]]></column-value></column>");
333 sb.append(
334 "<column><column-name>name</column-name><column-value><![CDATA[");
335 sb.append(getName());
336 sb.append("]]></column-value></column>");
337 sb.append(
338 "<column><column-name>a2</column-name><column-value><![CDATA[");
339 sb.append(getA2());
340 sb.append("]]></column-value></column>");
341 sb.append(
342 "<column><column-name>a3</column-name><column-value><![CDATA[");
343 sb.append(getA3());
344 sb.append("]]></column-value></column>");
345 sb.append(
346 "<column><column-name>number</column-name><column-value><![CDATA[");
347 sb.append(getNumber());
348 sb.append("]]></column-value></column>");
349 sb.append(
350 "<column><column-name>idd</column-name><column-value><![CDATA[");
351 sb.append(getIdd());
352 sb.append("]]></column-value></column>");
353 sb.append(
354 "<column><column-name>active</column-name><column-value><![CDATA[");
355 sb.append(getActive());
356 sb.append("]]></column-value></column>");
357
358 sb.append("</model>");
359
360 return sb.toString();
361 }
362
363 private long _countryId;
364 private String _name;
365 private String _originalName;
366 private String _a2;
367 private String _originalA2;
368 private String _a3;
369 private String _originalA3;
370 private String _number;
371 private String _idd;
372 private boolean _active;
373 private transient ExpandoBridge _expandoBridge;
374 }