001    /**
002     * Copyright (c) 2000-2013 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 com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.portal.model.CacheModel;
020    import com.liferay.portal.model.UserIdMapper;
021    
022    import java.io.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    /**
028     * The cache model class for representing UserIdMapper in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see UserIdMapper
032     * @generated
033     */
034    public class UserIdMapperCacheModel implements CacheModel<UserIdMapper>,
035            Externalizable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(11);
039    
040                    sb.append("{userIdMapperId=");
041                    sb.append(userIdMapperId);
042                    sb.append(", userId=");
043                    sb.append(userId);
044                    sb.append(", type=");
045                    sb.append(type);
046                    sb.append(", description=");
047                    sb.append(description);
048                    sb.append(", externalUserId=");
049                    sb.append(externalUserId);
050                    sb.append("}");
051    
052                    return sb.toString();
053            }
054    
055            @Override
056            public UserIdMapper toEntityModel() {
057                    UserIdMapperImpl userIdMapperImpl = new UserIdMapperImpl();
058    
059                    userIdMapperImpl.setUserIdMapperId(userIdMapperId);
060                    userIdMapperImpl.setUserId(userId);
061    
062                    if (type == null) {
063                            userIdMapperImpl.setType(StringPool.BLANK);
064                    }
065                    else {
066                            userIdMapperImpl.setType(type);
067                    }
068    
069                    if (description == null) {
070                            userIdMapperImpl.setDescription(StringPool.BLANK);
071                    }
072                    else {
073                            userIdMapperImpl.setDescription(description);
074                    }
075    
076                    if (externalUserId == null) {
077                            userIdMapperImpl.setExternalUserId(StringPool.BLANK);
078                    }
079                    else {
080                            userIdMapperImpl.setExternalUserId(externalUserId);
081                    }
082    
083                    userIdMapperImpl.resetOriginalValues();
084    
085                    return userIdMapperImpl;
086            }
087    
088            @Override
089            public void readExternal(ObjectInput objectInput) throws IOException {
090                    userIdMapperId = objectInput.readLong();
091                    userId = objectInput.readLong();
092                    type = objectInput.readUTF();
093                    description = objectInput.readUTF();
094                    externalUserId = objectInput.readUTF();
095            }
096    
097            @Override
098            public void writeExternal(ObjectOutput objectOutput)
099                    throws IOException {
100                    objectOutput.writeLong(userIdMapperId);
101                    objectOutput.writeLong(userId);
102    
103                    if (type == null) {
104                            objectOutput.writeUTF(StringPool.BLANK);
105                    }
106                    else {
107                            objectOutput.writeUTF(type);
108                    }
109    
110                    if (description == null) {
111                            objectOutput.writeUTF(StringPool.BLANK);
112                    }
113                    else {
114                            objectOutput.writeUTF(description);
115                    }
116    
117                    if (externalUserId == null) {
118                            objectOutput.writeUTF(StringPool.BLANK);
119                    }
120                    else {
121                            objectOutput.writeUTF(externalUserId);
122                    }
123            }
124    
125            public long userIdMapperId;
126            public long userId;
127            public String type;
128            public String description;
129            public String externalUserId;
130    }