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.ListType;
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 ListTypeCacheModel implements CacheModel<ListType>, Externalizable {
035 @Override
036 public String toString() {
037 StringBundler sb = new StringBundler(7);
038
039 sb.append("{listTypeId=");
040 sb.append(listTypeId);
041 sb.append(", name=");
042 sb.append(name);
043 sb.append(", type=");
044 sb.append(type);
045 sb.append("}");
046
047 return sb.toString();
048 }
049
050 @Override
051 public ListType toEntityModel() {
052 ListTypeImpl listTypeImpl = new ListTypeImpl();
053
054 listTypeImpl.setListTypeId(listTypeId);
055
056 if (name == null) {
057 listTypeImpl.setName(StringPool.BLANK);
058 }
059 else {
060 listTypeImpl.setName(name);
061 }
062
063 if (type == null) {
064 listTypeImpl.setType(StringPool.BLANK);
065 }
066 else {
067 listTypeImpl.setType(type);
068 }
069
070 listTypeImpl.resetOriginalValues();
071
072 return listTypeImpl;
073 }
074
075 @Override
076 public void readExternal(ObjectInput objectInput) throws IOException {
077 listTypeId = objectInput.readInt();
078 name = objectInput.readUTF();
079 type = objectInput.readUTF();
080 }
081
082 @Override
083 public void writeExternal(ObjectOutput objectOutput)
084 throws IOException {
085 objectOutput.writeInt(listTypeId);
086
087 if (name == null) {
088 objectOutput.writeUTF(StringPool.BLANK);
089 }
090 else {
091 objectOutput.writeUTF(name);
092 }
093
094 if (type == null) {
095 objectOutput.writeUTF(StringPool.BLANK);
096 }
097 else {
098 objectOutput.writeUTF(type);
099 }
100 }
101
102 public int listTypeId;
103 public String name;
104 public String type;
105 }