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.model.BrowserTracker;
022    import com.liferay.portal.model.CacheModel;
023    import com.liferay.portal.model.MVCCModel;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    /**
031     * The cache model class for representing BrowserTracker in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see BrowserTracker
035     * @generated
036     */
037    @ProviderType
038    public class BrowserTrackerCacheModel implements CacheModel<BrowserTracker>,
039            Externalizable, MVCCModel {
040            @Override
041            public boolean equals(Object obj) {
042                    if (this == obj) {
043                            return true;
044                    }
045    
046                    if (!(obj instanceof BrowserTrackerCacheModel)) {
047                            return false;
048                    }
049    
050                    BrowserTrackerCacheModel browserTrackerCacheModel = (BrowserTrackerCacheModel)obj;
051    
052                    if ((browserTrackerId == browserTrackerCacheModel.browserTrackerId) &&
053                                    (mvccVersion == browserTrackerCacheModel.mvccVersion)) {
054                            return true;
055                    }
056    
057                    return false;
058            }
059    
060            @Override
061            public int hashCode() {
062                    int hashCode = HashUtil.hash(0, browserTrackerId);
063    
064                    return HashUtil.hash(hashCode, mvccVersion);
065            }
066    
067            @Override
068            public long getMvccVersion() {
069                    return mvccVersion;
070            }
071    
072            @Override
073            public void setMvccVersion(long mvccVersion) {
074                    this.mvccVersion = mvccVersion;
075            }
076    
077            @Override
078            public String toString() {
079                    StringBundler sb = new StringBundler(9);
080    
081                    sb.append("{mvccVersion=");
082                    sb.append(mvccVersion);
083                    sb.append(", browserTrackerId=");
084                    sb.append(browserTrackerId);
085                    sb.append(", userId=");
086                    sb.append(userId);
087                    sb.append(", browserKey=");
088                    sb.append(browserKey);
089                    sb.append("}");
090    
091                    return sb.toString();
092            }
093    
094            @Override
095            public BrowserTracker toEntityModel() {
096                    BrowserTrackerImpl browserTrackerImpl = new BrowserTrackerImpl();
097    
098                    browserTrackerImpl.setMvccVersion(mvccVersion);
099                    browserTrackerImpl.setBrowserTrackerId(browserTrackerId);
100                    browserTrackerImpl.setUserId(userId);
101                    browserTrackerImpl.setBrowserKey(browserKey);
102    
103                    browserTrackerImpl.resetOriginalValues();
104    
105                    return browserTrackerImpl;
106            }
107    
108            @Override
109            public void readExternal(ObjectInput objectInput) throws IOException {
110                    mvccVersion = objectInput.readLong();
111                    browserTrackerId = objectInput.readLong();
112                    userId = objectInput.readLong();
113                    browserKey = objectInput.readLong();
114            }
115    
116            @Override
117            public void writeExternal(ObjectOutput objectOutput)
118                    throws IOException {
119                    objectOutput.writeLong(mvccVersion);
120                    objectOutput.writeLong(browserTrackerId);
121                    objectOutput.writeLong(userId);
122                    objectOutput.writeLong(browserKey);
123            }
124    
125            public long mvccVersion;
126            public long browserTrackerId;
127            public long userId;
128            public long browserKey;
129    }