001    /**
002     * Copyright (c) 2000-2012 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.portal.model.impl;
016    
017    import com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.portal.model.CacheModel;
020    import com.liferay.portal.model.Subscription;
021    
022    import java.io.Serializable;
023    
024    import java.util.Date;
025    
026    /**
027     * The cache model class for representing Subscription in entity cache.
028     *
029     * @author Brian Wing Shun Chan
030     * @see Subscription
031     * @generated
032     */
033    public class SubscriptionCacheModel implements CacheModel<Subscription>,
034            Serializable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(19);
038    
039                    sb.append("{subscriptionId=");
040                    sb.append(subscriptionId);
041                    sb.append(", companyId=");
042                    sb.append(companyId);
043                    sb.append(", userId=");
044                    sb.append(userId);
045                    sb.append(", userName=");
046                    sb.append(userName);
047                    sb.append(", createDate=");
048                    sb.append(createDate);
049                    sb.append(", modifiedDate=");
050                    sb.append(modifiedDate);
051                    sb.append(", classNameId=");
052                    sb.append(classNameId);
053                    sb.append(", classPK=");
054                    sb.append(classPK);
055                    sb.append(", frequency=");
056                    sb.append(frequency);
057                    sb.append("}");
058    
059                    return sb.toString();
060            }
061    
062            public Subscription toEntityModel() {
063                    SubscriptionImpl subscriptionImpl = new SubscriptionImpl();
064    
065                    subscriptionImpl.setSubscriptionId(subscriptionId);
066                    subscriptionImpl.setCompanyId(companyId);
067                    subscriptionImpl.setUserId(userId);
068    
069                    if (userName == null) {
070                            subscriptionImpl.setUserName(StringPool.BLANK);
071                    }
072                    else {
073                            subscriptionImpl.setUserName(userName);
074                    }
075    
076                    if (createDate == Long.MIN_VALUE) {
077                            subscriptionImpl.setCreateDate(null);
078                    }
079                    else {
080                            subscriptionImpl.setCreateDate(new Date(createDate));
081                    }
082    
083                    if (modifiedDate == Long.MIN_VALUE) {
084                            subscriptionImpl.setModifiedDate(null);
085                    }
086                    else {
087                            subscriptionImpl.setModifiedDate(new Date(modifiedDate));
088                    }
089    
090                    subscriptionImpl.setClassNameId(classNameId);
091                    subscriptionImpl.setClassPK(classPK);
092    
093                    if (frequency == null) {
094                            subscriptionImpl.setFrequency(StringPool.BLANK);
095                    }
096                    else {
097                            subscriptionImpl.setFrequency(frequency);
098                    }
099    
100                    subscriptionImpl.resetOriginalValues();
101    
102                    return subscriptionImpl;
103            }
104    
105            public long subscriptionId;
106            public long companyId;
107            public long userId;
108            public String userName;
109            public long createDate;
110            public long modifiedDate;
111            public long classNameId;
112            public long classPK;
113            public String frequency;
114    }