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