001    /**
002     * Copyright (c) 2000-2012 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            public UserIdMapper toEntityModel() {
056                    UserIdMapperImpl userIdMapperImpl = new UserIdMapperImpl();
057    
058                    userIdMapperImpl.setUserIdMapperId(userIdMapperId);
059                    userIdMapperImpl.setUserId(userId);
060    
061                    if (type == null) {
062                            userIdMapperImpl.setType(StringPool.BLANK);
063                    }
064                    else {
065                            userIdMapperImpl.setType(type);
066                    }
067    
068                    if (description == null) {
069                            userIdMapperImpl.setDescription(StringPool.BLANK);
070                    }
071                    else {
072                            userIdMapperImpl.setDescription(description);
073                    }
074    
075                    if (externalUserId == null) {
076                            userIdMapperImpl.setExternalUserId(StringPool.BLANK);
077                    }
078                    else {
079                            userIdMapperImpl.setExternalUserId(externalUserId);
080                    }
081    
082                    userIdMapperImpl.resetOriginalValues();
083    
084                    return userIdMapperImpl;
085            }
086    
087            public void readExternal(ObjectInput objectInput) throws IOException {
088                    userIdMapperId = objectInput.readLong();
089                    userId = objectInput.readLong();
090                    type = objectInput.readUTF();
091                    description = objectInput.readUTF();
092                    externalUserId = objectInput.readUTF();
093            }
094    
095            public void writeExternal(ObjectOutput objectOutput)
096                    throws IOException {
097                    objectOutput.writeLong(userIdMapperId);
098                    objectOutput.writeLong(userId);
099    
100                    if (type == null) {
101                            objectOutput.writeUTF(StringPool.BLANK);
102                    }
103                    else {
104                            objectOutput.writeUTF(type);
105                    }
106    
107                    if (description == null) {
108                            objectOutput.writeUTF(StringPool.BLANK);
109                    }
110                    else {
111                            objectOutput.writeUTF(description);
112                    }
113    
114                    if (externalUserId == null) {
115                            objectOutput.writeUTF(StringPool.BLANK);
116                    }
117                    else {
118                            objectOutput.writeUTF(externalUserId);
119                    }
120            }
121    
122            public long userIdMapperId;
123            public long userId;
124            public String type;
125            public String description;
126            public String externalUserId;
127    }