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