001
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
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 }