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.DateUtil;
27 import com.liferay.portal.kernel.util.GetterUtil;
28 import com.liferay.portal.kernel.util.HtmlUtil;
29 import com.liferay.portal.kernel.util.StringPool;
30 import com.liferay.portal.model.Address;
31 import com.liferay.portal.model.AddressSoap;
32 import com.liferay.portal.util.PortalUtil;
33
34 import com.liferay.portlet.expando.model.ExpandoBridge;
35 import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
36
37 import java.io.Serializable;
38
39 import java.lang.reflect.Proxy;
40
41 import java.sql.Types;
42
43 import java.util.ArrayList;
44 import java.util.Date;
45 import java.util.List;
46
47
67 public class AddressModelImpl extends BaseModelImpl {
68 public static final String TABLE_NAME = "Address";
69 public static final Object[][] TABLE_COLUMNS = {
70 { "addressId", new Integer(Types.BIGINT) },
71
72
73 { "companyId", new Integer(Types.BIGINT) },
74
75
76 { "userId", new Integer(Types.BIGINT) },
77
78
79 { "userName", new Integer(Types.VARCHAR) },
80
81
82 { "createDate", new Integer(Types.TIMESTAMP) },
83
84
85 { "modifiedDate", new Integer(Types.TIMESTAMP) },
86
87
88 { "classNameId", new Integer(Types.BIGINT) },
89
90
91 { "classPK", new Integer(Types.BIGINT) },
92
93
94 { "street1", new Integer(Types.VARCHAR) },
95
96
97 { "street2", new Integer(Types.VARCHAR) },
98
99
100 { "street3", new Integer(Types.VARCHAR) },
101
102
103 { "city", new Integer(Types.VARCHAR) },
104
105
106 { "zip", new Integer(Types.VARCHAR) },
107
108
109 { "regionId", new Integer(Types.BIGINT) },
110
111
112 { "countryId", new Integer(Types.BIGINT) },
113
114
115 { "typeId", new Integer(Types.INTEGER) },
116
117
118 { "mailing", new Integer(Types.BOOLEAN) },
119
120
121 { "primary_", new Integer(Types.BOOLEAN) }
122 };
123 public static final String TABLE_SQL_CREATE = "create table Address (addressId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,street1 VARCHAR(75) null,street2 VARCHAR(75) null,street3 VARCHAR(75) null,city VARCHAR(75) null,zip VARCHAR(75) null,regionId LONG,countryId LONG,typeId INTEGER,mailing BOOLEAN,primary_ BOOLEAN)";
124 public static final String TABLE_SQL_DROP = "drop table Address";
125 public static final String DATA_SOURCE = "liferayDataSource";
126 public static final String SESSION_FACTORY = "liferaySessionFactory";
127 public static final String TX_MANAGER = "liferayTransactionManager";
128 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
129 "value.object.finder.cache.enabled.com.liferay.portal.model.Address"),
130 true);
131
132 public static Address toModel(AddressSoap soapModel) {
133 Address model = new AddressImpl();
134
135 model.setAddressId(soapModel.getAddressId());
136 model.setCompanyId(soapModel.getCompanyId());
137 model.setUserId(soapModel.getUserId());
138 model.setUserName(soapModel.getUserName());
139 model.setCreateDate(soapModel.getCreateDate());
140 model.setModifiedDate(soapModel.getModifiedDate());
141 model.setClassNameId(soapModel.getClassNameId());
142 model.setClassPK(soapModel.getClassPK());
143 model.setStreet1(soapModel.getStreet1());
144 model.setStreet2(soapModel.getStreet2());
145 model.setStreet3(soapModel.getStreet3());
146 model.setCity(soapModel.getCity());
147 model.setZip(soapModel.getZip());
148 model.setRegionId(soapModel.getRegionId());
149 model.setCountryId(soapModel.getCountryId());
150 model.setTypeId(soapModel.getTypeId());
151 model.setMailing(soapModel.getMailing());
152 model.setPrimary(soapModel.getPrimary());
153
154 return model;
155 }
156
157 public static List<Address> toModels(AddressSoap[] soapModels) {
158 List<Address> models = new ArrayList<Address>(soapModels.length);
159
160 for (AddressSoap soapModel : soapModels) {
161 models.add(toModel(soapModel));
162 }
163
164 return models;
165 }
166
167 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
168 "lock.expiration.time.com.liferay.portal.model.Address"));
169
170 public AddressModelImpl() {
171 }
172
173 public long getPrimaryKey() {
174 return _addressId;
175 }
176
177 public void setPrimaryKey(long pk) {
178 setAddressId(pk);
179 }
180
181 public Serializable getPrimaryKeyObj() {
182 return new Long(_addressId);
183 }
184
185 public long getAddressId() {
186 return _addressId;
187 }
188
189 public void setAddressId(long addressId) {
190 if (addressId != _addressId) {
191 _addressId = addressId;
192 }
193 }
194
195 public long getCompanyId() {
196 return _companyId;
197 }
198
199 public void setCompanyId(long companyId) {
200 if (companyId != _companyId) {
201 _companyId = companyId;
202 }
203 }
204
205 public long getUserId() {
206 return _userId;
207 }
208
209 public void setUserId(long userId) {
210 if (userId != _userId) {
211 _userId = userId;
212 }
213 }
214
215 public String getUserName() {
216 return GetterUtil.getString(_userName);
217 }
218
219 public void setUserName(String userName) {
220 if (((userName == null) && (_userName != null)) ||
221 ((userName != null) && (_userName == null)) ||
222 ((userName != null) && (_userName != null) &&
223 !userName.equals(_userName))) {
224 _userName = userName;
225 }
226 }
227
228 public Date getCreateDate() {
229 return _createDate;
230 }
231
232 public void setCreateDate(Date createDate) {
233 if (((createDate == null) && (_createDate != null)) ||
234 ((createDate != null) && (_createDate == null)) ||
235 ((createDate != null) && (_createDate != null) &&
236 !createDate.equals(_createDate))) {
237 _createDate = createDate;
238 }
239 }
240
241 public Date getModifiedDate() {
242 return _modifiedDate;
243 }
244
245 public void setModifiedDate(Date modifiedDate) {
246 if (((modifiedDate == null) && (_modifiedDate != null)) ||
247 ((modifiedDate != null) && (_modifiedDate == null)) ||
248 ((modifiedDate != null) && (_modifiedDate != null) &&
249 !modifiedDate.equals(_modifiedDate))) {
250 _modifiedDate = modifiedDate;
251 }
252 }
253
254 public String getClassName() {
255 if (getClassNameId() <= 0) {
256 return StringPool.BLANK;
257 }
258
259 return PortalUtil.getClassName(getClassNameId());
260 }
261
262 public long getClassNameId() {
263 return _classNameId;
264 }
265
266 public void setClassNameId(long classNameId) {
267 if (classNameId != _classNameId) {
268 _classNameId = classNameId;
269 }
270 }
271
272 public long getClassPK() {
273 return _classPK;
274 }
275
276 public void setClassPK(long classPK) {
277 if (classPK != _classPK) {
278 _classPK = classPK;
279 }
280 }
281
282 public String getStreet1() {
283 return GetterUtil.getString(_street1);
284 }
285
286 public void setStreet1(String street1) {
287 if (((street1 == null) && (_street1 != null)) ||
288 ((street1 != null) && (_street1 == null)) ||
289 ((street1 != null) && (_street1 != null) &&
290 !street1.equals(_street1))) {
291 _street1 = street1;
292 }
293 }
294
295 public String getStreet2() {
296 return GetterUtil.getString(_street2);
297 }
298
299 public void setStreet2(String street2) {
300 if (((street2 == null) && (_street2 != null)) ||
301 ((street2 != null) && (_street2 == null)) ||
302 ((street2 != null) && (_street2 != null) &&
303 !street2.equals(_street2))) {
304 _street2 = street2;
305 }
306 }
307
308 public String getStreet3() {
309 return GetterUtil.getString(_street3);
310 }
311
312 public void setStreet3(String street3) {
313 if (((street3 == null) && (_street3 != null)) ||
314 ((street3 != null) && (_street3 == null)) ||
315 ((street3 != null) && (_street3 != null) &&
316 !street3.equals(_street3))) {
317 _street3 = street3;
318 }
319 }
320
321 public String getCity() {
322 return GetterUtil.getString(_city);
323 }
324
325 public void setCity(String city) {
326 if (((city == null) && (_city != null)) ||
327 ((city != null) && (_city == null)) ||
328 ((city != null) && (_city != null) && !city.equals(_city))) {
329 _city = city;
330 }
331 }
332
333 public String getZip() {
334 return GetterUtil.getString(_zip);
335 }
336
337 public void setZip(String zip) {
338 if (((zip == null) && (_zip != null)) ||
339 ((zip != null) && (_zip == null)) ||
340 ((zip != null) && (_zip != null) && !zip.equals(_zip))) {
341 _zip = zip;
342 }
343 }
344
345 public long getRegionId() {
346 return _regionId;
347 }
348
349 public void setRegionId(long regionId) {
350 if (regionId != _regionId) {
351 _regionId = regionId;
352 }
353 }
354
355 public long getCountryId() {
356 return _countryId;
357 }
358
359 public void setCountryId(long countryId) {
360 if (countryId != _countryId) {
361 _countryId = countryId;
362 }
363 }
364
365 public int getTypeId() {
366 return _typeId;
367 }
368
369 public void setTypeId(int typeId) {
370 if (typeId != _typeId) {
371 _typeId = typeId;
372 }
373 }
374
375 public boolean getMailing() {
376 return _mailing;
377 }
378
379 public boolean isMailing() {
380 return _mailing;
381 }
382
383 public void setMailing(boolean mailing) {
384 if (mailing != _mailing) {
385 _mailing = mailing;
386 }
387 }
388
389 public boolean getPrimary() {
390 return _primary;
391 }
392
393 public boolean isPrimary() {
394 return _primary;
395 }
396
397 public void setPrimary(boolean primary) {
398 if (primary != _primary) {
399 _primary = primary;
400 }
401 }
402
403 public Address toEscapedModel() {
404 if (isEscapedModel()) {
405 return (Address)this;
406 }
407 else {
408 Address model = new AddressImpl();
409
410 model.setNew(isNew());
411 model.setEscapedModel(true);
412
413 model.setAddressId(getAddressId());
414 model.setCompanyId(getCompanyId());
415 model.setUserId(getUserId());
416 model.setUserName(HtmlUtil.escape(getUserName()));
417 model.setCreateDate(getCreateDate());
418 model.setModifiedDate(getModifiedDate());
419 model.setClassNameId(getClassNameId());
420 model.setClassPK(getClassPK());
421 model.setStreet1(HtmlUtil.escape(getStreet1()));
422 model.setStreet2(HtmlUtil.escape(getStreet2()));
423 model.setStreet3(HtmlUtil.escape(getStreet3()));
424 model.setCity(HtmlUtil.escape(getCity()));
425 model.setZip(HtmlUtil.escape(getZip()));
426 model.setRegionId(getRegionId());
427 model.setCountryId(getCountryId());
428 model.setTypeId(getTypeId());
429 model.setMailing(getMailing());
430 model.setPrimary(getPrimary());
431
432 model = (Address)Proxy.newProxyInstance(Address.class.getClassLoader(),
433 new Class[] { Address.class },
434 new ReadOnlyBeanHandler(model));
435
436 return model;
437 }
438 }
439
440 public ExpandoBridge getExpandoBridge() {
441 if (_expandoBridge == null) {
442 _expandoBridge = new ExpandoBridgeImpl(Address.class.getName(),
443 getPrimaryKey());
444 }
445
446 return _expandoBridge;
447 }
448
449 public Object clone() {
450 AddressImpl clone = new AddressImpl();
451
452 clone.setAddressId(getAddressId());
453 clone.setCompanyId(getCompanyId());
454 clone.setUserId(getUserId());
455 clone.setUserName(getUserName());
456 clone.setCreateDate(getCreateDate());
457 clone.setModifiedDate(getModifiedDate());
458 clone.setClassNameId(getClassNameId());
459 clone.setClassPK(getClassPK());
460 clone.setStreet1(getStreet1());
461 clone.setStreet2(getStreet2());
462 clone.setStreet3(getStreet3());
463 clone.setCity(getCity());
464 clone.setZip(getZip());
465 clone.setRegionId(getRegionId());
466 clone.setCountryId(getCountryId());
467 clone.setTypeId(getTypeId());
468 clone.setMailing(getMailing());
469 clone.setPrimary(getPrimary());
470
471 return clone;
472 }
473
474 public int compareTo(Object obj) {
475 if (obj == null) {
476 return -1;
477 }
478
479 AddressImpl address = (AddressImpl)obj;
480
481 int value = 0;
482
483 value = DateUtil.compareTo(getCreateDate(), address.getCreateDate());
484
485 if (value != 0) {
486 return value;
487 }
488
489 return 0;
490 }
491
492 public boolean equals(Object obj) {
493 if (obj == null) {
494 return false;
495 }
496
497 AddressImpl address = null;
498
499 try {
500 address = (AddressImpl)obj;
501 }
502 catch (ClassCastException cce) {
503 return false;
504 }
505
506 long pk = address.getPrimaryKey();
507
508 if (getPrimaryKey() == pk) {
509 return true;
510 }
511 else {
512 return false;
513 }
514 }
515
516 public int hashCode() {
517 return (int)getPrimaryKey();
518 }
519
520 private long _addressId;
521 private long _companyId;
522 private long _userId;
523 private String _userName;
524 private Date _createDate;
525 private Date _modifiedDate;
526 private long _classNameId;
527 private long _classPK;
528 private String _street1;
529 private String _street2;
530 private String _street3;
531 private String _city;
532 private String _zip;
533 private long _regionId;
534 private long _countryId;
535 private int _typeId;
536 private boolean _mailing;
537 private boolean _primary;
538 private transient ExpandoBridge _expandoBridge;
539 }