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