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