001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.announcements.model.impl;
016    
017    import com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.model.CacheModel;
019    
020    import com.liferay.portlet.announcements.model.AnnouncementsFlag;
021    
022    import java.io.Serializable;
023    
024    import java.util.Date;
025    
026    /**
027     * The cache model class for representing AnnouncementsFlag in entity cache.
028     *
029     * @author Brian Wing Shun Chan
030     * @see AnnouncementsFlag
031     * @generated
032     */
033    public class AnnouncementsFlagCacheModel implements CacheModel<AnnouncementsFlag>,
034            Serializable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(11);
038    
039                    sb.append("{flagId=");
040                    sb.append(flagId);
041                    sb.append(", userId=");
042                    sb.append(userId);
043                    sb.append(", createDate=");
044                    sb.append(createDate);
045                    sb.append(", entryId=");
046                    sb.append(entryId);
047                    sb.append(", value=");
048                    sb.append(value);
049                    sb.append("}");
050    
051                    return sb.toString();
052            }
053    
054            public AnnouncementsFlag toEntityModel() {
055                    AnnouncementsFlagImpl announcementsFlagImpl = new AnnouncementsFlagImpl();
056    
057                    announcementsFlagImpl.setFlagId(flagId);
058                    announcementsFlagImpl.setUserId(userId);
059    
060                    if (createDate == Long.MIN_VALUE) {
061                            announcementsFlagImpl.setCreateDate(null);
062                    }
063                    else {
064                            announcementsFlagImpl.setCreateDate(new Date(createDate));
065                    }
066    
067                    announcementsFlagImpl.setEntryId(entryId);
068                    announcementsFlagImpl.setValue(value);
069    
070                    announcementsFlagImpl.resetOriginalValues();
071    
072                    return announcementsFlagImpl;
073            }
074    
075            public long flagId;
076            public long userId;
077            public long createDate;
078            public long entryId;
079            public int value;
080    }