001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.announcements.model.impl;
016    
017    import com.liferay.portal.kernel.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    }