001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.json.JSON;
020    import com.liferay.portal.kernel.util.DateUtil;
021    import com.liferay.portal.kernel.util.GetterUtil;
022    import com.liferay.portal.kernel.util.ProxyUtil;
023    import com.liferay.portal.kernel.util.StringBundler;
024    import com.liferay.portal.kernel.util.StringPool;
025    import com.liferay.portal.kernel.util.Validator;
026    import com.liferay.portal.model.Address;
027    import com.liferay.portal.model.AddressModel;
028    import com.liferay.portal.model.AddressSoap;
029    import com.liferay.portal.model.CacheModel;
030    import com.liferay.portal.service.ServiceContext;
031    import com.liferay.portal.util.PortalUtil;
032    
033    import com.liferay.portlet.expando.model.ExpandoBridge;
034    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
035    
036    import java.io.Serializable;
037    
038    import java.sql.Types;
039    
040    import java.util.ArrayList;
041    import java.util.Date;
042    import java.util.HashMap;
043    import java.util.List;
044    import java.util.Map;
045    
046    /**
047     * The base model implementation for the Address service. Represents a row in the "Address" database table, with each column mapped to a property of this class.
048     *
049     * <p>
050     * This implementation and its corresponding interface {@link com.liferay.portal.model.AddressModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link AddressImpl}.
051     * </p>
052     *
053     * @author Brian Wing Shun Chan
054     * @see AddressImpl
055     * @see com.liferay.portal.model.Address
056     * @see com.liferay.portal.model.AddressModel
057     * @generated
058     */
059    @JSON(strict = true)
060    public class AddressModelImpl extends BaseModelImpl<Address>
061            implements AddressModel {
062            /*
063             * NOTE FOR DEVELOPERS:
064             *
065             * Never modify or reference this class directly. All methods that expect a address model instance should use the {@link com.liferay.portal.model.Address} interface instead.
066             */
067            public static final String TABLE_NAME = "Address";
068            public static final Object[][] TABLE_COLUMNS = {
069                            { "addressId", Types.BIGINT },
070                            { "companyId", Types.BIGINT },
071                            { "userId", Types.BIGINT },
072                            { "userName", Types.VARCHAR },
073                            { "createDate", Types.TIMESTAMP },
074                            { "modifiedDate", Types.TIMESTAMP },
075                            { "classNameId", Types.BIGINT },
076                            { "classPK", Types.BIGINT },
077                            { "street1", Types.VARCHAR },
078                            { "street2", Types.VARCHAR },
079                            { "street3", Types.VARCHAR },
080                            { "city", Types.VARCHAR },
081                            { "zip", Types.VARCHAR },
082                            { "regionId", Types.BIGINT },
083                            { "countryId", Types.BIGINT },
084                            { "typeId", Types.INTEGER },
085                            { "mailing", Types.BOOLEAN },
086                            { "primary_", Types.BOOLEAN }
087                    };
088            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)";
089            public static final String TABLE_SQL_DROP = "drop table Address";
090            public static final String ORDER_BY_JPQL = " ORDER BY address.createDate ASC";
091            public static final String ORDER_BY_SQL = " ORDER BY Address.createDate ASC";
092            public static final String DATA_SOURCE = "liferayDataSource";
093            public static final String SESSION_FACTORY = "liferaySessionFactory";
094            public static final String TX_MANAGER = "liferayTransactionManager";
095            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
096                                    "value.object.entity.cache.enabled.com.liferay.portal.model.Address"),
097                            true);
098            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
099                                    "value.object.finder.cache.enabled.com.liferay.portal.model.Address"),
100                            true);
101            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
102                                    "value.object.column.bitmask.enabled.com.liferay.portal.model.Address"),
103                            true);
104            public static long CLASSNAMEID_COLUMN_BITMASK = 1L;
105            public static long CLASSPK_COLUMN_BITMASK = 2L;
106            public static long COMPANYID_COLUMN_BITMASK = 4L;
107            public static long MAILING_COLUMN_BITMASK = 8L;
108            public static long PRIMARY_COLUMN_BITMASK = 16L;
109            public static long USERID_COLUMN_BITMASK = 32L;
110            public static long CREATEDATE_COLUMN_BITMASK = 64L;
111    
112            /**
113             * Converts the soap model instance into a normal model instance.
114             *
115             * @param soapModel the soap model instance to convert
116             * @return the normal model instance
117             */
118            public static Address toModel(AddressSoap soapModel) {
119                    if (soapModel == null) {
120                            return null;
121                    }
122    
123                    Address model = new AddressImpl();
124    
125                    model.setAddressId(soapModel.getAddressId());
126                    model.setCompanyId(soapModel.getCompanyId());
127                    model.setUserId(soapModel.getUserId());
128                    model.setUserName(soapModel.getUserName());
129                    model.setCreateDate(soapModel.getCreateDate());
130                    model.setModifiedDate(soapModel.getModifiedDate());
131                    model.setClassNameId(soapModel.getClassNameId());
132                    model.setClassPK(soapModel.getClassPK());
133                    model.setStreet1(soapModel.getStreet1());
134                    model.setStreet2(soapModel.getStreet2());
135                    model.setStreet3(soapModel.getStreet3());
136                    model.setCity(soapModel.getCity());
137                    model.setZip(soapModel.getZip());
138                    model.setRegionId(soapModel.getRegionId());
139                    model.setCountryId(soapModel.getCountryId());
140                    model.setTypeId(soapModel.getTypeId());
141                    model.setMailing(soapModel.getMailing());
142                    model.setPrimary(soapModel.getPrimary());
143    
144                    return model;
145            }
146    
147            /**
148             * Converts the soap model instances into normal model instances.
149             *
150             * @param soapModels the soap model instances to convert
151             * @return the normal model instances
152             */
153            public static List<Address> toModels(AddressSoap[] soapModels) {
154                    if (soapModels == null) {
155                            return null;
156                    }
157    
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 primaryKey) {
178                    setAddressId(primaryKey);
179            }
180    
181            public Serializable getPrimaryKeyObj() {
182                    return new Long(_addressId);
183            }
184    
185            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
186                    setPrimaryKey(((Long)primaryKeyObj).longValue());
187            }
188    
189            public Class<?> getModelClass() {
190                    return Address.class;
191            }
192    
193            public String getModelClassName() {
194                    return Address.class.getName();
195            }
196    
197            @Override
198            public Map<String, Object> getModelAttributes() {
199                    Map<String, Object> attributes = new HashMap<String, Object>();
200    
201                    attributes.put("addressId", getAddressId());
202                    attributes.put("companyId", getCompanyId());
203                    attributes.put("userId", getUserId());
204                    attributes.put("userName", getUserName());
205                    attributes.put("createDate", getCreateDate());
206                    attributes.put("modifiedDate", getModifiedDate());
207                    attributes.put("classNameId", getClassNameId());
208                    attributes.put("classPK", getClassPK());
209                    attributes.put("street1", getStreet1());
210                    attributes.put("street2", getStreet2());
211                    attributes.put("street3", getStreet3());
212                    attributes.put("city", getCity());
213                    attributes.put("zip", getZip());
214                    attributes.put("regionId", getRegionId());
215                    attributes.put("countryId", getCountryId());
216                    attributes.put("typeId", getTypeId());
217                    attributes.put("mailing", getMailing());
218                    attributes.put("primary", getPrimary());
219    
220                    return attributes;
221            }
222    
223            @Override
224            public void setModelAttributes(Map<String, Object> attributes) {
225                    Long addressId = (Long)attributes.get("addressId");
226    
227                    if (addressId != null) {
228                            setAddressId(addressId);
229                    }
230    
231                    Long companyId = (Long)attributes.get("companyId");
232    
233                    if (companyId != null) {
234                            setCompanyId(companyId);
235                    }
236    
237                    Long userId = (Long)attributes.get("userId");
238    
239                    if (userId != null) {
240                            setUserId(userId);
241                    }
242    
243                    String userName = (String)attributes.get("userName");
244    
245                    if (userName != null) {
246                            setUserName(userName);
247                    }
248    
249                    Date createDate = (Date)attributes.get("createDate");
250    
251                    if (createDate != null) {
252                            setCreateDate(createDate);
253                    }
254    
255                    Date modifiedDate = (Date)attributes.get("modifiedDate");
256    
257                    if (modifiedDate != null) {
258                            setModifiedDate(modifiedDate);
259                    }
260    
261                    Long classNameId = (Long)attributes.get("classNameId");
262    
263                    if (classNameId != null) {
264                            setClassNameId(classNameId);
265                    }
266    
267                    Long classPK = (Long)attributes.get("classPK");
268    
269                    if (classPK != null) {
270                            setClassPK(classPK);
271                    }
272    
273                    String street1 = (String)attributes.get("street1");
274    
275                    if (street1 != null) {
276                            setStreet1(street1);
277                    }
278    
279                    String street2 = (String)attributes.get("street2");
280    
281                    if (street2 != null) {
282                            setStreet2(street2);
283                    }
284    
285                    String street3 = (String)attributes.get("street3");
286    
287                    if (street3 != null) {
288                            setStreet3(street3);
289                    }
290    
291                    String city = (String)attributes.get("city");
292    
293                    if (city != null) {
294                            setCity(city);
295                    }
296    
297                    String zip = (String)attributes.get("zip");
298    
299                    if (zip != null) {
300                            setZip(zip);
301                    }
302    
303                    Long regionId = (Long)attributes.get("regionId");
304    
305                    if (regionId != null) {
306                            setRegionId(regionId);
307                    }
308    
309                    Long countryId = (Long)attributes.get("countryId");
310    
311                    if (countryId != null) {
312                            setCountryId(countryId);
313                    }
314    
315                    Integer typeId = (Integer)attributes.get("typeId");
316    
317                    if (typeId != null) {
318                            setTypeId(typeId);
319                    }
320    
321                    Boolean mailing = (Boolean)attributes.get("mailing");
322    
323                    if (mailing != null) {
324                            setMailing(mailing);
325                    }
326    
327                    Boolean primary = (Boolean)attributes.get("primary");
328    
329                    if (primary != null) {
330                            setPrimary(primary);
331                    }
332            }
333    
334            @JSON
335            public long getAddressId() {
336                    return _addressId;
337            }
338    
339            public void setAddressId(long addressId) {
340                    _addressId = addressId;
341            }
342    
343            @JSON
344            public long getCompanyId() {
345                    return _companyId;
346            }
347    
348            public void setCompanyId(long companyId) {
349                    _columnBitmask |= COMPANYID_COLUMN_BITMASK;
350    
351                    if (!_setOriginalCompanyId) {
352                            _setOriginalCompanyId = true;
353    
354                            _originalCompanyId = _companyId;
355                    }
356    
357                    _companyId = companyId;
358            }
359    
360            public long getOriginalCompanyId() {
361                    return _originalCompanyId;
362            }
363    
364            @JSON
365            public long getUserId() {
366                    return _userId;
367            }
368    
369            public void setUserId(long userId) {
370                    _columnBitmask |= USERID_COLUMN_BITMASK;
371    
372                    if (!_setOriginalUserId) {
373                            _setOriginalUserId = true;
374    
375                            _originalUserId = _userId;
376                    }
377    
378                    _userId = userId;
379            }
380    
381            public String getUserUuid() throws SystemException {
382                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
383            }
384    
385            public void setUserUuid(String userUuid) {
386                    _userUuid = userUuid;
387            }
388    
389            public long getOriginalUserId() {
390                    return _originalUserId;
391            }
392    
393            @JSON
394            public String getUserName() {
395                    if (_userName == null) {
396                            return StringPool.BLANK;
397                    }
398                    else {
399                            return _userName;
400                    }
401            }
402    
403            public void setUserName(String userName) {
404                    _userName = userName;
405            }
406    
407            @JSON
408            public Date getCreateDate() {
409                    return _createDate;
410            }
411    
412            public void setCreateDate(Date createDate) {
413                    _columnBitmask = -1L;
414    
415                    _createDate = createDate;
416            }
417    
418            @JSON
419            public Date getModifiedDate() {
420                    return _modifiedDate;
421            }
422    
423            public void setModifiedDate(Date modifiedDate) {
424                    _modifiedDate = modifiedDate;
425            }
426    
427            public String getClassName() {
428                    if (getClassNameId() <= 0) {
429                            return StringPool.BLANK;
430                    }
431    
432                    return PortalUtil.getClassName(getClassNameId());
433            }
434    
435            public void setClassName(String className) {
436                    long classNameId = 0;
437    
438                    if (Validator.isNotNull(className)) {
439                            classNameId = PortalUtil.getClassNameId(className);
440                    }
441    
442                    setClassNameId(classNameId);
443            }
444    
445            @JSON
446            public long getClassNameId() {
447                    return _classNameId;
448            }
449    
450            public void setClassNameId(long classNameId) {
451                    _columnBitmask |= CLASSNAMEID_COLUMN_BITMASK;
452    
453                    if (!_setOriginalClassNameId) {
454                            _setOriginalClassNameId = true;
455    
456                            _originalClassNameId = _classNameId;
457                    }
458    
459                    _classNameId = classNameId;
460            }
461    
462            public long getOriginalClassNameId() {
463                    return _originalClassNameId;
464            }
465    
466            @JSON
467            public long getClassPK() {
468                    return _classPK;
469            }
470    
471            public void setClassPK(long classPK) {
472                    _columnBitmask |= CLASSPK_COLUMN_BITMASK;
473    
474                    if (!_setOriginalClassPK) {
475                            _setOriginalClassPK = true;
476    
477                            _originalClassPK = _classPK;
478                    }
479    
480                    _classPK = classPK;
481            }
482    
483            public long getOriginalClassPK() {
484                    return _originalClassPK;
485            }
486    
487            @JSON
488            public String getStreet1() {
489                    if (_street1 == null) {
490                            return StringPool.BLANK;
491                    }
492                    else {
493                            return _street1;
494                    }
495            }
496    
497            public void setStreet1(String street1) {
498                    _street1 = street1;
499            }
500    
501            @JSON
502            public String getStreet2() {
503                    if (_street2 == null) {
504                            return StringPool.BLANK;
505                    }
506                    else {
507                            return _street2;
508                    }
509            }
510    
511            public void setStreet2(String street2) {
512                    _street2 = street2;
513            }
514    
515            @JSON
516            public String getStreet3() {
517                    if (_street3 == null) {
518                            return StringPool.BLANK;
519                    }
520                    else {
521                            return _street3;
522                    }
523            }
524    
525            public void setStreet3(String street3) {
526                    _street3 = street3;
527            }
528    
529            @JSON
530            public String getCity() {
531                    if (_city == null) {
532                            return StringPool.BLANK;
533                    }
534                    else {
535                            return _city;
536                    }
537            }
538    
539            public void setCity(String city) {
540                    _city = city;
541            }
542    
543            @JSON
544            public String getZip() {
545                    if (_zip == null) {
546                            return StringPool.BLANK;
547                    }
548                    else {
549                            return _zip;
550                    }
551            }
552    
553            public void setZip(String zip) {
554                    _zip = zip;
555            }
556    
557            @JSON
558            public long getRegionId() {
559                    return _regionId;
560            }
561    
562            public void setRegionId(long regionId) {
563                    _regionId = regionId;
564            }
565    
566            @JSON
567            public long getCountryId() {
568                    return _countryId;
569            }
570    
571            public void setCountryId(long countryId) {
572                    _countryId = countryId;
573            }
574    
575            @JSON
576            public int getTypeId() {
577                    return _typeId;
578            }
579    
580            public void setTypeId(int typeId) {
581                    _typeId = typeId;
582            }
583    
584            @JSON
585            public boolean getMailing() {
586                    return _mailing;
587            }
588    
589            public boolean isMailing() {
590                    return _mailing;
591            }
592    
593            public void setMailing(boolean mailing) {
594                    _columnBitmask |= MAILING_COLUMN_BITMASK;
595    
596                    if (!_setOriginalMailing) {
597                            _setOriginalMailing = true;
598    
599                            _originalMailing = _mailing;
600                    }
601    
602                    _mailing = mailing;
603            }
604    
605            public boolean getOriginalMailing() {
606                    return _originalMailing;
607            }
608    
609            @JSON
610            public boolean getPrimary() {
611                    return _primary;
612            }
613    
614            public boolean isPrimary() {
615                    return _primary;
616            }
617    
618            public void setPrimary(boolean primary) {
619                    _columnBitmask |= PRIMARY_COLUMN_BITMASK;
620    
621                    if (!_setOriginalPrimary) {
622                            _setOriginalPrimary = true;
623    
624                            _originalPrimary = _primary;
625                    }
626    
627                    _primary = primary;
628            }
629    
630            public boolean getOriginalPrimary() {
631                    return _originalPrimary;
632            }
633    
634            public long getColumnBitmask() {
635                    return _columnBitmask;
636            }
637    
638            @Override
639            public ExpandoBridge getExpandoBridge() {
640                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
641                            Address.class.getName(), getPrimaryKey());
642            }
643    
644            @Override
645            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
646                    ExpandoBridge expandoBridge = getExpandoBridge();
647    
648                    expandoBridge.setAttributes(serviceContext);
649            }
650    
651            @Override
652            public Address toEscapedModel() {
653                    if (_escapedModel == null) {
654                            _escapedModel = (Address)ProxyUtil.newProxyInstance(_classLoader,
655                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
656                    }
657    
658                    return _escapedModel;
659            }
660    
661            @Override
662            public Object clone() {
663                    AddressImpl addressImpl = new AddressImpl();
664    
665                    addressImpl.setAddressId(getAddressId());
666                    addressImpl.setCompanyId(getCompanyId());
667                    addressImpl.setUserId(getUserId());
668                    addressImpl.setUserName(getUserName());
669                    addressImpl.setCreateDate(getCreateDate());
670                    addressImpl.setModifiedDate(getModifiedDate());
671                    addressImpl.setClassNameId(getClassNameId());
672                    addressImpl.setClassPK(getClassPK());
673                    addressImpl.setStreet1(getStreet1());
674                    addressImpl.setStreet2(getStreet2());
675                    addressImpl.setStreet3(getStreet3());
676                    addressImpl.setCity(getCity());
677                    addressImpl.setZip(getZip());
678                    addressImpl.setRegionId(getRegionId());
679                    addressImpl.setCountryId(getCountryId());
680                    addressImpl.setTypeId(getTypeId());
681                    addressImpl.setMailing(getMailing());
682                    addressImpl.setPrimary(getPrimary());
683    
684                    addressImpl.resetOriginalValues();
685    
686                    return addressImpl;
687            }
688    
689            public int compareTo(Address address) {
690                    int value = 0;
691    
692                    value = DateUtil.compareTo(getCreateDate(), address.getCreateDate());
693    
694                    if (value != 0) {
695                            return value;
696                    }
697    
698                    return 0;
699            }
700    
701            @Override
702            public boolean equals(Object obj) {
703                    if (obj == null) {
704                            return false;
705                    }
706    
707                    Address address = null;
708    
709                    try {
710                            address = (Address)obj;
711                    }
712                    catch (ClassCastException cce) {
713                            return false;
714                    }
715    
716                    long primaryKey = address.getPrimaryKey();
717    
718                    if (getPrimaryKey() == primaryKey) {
719                            return true;
720                    }
721                    else {
722                            return false;
723                    }
724            }
725    
726            @Override
727            public int hashCode() {
728                    return (int)getPrimaryKey();
729            }
730    
731            @Override
732            public void resetOriginalValues() {
733                    AddressModelImpl addressModelImpl = this;
734    
735                    addressModelImpl._originalCompanyId = addressModelImpl._companyId;
736    
737                    addressModelImpl._setOriginalCompanyId = false;
738    
739                    addressModelImpl._originalUserId = addressModelImpl._userId;
740    
741                    addressModelImpl._setOriginalUserId = false;
742    
743                    addressModelImpl._originalClassNameId = addressModelImpl._classNameId;
744    
745                    addressModelImpl._setOriginalClassNameId = false;
746    
747                    addressModelImpl._originalClassPK = addressModelImpl._classPK;
748    
749                    addressModelImpl._setOriginalClassPK = false;
750    
751                    addressModelImpl._originalMailing = addressModelImpl._mailing;
752    
753                    addressModelImpl._setOriginalMailing = false;
754    
755                    addressModelImpl._originalPrimary = addressModelImpl._primary;
756    
757                    addressModelImpl._setOriginalPrimary = false;
758    
759                    addressModelImpl._columnBitmask = 0;
760            }
761    
762            @Override
763            public CacheModel<Address> toCacheModel() {
764                    AddressCacheModel addressCacheModel = new AddressCacheModel();
765    
766                    addressCacheModel.addressId = getAddressId();
767    
768                    addressCacheModel.companyId = getCompanyId();
769    
770                    addressCacheModel.userId = getUserId();
771    
772                    addressCacheModel.userName = getUserName();
773    
774                    String userName = addressCacheModel.userName;
775    
776                    if ((userName != null) && (userName.length() == 0)) {
777                            addressCacheModel.userName = null;
778                    }
779    
780                    Date createDate = getCreateDate();
781    
782                    if (createDate != null) {
783                            addressCacheModel.createDate = createDate.getTime();
784                    }
785                    else {
786                            addressCacheModel.createDate = Long.MIN_VALUE;
787                    }
788    
789                    Date modifiedDate = getModifiedDate();
790    
791                    if (modifiedDate != null) {
792                            addressCacheModel.modifiedDate = modifiedDate.getTime();
793                    }
794                    else {
795                            addressCacheModel.modifiedDate = Long.MIN_VALUE;
796                    }
797    
798                    addressCacheModel.classNameId = getClassNameId();
799    
800                    addressCacheModel.classPK = getClassPK();
801    
802                    addressCacheModel.street1 = getStreet1();
803    
804                    String street1 = addressCacheModel.street1;
805    
806                    if ((street1 != null) && (street1.length() == 0)) {
807                            addressCacheModel.street1 = null;
808                    }
809    
810                    addressCacheModel.street2 = getStreet2();
811    
812                    String street2 = addressCacheModel.street2;
813    
814                    if ((street2 != null) && (street2.length() == 0)) {
815                            addressCacheModel.street2 = null;
816                    }
817    
818                    addressCacheModel.street3 = getStreet3();
819    
820                    String street3 = addressCacheModel.street3;
821    
822                    if ((street3 != null) && (street3.length() == 0)) {
823                            addressCacheModel.street3 = null;
824                    }
825    
826                    addressCacheModel.city = getCity();
827    
828                    String city = addressCacheModel.city;
829    
830                    if ((city != null) && (city.length() == 0)) {
831                            addressCacheModel.city = null;
832                    }
833    
834                    addressCacheModel.zip = getZip();
835    
836                    String zip = addressCacheModel.zip;
837    
838                    if ((zip != null) && (zip.length() == 0)) {
839                            addressCacheModel.zip = null;
840                    }
841    
842                    addressCacheModel.regionId = getRegionId();
843    
844                    addressCacheModel.countryId = getCountryId();
845    
846                    addressCacheModel.typeId = getTypeId();
847    
848                    addressCacheModel.mailing = getMailing();
849    
850                    addressCacheModel.primary = getPrimary();
851    
852                    return addressCacheModel;
853            }
854    
855            @Override
856            public String toString() {
857                    StringBundler sb = new StringBundler(37);
858    
859                    sb.append("{addressId=");
860                    sb.append(getAddressId());
861                    sb.append(", companyId=");
862                    sb.append(getCompanyId());
863                    sb.append(", userId=");
864                    sb.append(getUserId());
865                    sb.append(", userName=");
866                    sb.append(getUserName());
867                    sb.append(", createDate=");
868                    sb.append(getCreateDate());
869                    sb.append(", modifiedDate=");
870                    sb.append(getModifiedDate());
871                    sb.append(", classNameId=");
872                    sb.append(getClassNameId());
873                    sb.append(", classPK=");
874                    sb.append(getClassPK());
875                    sb.append(", street1=");
876                    sb.append(getStreet1());
877                    sb.append(", street2=");
878                    sb.append(getStreet2());
879                    sb.append(", street3=");
880                    sb.append(getStreet3());
881                    sb.append(", city=");
882                    sb.append(getCity());
883                    sb.append(", zip=");
884                    sb.append(getZip());
885                    sb.append(", regionId=");
886                    sb.append(getRegionId());
887                    sb.append(", countryId=");
888                    sb.append(getCountryId());
889                    sb.append(", typeId=");
890                    sb.append(getTypeId());
891                    sb.append(", mailing=");
892                    sb.append(getMailing());
893                    sb.append(", primary=");
894                    sb.append(getPrimary());
895                    sb.append("}");
896    
897                    return sb.toString();
898            }
899    
900            public String toXmlString() {
901                    StringBundler sb = new StringBundler(58);
902    
903                    sb.append("<model><model-name>");
904                    sb.append("com.liferay.portal.model.Address");
905                    sb.append("</model-name>");
906    
907                    sb.append(
908                            "<column><column-name>addressId</column-name><column-value><![CDATA[");
909                    sb.append(getAddressId());
910                    sb.append("]]></column-value></column>");
911                    sb.append(
912                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
913                    sb.append(getCompanyId());
914                    sb.append("]]></column-value></column>");
915                    sb.append(
916                            "<column><column-name>userId</column-name><column-value><![CDATA[");
917                    sb.append(getUserId());
918                    sb.append("]]></column-value></column>");
919                    sb.append(
920                            "<column><column-name>userName</column-name><column-value><![CDATA[");
921                    sb.append(getUserName());
922                    sb.append("]]></column-value></column>");
923                    sb.append(
924                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
925                    sb.append(getCreateDate());
926                    sb.append("]]></column-value></column>");
927                    sb.append(
928                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
929                    sb.append(getModifiedDate());
930                    sb.append("]]></column-value></column>");
931                    sb.append(
932                            "<column><column-name>classNameId</column-name><column-value><![CDATA[");
933                    sb.append(getClassNameId());
934                    sb.append("]]></column-value></column>");
935                    sb.append(
936                            "<column><column-name>classPK</column-name><column-value><![CDATA[");
937                    sb.append(getClassPK());
938                    sb.append("]]></column-value></column>");
939                    sb.append(
940                            "<column><column-name>street1</column-name><column-value><![CDATA[");
941                    sb.append(getStreet1());
942                    sb.append("]]></column-value></column>");
943                    sb.append(
944                            "<column><column-name>street2</column-name><column-value><![CDATA[");
945                    sb.append(getStreet2());
946                    sb.append("]]></column-value></column>");
947                    sb.append(
948                            "<column><column-name>street3</column-name><column-value><![CDATA[");
949                    sb.append(getStreet3());
950                    sb.append("]]></column-value></column>");
951                    sb.append(
952                            "<column><column-name>city</column-name><column-value><![CDATA[");
953                    sb.append(getCity());
954                    sb.append("]]></column-value></column>");
955                    sb.append(
956                            "<column><column-name>zip</column-name><column-value><![CDATA[");
957                    sb.append(getZip());
958                    sb.append("]]></column-value></column>");
959                    sb.append(
960                            "<column><column-name>regionId</column-name><column-value><![CDATA[");
961                    sb.append(getRegionId());
962                    sb.append("]]></column-value></column>");
963                    sb.append(
964                            "<column><column-name>countryId</column-name><column-value><![CDATA[");
965                    sb.append(getCountryId());
966                    sb.append("]]></column-value></column>");
967                    sb.append(
968                            "<column><column-name>typeId</column-name><column-value><![CDATA[");
969                    sb.append(getTypeId());
970                    sb.append("]]></column-value></column>");
971                    sb.append(
972                            "<column><column-name>mailing</column-name><column-value><![CDATA[");
973                    sb.append(getMailing());
974                    sb.append("]]></column-value></column>");
975                    sb.append(
976                            "<column><column-name>primary</column-name><column-value><![CDATA[");
977                    sb.append(getPrimary());
978                    sb.append("]]></column-value></column>");
979    
980                    sb.append("</model>");
981    
982                    return sb.toString();
983            }
984    
985            private static ClassLoader _classLoader = Address.class.getClassLoader();
986            private static Class<?>[] _escapedModelInterfaces = new Class[] {
987                            Address.class
988                    };
989            private long _addressId;
990            private long _companyId;
991            private long _originalCompanyId;
992            private boolean _setOriginalCompanyId;
993            private long _userId;
994            private String _userUuid;
995            private long _originalUserId;
996            private boolean _setOriginalUserId;
997            private String _userName;
998            private Date _createDate;
999            private Date _modifiedDate;
1000            private long _classNameId;
1001            private long _originalClassNameId;
1002            private boolean _setOriginalClassNameId;
1003            private long _classPK;
1004            private long _originalClassPK;
1005            private boolean _setOriginalClassPK;
1006            private String _street1;
1007            private String _street2;
1008            private String _street3;
1009            private String _city;
1010            private String _zip;
1011            private long _regionId;
1012            private long _countryId;
1013            private int _typeId;
1014            private boolean _mailing;
1015            private boolean _originalMailing;
1016            private boolean _setOriginalMailing;
1017            private boolean _primary;
1018            private boolean _originalPrimary;
1019            private boolean _setOriginalPrimary;
1020            private long _columnBitmask;
1021            private Address _escapedModel;
1022    }