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