001
014
015 package com.liferay.portal.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.util.GetterUtil;
019 import com.liferay.portal.kernel.util.StringBundler;
020 import com.liferay.portal.kernel.util.StringPool;
021 import com.liferay.portal.model.Country;
022 import com.liferay.portal.model.CountryModel;
023 import com.liferay.portal.model.CountrySoap;
024 import com.liferay.portal.service.ServiceContext;
025
026 import com.liferay.portlet.expando.model.ExpandoBridge;
027 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
028
029 import java.io.Serializable;
030
031 import java.lang.reflect.Proxy;
032
033 import java.sql.Types;
034
035 import java.util.ArrayList;
036 import java.util.List;
037
038
055 public class CountryModelImpl extends BaseModelImpl<Country>
056 implements CountryModel {
057 public static final String TABLE_NAME = "Country";
058 public static final Object[][] TABLE_COLUMNS = {
059 { "countryId", new Integer(Types.BIGINT) },
060 { "name", new Integer(Types.VARCHAR) },
061 { "a2", new Integer(Types.VARCHAR) },
062 { "a3", new Integer(Types.VARCHAR) },
063 { "number_", new Integer(Types.VARCHAR) },
064 { "idd_", new Integer(Types.VARCHAR) },
065 { "active_", new Integer(Types.BOOLEAN) }
066 };
067 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)";
068 public static final String TABLE_SQL_DROP = "drop table Country";
069 public static final String ORDER_BY_JPQL = " ORDER BY country.name ASC";
070 public static final String ORDER_BY_SQL = " ORDER BY Country.name ASC";
071 public static final String DATA_SOURCE = "liferayDataSource";
072 public static final String SESSION_FACTORY = "liferaySessionFactory";
073 public static final String TX_MANAGER = "liferayTransactionManager";
074 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
075 "value.object.entity.cache.enabled.com.liferay.portal.model.Country"),
076 true);
077 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
078 "value.object.finder.cache.enabled.com.liferay.portal.model.Country"),
079 true);
080
081
087 public static Country toModel(CountrySoap soapModel) {
088 Country model = new CountryImpl();
089
090 model.setCountryId(soapModel.getCountryId());
091 model.setName(soapModel.getName());
092 model.setA2(soapModel.getA2());
093 model.setA3(soapModel.getA3());
094 model.setNumber(soapModel.getNumber());
095 model.setIdd(soapModel.getIdd());
096 model.setActive(soapModel.getActive());
097
098 return model;
099 }
100
101
107 public static List<Country> toModels(CountrySoap[] soapModels) {
108 List<Country> models = new ArrayList<Country>(soapModels.length);
109
110 for (CountrySoap soapModel : soapModels) {
111 models.add(toModel(soapModel));
112 }
113
114 return models;
115 }
116
117 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
118 "lock.expiration.time.com.liferay.portal.model.Country"));
119
120 public CountryModelImpl() {
121 }
122
123 public long getPrimaryKey() {
124 return _countryId;
125 }
126
127 public void setPrimaryKey(long pk) {
128 setCountryId(pk);
129 }
130
131 public Serializable getPrimaryKeyObj() {
132 return new Long(_countryId);
133 }
134
135 public long getCountryId() {
136 return _countryId;
137 }
138
139 public void setCountryId(long countryId) {
140 _countryId = countryId;
141 }
142
143 public String getName() {
144 if (_name == null) {
145 return StringPool.BLANK;
146 }
147 else {
148 return _name;
149 }
150 }
151
152 public void setName(String name) {
153 if (_originalName == null) {
154 _originalName = _name;
155 }
156
157 _name = name;
158 }
159
160 public String getOriginalName() {
161 return GetterUtil.getString(_originalName);
162 }
163
164 public String getA2() {
165 if (_a2 == null) {
166 return StringPool.BLANK;
167 }
168 else {
169 return _a2;
170 }
171 }
172
173 public void setA2(String a2) {
174 if (_originalA2 == null) {
175 _originalA2 = _a2;
176 }
177
178 _a2 = a2;
179 }
180
181 public String getOriginalA2() {
182 return GetterUtil.getString(_originalA2);
183 }
184
185 public String getA3() {
186 if (_a3 == null) {
187 return StringPool.BLANK;
188 }
189 else {
190 return _a3;
191 }
192 }
193
194 public void setA3(String a3) {
195 if (_originalA3 == null) {
196 _originalA3 = _a3;
197 }
198
199 _a3 = a3;
200 }
201
202 public String getOriginalA3() {
203 return GetterUtil.getString(_originalA3);
204 }
205
206 public String getNumber() {
207 if (_number == null) {
208 return StringPool.BLANK;
209 }
210 else {
211 return _number;
212 }
213 }
214
215 public void setNumber(String number) {
216 _number = number;
217 }
218
219 public String getIdd() {
220 if (_idd == null) {
221 return StringPool.BLANK;
222 }
223 else {
224 return _idd;
225 }
226 }
227
228 public void setIdd(String idd) {
229 _idd = idd;
230 }
231
232 public boolean getActive() {
233 return _active;
234 }
235
236 public boolean isActive() {
237 return _active;
238 }
239
240 public void setActive(boolean active) {
241 _active = active;
242 }
243
244 public Country toEscapedModel() {
245 if (isEscapedModel()) {
246 return (Country)this;
247 }
248 else {
249 return (Country)Proxy.newProxyInstance(Country.class.getClassLoader(),
250 new Class[] { Country.class }, new AutoEscapeBeanHandler(this));
251 }
252 }
253
254 public ExpandoBridge getExpandoBridge() {
255 if (_expandoBridge == null) {
256 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
257 Country.class.getName(), getPrimaryKey());
258 }
259
260 return _expandoBridge;
261 }
262
263 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
264 getExpandoBridge().setAttributes(serviceContext);
265 }
266
267 public Object clone() {
268 CountryImpl countryImpl = new CountryImpl();
269
270 countryImpl.setCountryId(getCountryId());
271
272 countryImpl.setName(getName());
273
274 CountryModelImpl countryModelImpl = countryImpl;
275
276 countryModelImpl._originalName = countryModelImpl._name;
277
278 countryImpl.setA2(getA2());
279
280 countryModelImpl._originalA2 = countryModelImpl._a2;
281
282 countryImpl.setA3(getA3());
283
284 countryModelImpl._originalA3 = countryModelImpl._a3;
285
286 countryImpl.setNumber(getNumber());
287
288 countryImpl.setIdd(getIdd());
289
290 countryImpl.setActive(getActive());
291
292 return countryImpl;
293 }
294
295 public int compareTo(Country country) {
296 int value = 0;
297
298 value = getName().compareTo(country.getName());
299
300 if (value != 0) {
301 return value;
302 }
303
304 return 0;
305 }
306
307 public boolean equals(Object obj) {
308 if (obj == null) {
309 return false;
310 }
311
312 Country country = null;
313
314 try {
315 country = (Country)obj;
316 }
317 catch (ClassCastException cce) {
318 return false;
319 }
320
321 long pk = country.getPrimaryKey();
322
323 if (getPrimaryKey() == pk) {
324 return true;
325 }
326 else {
327 return false;
328 }
329 }
330
331 public int hashCode() {
332 return (int)getPrimaryKey();
333 }
334
335 public String toString() {
336 StringBundler sb = new StringBundler(15);
337
338 sb.append("{countryId=");
339 sb.append(getCountryId());
340 sb.append(", name=");
341 sb.append(getName());
342 sb.append(", a2=");
343 sb.append(getA2());
344 sb.append(", a3=");
345 sb.append(getA3());
346 sb.append(", number=");
347 sb.append(getNumber());
348 sb.append(", idd=");
349 sb.append(getIdd());
350 sb.append(", active=");
351 sb.append(getActive());
352 sb.append("}");
353
354 return sb.toString();
355 }
356
357 public String toXmlString() {
358 StringBundler sb = new StringBundler(25);
359
360 sb.append("<model><model-name>");
361 sb.append("com.liferay.portal.model.Country");
362 sb.append("</model-name>");
363
364 sb.append(
365 "<column><column-name>countryId</column-name><column-value><![CDATA[");
366 sb.append(getCountryId());
367 sb.append("]]></column-value></column>");
368 sb.append(
369 "<column><column-name>name</column-name><column-value><![CDATA[");
370 sb.append(getName());
371 sb.append("]]></column-value></column>");
372 sb.append(
373 "<column><column-name>a2</column-name><column-value><![CDATA[");
374 sb.append(getA2());
375 sb.append("]]></column-value></column>");
376 sb.append(
377 "<column><column-name>a3</column-name><column-value><![CDATA[");
378 sb.append(getA3());
379 sb.append("]]></column-value></column>");
380 sb.append(
381 "<column><column-name>number</column-name><column-value><![CDATA[");
382 sb.append(getNumber());
383 sb.append("]]></column-value></column>");
384 sb.append(
385 "<column><column-name>idd</column-name><column-value><![CDATA[");
386 sb.append(getIdd());
387 sb.append("]]></column-value></column>");
388 sb.append(
389 "<column><column-name>active</column-name><column-value><![CDATA[");
390 sb.append(getActive());
391 sb.append("]]></column-value></column>");
392
393 sb.append("</model>");
394
395 return sb.toString();
396 }
397
398 private long _countryId;
399 private String _name;
400 private String _originalName;
401 private String _a2;
402 private String _originalA2;
403 private String _a3;
404 private String _originalA3;
405 private String _number;
406 private String _idd;
407 private boolean _active;
408 private transient ExpandoBridge _expandoBridge;
409 }