001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.DateUtil;
025: import com.liferay.portal.kernel.util.GetterUtil;
026: import com.liferay.portal.model.Address;
027: import com.liferay.portal.util.PropsUtil;
028:
029: import com.liferay.util.Html;
030:
031: import java.io.Serializable;
032:
033: import java.lang.reflect.Proxy;
034:
035: import java.sql.Types;
036:
037: import java.util.Date;
038:
039: /**
040: * <a href="AddressModelImpl.java.html"><b><i>View Source</i></b></a>
041: *
042: * <p>
043: * ServiceBuilder generated this class. Modifications in this class will be
044: * overwritten the next time is generated.
045: * </p>
046: *
047: * <p>
048: * This class is a model that represents the <code>Address</code> table
049: * in the database.
050: * </p>
051: *
052: * @author Brian Wing Shun Chan
053: *
054: * @see com.liferay.portal.service.model.Address
055: * @see com.liferay.portal.service.model.AddressModel
056: * @see com.liferay.portal.service.model.impl.AddressImpl
057: *
058: */
059: public class AddressModelImpl extends BaseModelImpl {
060: public static final String TABLE_NAME = "Address";
061: public static final Object[][] TABLE_COLUMNS = {
062: { "addressId", new Integer(Types.BIGINT) },
063:
064: { "companyId", new Integer(Types.BIGINT) },
065:
066: { "userId", new Integer(Types.BIGINT) },
067:
068: { "userName", new Integer(Types.VARCHAR) },
069:
070: { "createDate", new Integer(Types.TIMESTAMP) },
071:
072: { "modifiedDate", new Integer(Types.TIMESTAMP) },
073:
074: { "classNameId", new Integer(Types.BIGINT) },
075:
076: { "classPK", new Integer(Types.BIGINT) },
077:
078: { "street1", new Integer(Types.VARCHAR) },
079:
080: { "street2", new Integer(Types.VARCHAR) },
081:
082: { "street3", new Integer(Types.VARCHAR) },
083:
084: { "city", new Integer(Types.VARCHAR) },
085:
086: { "zip", new Integer(Types.VARCHAR) },
087:
088: { "regionId", new Integer(Types.BIGINT) },
089:
090: { "countryId", new Integer(Types.BIGINT) },
091:
092: { "typeId", new Integer(Types.INTEGER) },
093:
094: { "mailing", new Integer(Types.BOOLEAN) },
095:
096: { "primary_", new Integer(Types.BOOLEAN) } };
097: 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)";
098: public static final String TABLE_SQL_DROP = "drop table Address";
099: public static final boolean CACHE_ENABLED = GetterUtil
100: .getBoolean(
101: PropsUtil
102: .get("value.object.finder.cache.enabled.com.liferay.portal.model.Address"),
103: true);
104: public static final long LOCK_EXPIRATION_TIME = GetterUtil
105: .getLong(PropsUtil
106: .get("lock.expiration.time.com.liferay.portal.model.Address"));
107:
108: public AddressModelImpl() {
109: }
110:
111: public long getPrimaryKey() {
112: return _addressId;
113: }
114:
115: public void setPrimaryKey(long pk) {
116: setAddressId(pk);
117: }
118:
119: public Serializable getPrimaryKeyObj() {
120: return new Long(_addressId);
121: }
122:
123: public long getAddressId() {
124: return _addressId;
125: }
126:
127: public void setAddressId(long addressId) {
128: if (addressId != _addressId) {
129: _addressId = addressId;
130: }
131: }
132:
133: public long getCompanyId() {
134: return _companyId;
135: }
136:
137: public void setCompanyId(long companyId) {
138: if (companyId != _companyId) {
139: _companyId = companyId;
140: }
141: }
142:
143: public long getUserId() {
144: return _userId;
145: }
146:
147: public void setUserId(long userId) {
148: if (userId != _userId) {
149: _userId = userId;
150: }
151: }
152:
153: public String getUserName() {
154: return GetterUtil.getString(_userName);
155: }
156:
157: public void setUserName(String userName) {
158: if (((userName == null) && (_userName != null))
159: || ((userName != null) && (_userName == null))
160: || ((userName != null) && (_userName != null) && !userName
161: .equals(_userName))) {
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) && !createDate
174: .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) && !modifiedDate
187: .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) && !street1
220: .equals(_street1))) {
221: _street1 = street1;
222: }
223: }
224:
225: public String getStreet2() {
226: return GetterUtil.getString(_street2);
227: }
228:
229: public void setStreet2(String street2) {
230: if (((street2 == null) && (_street2 != null))
231: || ((street2 != null) && (_street2 == null))
232: || ((street2 != null) && (_street2 != null) && !street2
233: .equals(_street2))) {
234: _street2 = street2;
235: }
236: }
237:
238: public String getStreet3() {
239: return GetterUtil.getString(_street3);
240: }
241:
242: public void setStreet3(String street3) {
243: if (((street3 == null) && (_street3 != null))
244: || ((street3 != null) && (_street3 == null))
245: || ((street3 != null) && (_street3 != null) && !street3
246: .equals(_street3))) {
247: _street3 = street3;
248: }
249: }
250:
251: public String getCity() {
252: return GetterUtil.getString(_city);
253: }
254:
255: public void setCity(String city) {
256: if (((city == null) && (_city != null))
257: || ((city != null) && (_city == null))
258: || ((city != null) && (_city != null) && !city
259: .equals(_city))) {
260: _city = city;
261: }
262: }
263:
264: public String getZip() {
265: return GetterUtil.getString(_zip);
266: }
267:
268: public void setZip(String zip) {
269: if (((zip == null) && (_zip != null))
270: || ((zip != null) && (_zip == null))
271: || ((zip != null) && (_zip != null) && !zip
272: .equals(_zip))) {
273: _zip = zip;
274: }
275: }
276:
277: public long getRegionId() {
278: return _regionId;
279: }
280:
281: public void setRegionId(long regionId) {
282: if (regionId != _regionId) {
283: _regionId = regionId;
284: }
285: }
286:
287: public long getCountryId() {
288: return _countryId;
289: }
290:
291: public void setCountryId(long countryId) {
292: if (countryId != _countryId) {
293: _countryId = countryId;
294: }
295: }
296:
297: public int getTypeId() {
298: return _typeId;
299: }
300:
301: public void setTypeId(int typeId) {
302: if (typeId != _typeId) {
303: _typeId = typeId;
304: }
305: }
306:
307: public boolean getMailing() {
308: return _mailing;
309: }
310:
311: public boolean isMailing() {
312: return _mailing;
313: }
314:
315: public void setMailing(boolean mailing) {
316: if (mailing != _mailing) {
317: _mailing = mailing;
318: }
319: }
320:
321: public boolean getPrimary() {
322: return _primary;
323: }
324:
325: public boolean isPrimary() {
326: return _primary;
327: }
328:
329: public void setPrimary(boolean primary) {
330: if (primary != _primary) {
331: _primary = primary;
332: }
333: }
334:
335: public Address toEscapedModel() {
336: if (isEscapedModel()) {
337: return (Address) this ;
338: } else {
339: Address model = new AddressImpl();
340:
341: model.setEscapedModel(true);
342:
343: model.setAddressId(getAddressId());
344: model.setCompanyId(getCompanyId());
345: model.setUserId(getUserId());
346: model.setUserName(Html.escape(getUserName()));
347: model.setCreateDate(getCreateDate());
348: model.setModifiedDate(getModifiedDate());
349: model.setClassNameId(getClassNameId());
350: model.setClassPK(getClassPK());
351: model.setStreet1(Html.escape(getStreet1()));
352: model.setStreet2(Html.escape(getStreet2()));
353: model.setStreet3(Html.escape(getStreet3()));
354: model.setCity(Html.escape(getCity()));
355: model.setZip(Html.escape(getZip()));
356: model.setRegionId(getRegionId());
357: model.setCountryId(getCountryId());
358: model.setTypeId(getTypeId());
359: model.setMailing(getMailing());
360: model.setPrimary(getPrimary());
361:
362: model = (Address) Proxy.newProxyInstance(Address.class
363: .getClassLoader(), new Class[] { Address.class },
364: new ReadOnlyBeanHandler(model));
365:
366: return model;
367: }
368: }
369:
370: public Object clone() {
371: AddressImpl clone = new AddressImpl();
372:
373: clone.setAddressId(getAddressId());
374: clone.setCompanyId(getCompanyId());
375: clone.setUserId(getUserId());
376: clone.setUserName(getUserName());
377: clone.setCreateDate(getCreateDate());
378: clone.setModifiedDate(getModifiedDate());
379: clone.setClassNameId(getClassNameId());
380: clone.setClassPK(getClassPK());
381: clone.setStreet1(getStreet1());
382: clone.setStreet2(getStreet2());
383: clone.setStreet3(getStreet3());
384: clone.setCity(getCity());
385: clone.setZip(getZip());
386: clone.setRegionId(getRegionId());
387: clone.setCountryId(getCountryId());
388: clone.setTypeId(getTypeId());
389: clone.setMailing(getMailing());
390: clone.setPrimary(getPrimary());
391:
392: return clone;
393: }
394:
395: public int compareTo(Object obj) {
396: if (obj == null) {
397: return -1;
398: }
399:
400: AddressImpl address = (AddressImpl) obj;
401:
402: int value = 0;
403:
404: value = DateUtil.compareTo(getCreateDate(), address
405: .getCreateDate());
406:
407: if (value != 0) {
408: return value;
409: }
410:
411: return 0;
412: }
413:
414: public boolean equals(Object obj) {
415: if (obj == null) {
416: return false;
417: }
418:
419: AddressImpl address = null;
420:
421: try {
422: address = (AddressImpl) obj;
423: } catch (ClassCastException cce) {
424: return false;
425: }
426:
427: long pk = address.getPrimaryKey();
428:
429: if (getPrimaryKey() == pk) {
430: return true;
431: } else {
432: return false;
433: }
434: }
435:
436: public int hashCode() {
437: return (int) getPrimaryKey();
438: }
439:
440: private long _addressId;
441: private long _companyId;
442: private long _userId;
443: private String _userName;
444: private Date _createDate;
445: private Date _modifiedDate;
446: private long _classNameId;
447: private long _classPK;
448: private String _street1;
449: private String _street2;
450: private String _street3;
451: private String _city;
452: private String _zip;
453: private long _regionId;
454: private long _countryId;
455: private int _typeId;
456: private boolean _mailing;
457: private boolean _primary;
458: }
|