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 public ListType toEntityModel() {
051 ListTypeImpl listTypeImpl = new ListTypeImpl();
052
053 listTypeImpl.setListTypeId(listTypeId);
054
055 if (name == null) {
056 listTypeImpl.setName(StringPool.BLANK);
057 }
058 else {
059 listTypeImpl.setName(name);
060 }
061
062 if (type == null) {
063 listTypeImpl.setType(StringPool.BLANK);
064 }
065 else {
066 listTypeImpl.setType(type);
067 }
068
069 listTypeImpl.resetOriginalValues();
070
071 return listTypeImpl;
072 }
073
074 public void readExternal(ObjectInput objectInput) throws IOException {
075 listTypeId = objectInput.readInt();
076 name = objectInput.readUTF();
077 type = objectInput.readUTF();
078 }
079
080 public void writeExternal(ObjectOutput objectOutput)
081 throws IOException {
082 objectOutput.writeInt(listTypeId);
083
084 if (name == null) {
085 objectOutput.writeUTF(StringPool.BLANK);
086 }
087 else {
088 objectOutput.writeUTF(name);
089 }
090
091 if (type == null) {
092 objectOutput.writeUTF(StringPool.BLANK);
093 }
094 else {
095 objectOutput.writeUTF(type);
096 }
097 }
098
099 public int listTypeId;
100 public String name;
101 public String type;
102 }