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