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