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.portal.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    import com.liferay.portal.model.MVCCModel;
023    import com.liferay.portal.model.UserTrackerPath;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    import java.util.Date;
031    
032    /**
033     * The cache model class for representing UserTrackerPath in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see UserTrackerPath
037     * @generated
038     */
039    @ProviderType
040    public class UserTrackerPathCacheModel implements CacheModel<UserTrackerPath>,
041            Externalizable, MVCCModel {
042            @Override
043            public long getMvccVersion() {
044                    return mvccVersion;
045            }
046    
047            @Override
048            public void setMvccVersion(long mvccVersion) {
049                    this.mvccVersion = mvccVersion;
050            }
051    
052            @Override
053            public String toString() {
054                    StringBundler sb = new StringBundler(11);
055    
056                    sb.append("{mvccVersion=");
057                    sb.append(mvccVersion);
058                    sb.append(", userTrackerPathId=");
059                    sb.append(userTrackerPathId);
060                    sb.append(", userTrackerId=");
061                    sb.append(userTrackerId);
062                    sb.append(", path=");
063                    sb.append(path);
064                    sb.append(", pathDate=");
065                    sb.append(pathDate);
066                    sb.append("}");
067    
068                    return sb.toString();
069            }
070    
071            @Override
072            public UserTrackerPath toEntityModel() {
073                    UserTrackerPathImpl userTrackerPathImpl = new UserTrackerPathImpl();
074    
075                    userTrackerPathImpl.setMvccVersion(mvccVersion);
076                    userTrackerPathImpl.setUserTrackerPathId(userTrackerPathId);
077                    userTrackerPathImpl.setUserTrackerId(userTrackerId);
078    
079                    if (path == null) {
080                            userTrackerPathImpl.setPath(StringPool.BLANK);
081                    }
082                    else {
083                            userTrackerPathImpl.setPath(path);
084                    }
085    
086                    if (pathDate == Long.MIN_VALUE) {
087                            userTrackerPathImpl.setPathDate(null);
088                    }
089                    else {
090                            userTrackerPathImpl.setPathDate(new Date(pathDate));
091                    }
092    
093                    userTrackerPathImpl.resetOriginalValues();
094    
095                    return userTrackerPathImpl;
096            }
097    
098            @Override
099            public void readExternal(ObjectInput objectInput) throws IOException {
100                    mvccVersion = objectInput.readLong();
101                    userTrackerPathId = objectInput.readLong();
102                    userTrackerId = objectInput.readLong();
103                    path = objectInput.readUTF();
104                    pathDate = objectInput.readLong();
105            }
106    
107            @Override
108            public void writeExternal(ObjectOutput objectOutput)
109                    throws IOException {
110                    objectOutput.writeLong(mvccVersion);
111                    objectOutput.writeLong(userTrackerPathId);
112                    objectOutput.writeLong(userTrackerId);
113    
114                    if (path == null) {
115                            objectOutput.writeUTF(StringPool.BLANK);
116                    }
117                    else {
118                            objectOutput.writeUTF(path);
119                    }
120    
121                    objectOutput.writeLong(pathDate);
122            }
123    
124            public long mvccVersion;
125            public long userTrackerPathId;
126            public long userTrackerId;
127            public String path;
128            public long pathDate;
129    }