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.HashUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.CacheModel;
023    import com.liferay.portal.model.MVCCModel;
024    import com.liferay.portal.model.UserTrackerPath;
025    
026    import java.io.Externalizable;
027    import java.io.IOException;
028    import java.io.ObjectInput;
029    import java.io.ObjectOutput;
030    
031    import java.util.Date;
032    
033    /**
034     * The cache model class for representing UserTrackerPath in entity cache.
035     *
036     * @author Brian Wing Shun Chan
037     * @see UserTrackerPath
038     * @generated
039     */
040    @ProviderType
041    public class UserTrackerPathCacheModel implements CacheModel<UserTrackerPath>,
042            Externalizable, MVCCModel {
043            @Override
044            public boolean equals(Object obj) {
045                    if (this == obj) {
046                            return true;
047                    }
048    
049                    if (!(obj instanceof UserTrackerPathCacheModel)) {
050                            return false;
051                    }
052    
053                    UserTrackerPathCacheModel userTrackerPathCacheModel = (UserTrackerPathCacheModel)obj;
054    
055                    if ((userTrackerPathId == userTrackerPathCacheModel.userTrackerPathId) &&
056                                    (mvccVersion == userTrackerPathCacheModel.mvccVersion)) {
057                            return true;
058                    }
059    
060                    return false;
061            }
062    
063            @Override
064            public int hashCode() {
065                    int hashCode = HashUtil.hash(0, userTrackerPathId);
066    
067                    return HashUtil.hash(hashCode, mvccVersion);
068            }
069    
070            @Override
071            public long getMvccVersion() {
072                    return mvccVersion;
073            }
074    
075            @Override
076            public void setMvccVersion(long mvccVersion) {
077                    this.mvccVersion = mvccVersion;
078            }
079    
080            @Override
081            public String toString() {
082                    StringBundler sb = new StringBundler(13);
083    
084                    sb.append("{mvccVersion=");
085                    sb.append(mvccVersion);
086                    sb.append(", userTrackerPathId=");
087                    sb.append(userTrackerPathId);
088                    sb.append(", companyId=");
089                    sb.append(companyId);
090                    sb.append(", userTrackerId=");
091                    sb.append(userTrackerId);
092                    sb.append(", path=");
093                    sb.append(path);
094                    sb.append(", pathDate=");
095                    sb.append(pathDate);
096                    sb.append("}");
097    
098                    return sb.toString();
099            }
100    
101            @Override
102            public UserTrackerPath toEntityModel() {
103                    UserTrackerPathImpl userTrackerPathImpl = new UserTrackerPathImpl();
104    
105                    userTrackerPathImpl.setMvccVersion(mvccVersion);
106                    userTrackerPathImpl.setUserTrackerPathId(userTrackerPathId);
107                    userTrackerPathImpl.setCompanyId(companyId);
108                    userTrackerPathImpl.setUserTrackerId(userTrackerId);
109    
110                    if (path == null) {
111                            userTrackerPathImpl.setPath(StringPool.BLANK);
112                    }
113                    else {
114                            userTrackerPathImpl.setPath(path);
115                    }
116    
117                    if (pathDate == Long.MIN_VALUE) {
118                            userTrackerPathImpl.setPathDate(null);
119                    }
120                    else {
121                            userTrackerPathImpl.setPathDate(new Date(pathDate));
122                    }
123    
124                    userTrackerPathImpl.resetOriginalValues();
125    
126                    return userTrackerPathImpl;
127            }
128    
129            @Override
130            public void readExternal(ObjectInput objectInput) throws IOException {
131                    mvccVersion = objectInput.readLong();
132                    userTrackerPathId = objectInput.readLong();
133                    companyId = objectInput.readLong();
134                    userTrackerId = objectInput.readLong();
135                    path = objectInput.readUTF();
136                    pathDate = objectInput.readLong();
137            }
138    
139            @Override
140            public void writeExternal(ObjectOutput objectOutput)
141                    throws IOException {
142                    objectOutput.writeLong(mvccVersion);
143                    objectOutput.writeLong(userTrackerPathId);
144                    objectOutput.writeLong(companyId);
145                    objectOutput.writeLong(userTrackerId);
146    
147                    if (path == null) {
148                            objectOutput.writeUTF(StringPool.BLANK);
149                    }
150                    else {
151                            objectOutput.writeUTF(path);
152                    }
153    
154                    objectOutput.writeLong(pathDate);
155            }
156    
157            public long mvccVersion;
158            public long userTrackerPathId;
159            public long companyId;
160            public long userTrackerId;
161            public String path;
162            public long pathDate;
163    }