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.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.UserTracker;
021    
022    import java.io.Serializable;
023    
024    import java.util.Date;
025    
026    /**
027     * The cache model class for representing UserTracker in entity cache.
028     *
029     * @author Brian Wing Shun Chan
030     * @see UserTracker
031     * @generated
032     */
033    public class UserTrackerCacheModel implements CacheModel<UserTracker>,
034            Serializable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(17);
038    
039                    sb.append("{userTrackerId=");
040                    sb.append(userTrackerId);
041                    sb.append(", companyId=");
042                    sb.append(companyId);
043                    sb.append(", userId=");
044                    sb.append(userId);
045                    sb.append(", modifiedDate=");
046                    sb.append(modifiedDate);
047                    sb.append(", sessionId=");
048                    sb.append(sessionId);
049                    sb.append(", remoteAddr=");
050                    sb.append(remoteAddr);
051                    sb.append(", remoteHost=");
052                    sb.append(remoteHost);
053                    sb.append(", userAgent=");
054                    sb.append(userAgent);
055                    sb.append("}");
056    
057                    return sb.toString();
058            }
059    
060            public UserTracker toEntityModel() {
061                    UserTrackerImpl userTrackerImpl = new UserTrackerImpl();
062    
063                    userTrackerImpl.setUserTrackerId(userTrackerId);
064                    userTrackerImpl.setCompanyId(companyId);
065                    userTrackerImpl.setUserId(userId);
066    
067                    if (modifiedDate == Long.MIN_VALUE) {
068                            userTrackerImpl.setModifiedDate(null);
069                    }
070                    else {
071                            userTrackerImpl.setModifiedDate(new Date(modifiedDate));
072                    }
073    
074                    if (sessionId == null) {
075                            userTrackerImpl.setSessionId(StringPool.BLANK);
076                    }
077                    else {
078                            userTrackerImpl.setSessionId(sessionId);
079                    }
080    
081                    if (remoteAddr == null) {
082                            userTrackerImpl.setRemoteAddr(StringPool.BLANK);
083                    }
084                    else {
085                            userTrackerImpl.setRemoteAddr(remoteAddr);
086                    }
087    
088                    if (remoteHost == null) {
089                            userTrackerImpl.setRemoteHost(StringPool.BLANK);
090                    }
091                    else {
092                            userTrackerImpl.setRemoteHost(remoteHost);
093                    }
094    
095                    if (userAgent == null) {
096                            userTrackerImpl.setUserAgent(StringPool.BLANK);
097                    }
098                    else {
099                            userTrackerImpl.setUserAgent(userAgent);
100                    }
101    
102                    userTrackerImpl.resetOriginalValues();
103    
104                    return userTrackerImpl;
105            }
106    
107            public long userTrackerId;
108            public long companyId;
109            public long userId;
110            public long modifiedDate;
111            public String sessionId;
112            public String remoteAddr;
113            public String remoteHost;
114            public String userAgent;
115    }