001    /**
002     * Copyright (c) 2000-2013 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    
111            /**
112             * Converts the soap model instance into a normal model instance.
113             *
114             * @param soapModel the soap model instance to convert
115             * @return the normal model instance
116             */
117            public static Address toModel(AddressSoap soapModel) {
118                    if (soapModel == null) {
119                            return null;
120                    }
121    
122                    Address model = new AddressImpl();
123    
124                    model.setAddressId(soapModel.getAddressId());
125                    model.setCompanyId(soapModel.getCompanyId());
126                    model.setUserId(soapModel.getUserId());
127                    model.setUserName(soapModel.getUserName());
128                    model.setCreateDate(soapModel.getCreateDate());
129                    model.setModifiedDate(soapModel.getModifiedDate());
130                    model.setClassNameId(soapModel.getClassNameId());
131                    model.setClassPK(soapModel.getClassPK());
132                    model.setStreet1(soapModel.getStreet1());
133                    model.setStreet2(soapModel.getStreet2());
134                    model.setStreet3(soapModel.getStreet3());
135                    model.setCity(soapModel.getCity());
136                    model.setZip(soapModel.getZip());
137                    model.setRegionId(soapModel.getRegionId());
138                    model.setCountryId(soapModel.getCountryId());
139                    model.setTypeId(soapModel.getTypeId());
140                    model.setMailing(soapModel.getMailing());
141                    model.setPrimary(soapModel.getPrimary());
142    
143                    return model;
144            }
145    
146            /**
147             * Converts the soap model instances into normal model instances.
148             *
149             * @param soapModels the soap model instances to convert
150             * @return the normal model instances
151             */
152            public static List<Address> toModels(AddressSoap[] soapModels) {
153                    if (soapModels == null) {
154                            return null;
155                    }
156    
157                    List<Address> models = new ArrayList<Address>(soapModels.length);
158    
159                    for (AddressSoap soapModel : soapModels) {
160                            models.add(toModel(soapModel));
161                    }
162    
163                    return models;
164            }
165    
166            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
167                                    "lock.expiration.time.com.liferay.portal.model.Address"));
168    
169            public AddressModelImpl() {
170            }
171    
172            public long getPrimaryKey() {
173                    return _addressId;
174            }
175    
176            public void setPrimaryKey(long primaryKey) {
177                    setAddressId(primaryKey);
178            }
179    
180            public Serializable getPrimaryKeyObj() {
181                    return new Long(_addressId);
182            }
183    
184            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
185                    setPrimaryKey(((Long)primaryKeyObj).longValue());
186            }
187    
188            public Class<?> getModelClass() {
189                    return Address.class;
190            }
191    
192            public String getModelClassName() {
193                    return Address.class.getName();
194            }
195    
196            @Override
197            public Map<String, Object> getModelAttributes() {
198                    Map<String, Object> attributes = new HashMap<String, Object>();
199    
200                    attributes.put("addressId", getAddressId());
201                    attributes.put("companyId", getCompanyId());
202                    attributes.put("userId", getUserId());
203                    attributes.put("userName", getUserName());
204                    attributes.put("createDate", getCreateDate());
205                    attributes.put("modifiedDate", getModifiedDate());
206                    attributes.put("classNameId", getClassNameId());
207                    attributes.put("classPK", getClassPK());
208                    attributes.put("street1", getStreet1());
209                    attributes.put("street2", getStreet2());
210                    attributes.put("street3", getStreet3());
211                    attributes.put("city", getCity());
212                    attributes.put("zip", getZip());
213                    attributes.put("regionId", getRegionId());
214                    attributes.put("countryId", getCountryId());
215                    attributes.put("typeId", getTypeId());
216                    attributes.put("mailing", getMailing());
217                    attributes.put("primary", getPrimary());
218    
219                    return attributes;
220            }
221    
222            @Override
223            public void setModelAttributes(Map<String, Object> attributes) {
224                    Long addressId = (Long)attributes.get("addressId");
225    
226                    if (addressId != null) {
227                            setAddressId(addressId);
228                    }
229    
230                    Long companyId = (Long)attributes.get("companyId");
231    
232                    if (companyId != null) {
233                            setCompanyId(companyId);
234                    }
235    
236                    Long userId = (Long)attributes.get("userId");
237    
238                    if (userId != null) {
239                            setUserId(userId);
240                    }
241    
242                    String userName = (String)attributes.get("userName");
243    
244                    if (userName != null) {
245                            setUserName(userName);
246                    }
247    
248                    Date createDate = (Date)attributes.get("createDate");
249    
250                    if (createDate != null) {
251                            setCreateDate(createDate);
252                    }
253    
254                    Date modifiedDate = (Date)attributes.get("modifiedDate");
255    
256                    if (modifiedDate != null) {
257                            setModifiedDate(modifiedDate);
258                    }
259    
260                    Long classNameId = (Long)attributes.get("classNameId");
261    
262                    if (classNameId != null) {
263                            setClassNameId(classNameId);
264                    }
265    
266                    Long classPK = (Long)attributes.get("classPK");
267    
268                    if (classPK != null) {
269                            setClassPK(classPK);
270                    }
271    
272                    String street1 = (String)attributes.get("street1");
273    
274                    if (street1 != null) {
275                            setStreet1(street1);
276                    }
277    
278                    String street2 = (String)attributes.get("street2");
279    
280                    if (street2 != null) {
281                            setStreet2(street2);
282                    }
283    
284                    String street3 = (String)attributes.get("street3");
285    
286                    if (street3 != null) {
287                            setStreet3(street3);
288                    }
289    
290                    String city = (String)attributes.get("city");
291    
292                    if (city != null) {
293                            setCity(city);
294                    }
295    
296                    String zip = (String)attributes.get("zip");
297    
298                    if (zip != null) {
299                            setZip(zip);
300                    }
301    
302                    Long regionId = (Long)attributes.get("regionId");
303    
304                    if (regionId != null) {
305                            setRegionId(regionId);
306                    }
307    
308                    Long countryId = (Long)attributes.get("countryId");
309    
310                    if (countryId != null) {
311                            setCountryId(countryId);
312                    }
313    
314                    Integer typeId = (Integer)attributes.get("typeId");
315    
316                    if (typeId != null) {
317                            setTypeId(typeId);
318                    }
319    
320                    Boolean mailing = (Boolean)attributes.get("mailing");
321    
322                    if (mailing != null) {
323                            setMailing(mailing);
324                    }
325    
326                    Boolean primary = (Boolean)attributes.get("primary");
327    
328                    if (primary != null) {
329                            setPrimary(primary);
330                    }
331            }
332    
333            @JSON
334            public long getAddressId() {
335                    return _addressId;
336            }
337    
338            public void setAddressId(long addressId) {
339                    _addressId = addressId;
340            }
341    
342            @JSON
343            public long getCompanyId() {
344                    return _companyId;
345            }
346    
347            public void setCompanyId(long companyId) {
348                    _columnBitmask |= COMPANYID_COLUMN_BITMASK;
349    
350                    if (!_setOriginalCompanyId) {
351                            _setOriginalCompanyId = true;
352    
353                            _originalCompanyId = _companyId;
354                    }
355    
356                    _companyId = companyId;
357            }
358    
359            public long getOriginalCompanyId() {
360                    return _originalCompanyId;
361            }
362    
363            @JSON
364            public long getUserId() {
365                    return _userId;
366            }
367    
368            public void setUserId(long userId) {
369                    _columnBitmask |= USERID_COLUMN_BITMASK;
370    
371                    if (!_setOriginalUserId) {
372                            _setOriginalUserId = true;
373    
374                            _originalUserId = _userId;
375                    }
376    
377                    _userId = userId;
378            }
379    
380            public String getUserUuid() throws SystemException {
381                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
382            }
383    
384            public void setUserUuid(String userUuid) {
385                    _userUuid = userUuid;
386            }
387    
388            public long getOriginalUserId() {
389                    return _originalUserId;
390            }
391    
392            @JSON
393            public String getUserName() {
394                    if (_userName == null) {
395                            return StringPool.BLANK;
396                    }
397                    else {
398                            return _userName;
399                    }
400            }
401    
402            public void setUserName(String userName) {
403                    _userName = userName;
404            }
405    
406            @JSON
407            public Date getCreateDate() {
408                    return _createDate;
409            }
410    
411            public void setCreateDate(Date createDate) {
412                    _columnBitmask = -1L;
413    
414                    _createDate = createDate;
415            }
416    
417            @JSON
418            public Date getModifiedDate() {
419                    return _modifiedDate;
420            }
421    
422            public void setModifiedDate(Date modifiedDate) {
423                    _modifiedDate = modifiedDate;
424            }
425    
426            public String getClassName() {
427                    if (getClassNameId() <= 0) {
428                            return StringPool.BLANK;
429                    }
430    
431                    return PortalUtil.getClassName(getClassNameId());
432            }
433    
434            public void setClassName(String className) {
435                    long classNameId = 0;
436    
437                    if (Validator.isNotNull(className)) {
438                            classNameId = PortalUtil.getClassNameId(className);
439                    }
440    
441                    setClassNameId(classNameId);
442            }
443    
444            @JSON
445            public long getClassNameId() {
446                    return _classNameId;
447            }
448    
449            public void setClassNameId(long classNameId) {
450                    _columnBitmask |= CLASSNAMEID_COLUMN_BITMASK;
451    
452                    if (!_setOriginalClassNameId) {
453                            _setOriginalClassNameId = true;
454    
455                            _originalClassNameId = _classNameId;
456                    }
457    
458                    _classNameId = classNameId;
459            }
460    
461            public long getOriginalClassNameId() {
462                    return _originalClassNameId;
463            }
464    
465            @JSON
466            public long getClassPK() {
467                    return _classPK;
468            }
469    
470            public void setClassPK(long classPK) {
471                    _columnBitmask |= CLASSPK_COLUMN_BITMASK;
472    
473                    if (!_setOriginalClassPK) {
474                            _setOriginalClassPK = true;
475    
476                            _originalClassPK = _classPK;
477                    }
478    
479                    _classPK = classPK;
480            }
481    
482            public long getOriginalClassPK() {
483                    return _originalClassPK;
484            }
485    
486            @JSON
487            public String getStreet1() {
488                    if (_street1 == null) {
489                            return StringPool.BLANK;
490                    }
491                    else {
492                            return _street1;
493                    }
494            }
495    
496            public void setStreet1(String street1) {
497                    _street1 = street1;
498            }
499    
500            @JSON
501            public String getStreet2() {
502                    if (_street2 == null) {
503                            return StringPool.BLANK;
504                    }
505                    else {
506                            return _street2;
507                    }
508            }
509    
510            public void setStreet2(String street2) {
511                    _street2 = street2;
512            }
513    
514            @JSON
515            public String getStreet3() {
516                    if (_street3 == null) {
517                            return StringPool.BLANK;
518                    }
519                    else {
520                            return _street3;
521                    }
522            }
523    
524            public void setStreet3(String street3) {
525                    _street3 = street3;
526            }
527    
528            @JSON
529            public String getCity() {
530                    if (_city == null) {
531                            return StringPool.BLANK;
532                    }
533                    else {
534                            return _city;
535                    }
536            }
537    
538            public void setCity(String city) {
539                    _city = city;
540            }
541    
542            @JSON
543            public String getZip() {
544                    if (_zip == null) {
545                            return StringPool.BLANK;
546                    }
547                    else {
548                            return _zip;
549                    }
550            }
551    
552            public void setZip(String zip) {
553                    _zip = zip;
554            }
555    
556            @JSON
557            public long getRegionId() {
558                    return _regionId;
559            }
560    
561            public void setRegionId(long regionId) {
562                    _regionId = regionId;
563            }
564    
565            @JSON
566            public long getCountryId() {
567                    return _countryId;
568            }
569    
570            public void setCountryId(long countryId) {
571                    _countryId = countryId;
572            }
573    
574            @JSON
575            public int getTypeId() {
576                    return _typeId;
577            }
578    
579            public void setTypeId(int typeId) {
580                    _typeId = typeId;
581            }
582    
583            @JSON
584            public boolean getMailing() {
585                    return _mailing;
586            }
587    
588            public boolean isMailing() {
589                    return _mailing;
590            }
591    
592            public void setMailing(boolean mailing) {
593                    _columnBitmask |= MAILING_COLUMN_BITMASK;
594    
595                    if (!_setOriginalMailing) {
596                            _setOriginalMailing = true;
597    
598                            _originalMailing = _mailing;
599                    }
600    
601                    _mailing = mailing;
602            }
603    
604            public boolean getOriginalMailing() {
605                    return _originalMailing;
606            }
607    
608            @JSON
609            public boolean getPrimary() {
610                    return _primary;
611            }
612    
613            public boolean isPrimary() {
614                    return _primary;
615            }
616    
617            public void setPrimary(boolean primary) {
618                    _columnBitmask |= PRIMARY_COLUMN_BITMASK;
619    
620                    if (!_setOriginalPrimary) {
621                            _setOriginalPrimary = true;
622    
623                            _originalPrimary = _primary;
624                    }
625    
626                    _primary = primary;
627            }
628    
629            public boolean getOriginalPrimary() {
630                    return _originalPrimary;
631            }
632    
633            public long getColumnBitmask() {
634                    return _columnBitmask;
635            }
636    
637            @Override
638            public ExpandoBridge getExpandoBridge() {
639                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
640                            Address.class.getName(), getPrimaryKey());
641            }
642    
643            @Override
644            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
645                    ExpandoBridge expandoBridge = getExpandoBridge();
646    
647                    expandoBridge.setAttributes(serviceContext);
648            }
649    
650            @Override
651            public Address toEscapedModel() {
652                    if (_escapedModel == null) {
653                            _escapedModel = (Address)ProxyUtil.newProxyInstance(_classLoader,
654                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
655                    }
656    
657                    return _escapedModel;
658            }
659    
660            public Address toUnescapedModel() {
661                    return (Address)this;
662            }
663    
664            @Override
665            public Object clone() {
666                    AddressImpl addressImpl = new AddressImpl();
667    
668                    addressImpl.setAddressId(getAddressId());
669                    addressImpl.setCompanyId(getCompanyId());
670                    addressImpl.setUserId(getUserId());
671                    addressImpl.setUserName(getUserName());
672                    addressImpl.setCreateDate(getCreateDate());
673                    addressImpl.setModifiedDate(getModifiedDate());
674                    addressImpl.setClassNameId(getClassNameId());
675                    addressImpl.setClassPK(getClassPK());
676                    addressImpl.setStreet1(getStreet1());
677                    addressImpl.setStreet2(getStreet2());
678                    addressImpl.setStreet3(getStreet3());
679                    addressImpl.setCity(getCity());
680                    addressImpl.setZip(getZip());
681                    addressImpl.setRegionId(getRegionId());
682                    addressImpl.setCountryId(getCountryId());
683                    addressImpl.setTypeId(getTypeId());
684                    addressImpl.setMailing(getMailing());
685                    addressImpl.setPrimary(getPrimary());
686    
687                    addressImpl.resetOriginalValues();
688    
689                    return addressImpl;
690            }
691    
692            public int compareTo(Address address) {
693                    int value = 0;
694    
695                    value = DateUtil.compareTo(getCreateDate(), address.getCreateDate());
696    
697                    if (value != 0) {
698                            return value;
699                    }
700    
701                    return 0;
702            }
703    
704            @Override
705            public boolean equals(Object obj) {
706                    if (this == obj) {
707                            return true;
708                    }
709    
710                    if (!(obj instanceof Address)) {
711                            return false;
712                    }
713    
714                    Address address = (Address)obj;
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    }