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