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.UserIdMapper;
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 UserIdMapper in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see UserIdMapper
035     * @generated
036     */
037    @ProviderType
038    public class UserIdMapperCacheModel implements CacheModel<UserIdMapper>,
039            Externalizable, MVCCModel {
040            @Override
041            public long getMvccVersion() {
042                    return mvccVersion;
043            }
044    
045            @Override
046            public void setMvccVersion(long mvccVersion) {
047                    this.mvccVersion = mvccVersion;
048            }
049    
050            @Override
051            public String toString() {
052                    StringBundler sb = new StringBundler(13);
053    
054                    sb.append("{mvccVersion=");
055                    sb.append(mvccVersion);
056                    sb.append(", userIdMapperId=");
057                    sb.append(userIdMapperId);
058                    sb.append(", userId=");
059                    sb.append(userId);
060                    sb.append(", type=");
061                    sb.append(type);
062                    sb.append(", description=");
063                    sb.append(description);
064                    sb.append(", externalUserId=");
065                    sb.append(externalUserId);
066                    sb.append("}");
067    
068                    return sb.toString();
069            }
070    
071            @Override
072            public UserIdMapper toEntityModel() {
073                    UserIdMapperImpl userIdMapperImpl = new UserIdMapperImpl();
074    
075                    userIdMapperImpl.setMvccVersion(mvccVersion);
076                    userIdMapperImpl.setUserIdMapperId(userIdMapperId);
077                    userIdMapperImpl.setUserId(userId);
078    
079                    if (type == null) {
080                            userIdMapperImpl.setType(StringPool.BLANK);
081                    }
082                    else {
083                            userIdMapperImpl.setType(type);
084                    }
085    
086                    if (description == null) {
087                            userIdMapperImpl.setDescription(StringPool.BLANK);
088                    }
089                    else {
090                            userIdMapperImpl.setDescription(description);
091                    }
092    
093                    if (externalUserId == null) {
094                            userIdMapperImpl.setExternalUserId(StringPool.BLANK);
095                    }
096                    else {
097                            userIdMapperImpl.setExternalUserId(externalUserId);
098                    }
099    
100                    userIdMapperImpl.resetOriginalValues();
101    
102                    return userIdMapperImpl;
103            }
104    
105            @Override
106            public void readExternal(ObjectInput objectInput) throws IOException {
107                    mvccVersion = objectInput.readLong();
108                    userIdMapperId = objectInput.readLong();
109                    userId = objectInput.readLong();
110                    type = objectInput.readUTF();
111                    description = objectInput.readUTF();
112                    externalUserId = objectInput.readUTF();
113            }
114    
115            @Override
116            public void writeExternal(ObjectOutput objectOutput)
117                    throws IOException {
118                    objectOutput.writeLong(mvccVersion);
119                    objectOutput.writeLong(userIdMapperId);
120                    objectOutput.writeLong(userId);
121    
122                    if (type == null) {
123                            objectOutput.writeUTF(StringPool.BLANK);
124                    }
125                    else {
126                            objectOutput.writeUTF(type);
127                    }
128    
129                    if (description == null) {
130                            objectOutput.writeUTF(StringPool.BLANK);
131                    }
132                    else {
133                            objectOutput.writeUTF(description);
134                    }
135    
136                    if (externalUserId == null) {
137                            objectOutput.writeUTF(StringPool.BLANK);
138                    }
139                    else {
140                            objectOutput.writeUTF(externalUserId);
141                    }
142            }
143    
144            public long mvccVersion;
145            public long userIdMapperId;
146            public long userId;
147            public String type;
148            public String description;
149            public String externalUserId;
150    }