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