001
014
015 package com.liferay.portlet.asset.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
021 import com.liferay.portlet.asset.model.AssetTagProperty;
022
023 import java.io.Externalizable;
024 import java.io.IOException;
025 import java.io.ObjectInput;
026 import java.io.ObjectOutput;
027
028 import java.util.Date;
029
030
037 public class AssetTagPropertyCacheModel implements CacheModel<AssetTagProperty>,
038 Externalizable {
039 @Override
040 public String toString() {
041 StringBundler sb = new StringBundler(19);
042
043 sb.append("{tagPropertyId=");
044 sb.append(tagPropertyId);
045 sb.append(", companyId=");
046 sb.append(companyId);
047 sb.append(", userId=");
048 sb.append(userId);
049 sb.append(", userName=");
050 sb.append(userName);
051 sb.append(", createDate=");
052 sb.append(createDate);
053 sb.append(", modifiedDate=");
054 sb.append(modifiedDate);
055 sb.append(", tagId=");
056 sb.append(tagId);
057 sb.append(", key=");
058 sb.append(key);
059 sb.append(", value=");
060 sb.append(value);
061 sb.append("}");
062
063 return sb.toString();
064 }
065
066 public AssetTagProperty toEntityModel() {
067 AssetTagPropertyImpl assetTagPropertyImpl = new AssetTagPropertyImpl();
068
069 assetTagPropertyImpl.setTagPropertyId(tagPropertyId);
070 assetTagPropertyImpl.setCompanyId(companyId);
071 assetTagPropertyImpl.setUserId(userId);
072
073 if (userName == null) {
074 assetTagPropertyImpl.setUserName(StringPool.BLANK);
075 }
076 else {
077 assetTagPropertyImpl.setUserName(userName);
078 }
079
080 if (createDate == Long.MIN_VALUE) {
081 assetTagPropertyImpl.setCreateDate(null);
082 }
083 else {
084 assetTagPropertyImpl.setCreateDate(new Date(createDate));
085 }
086
087 if (modifiedDate == Long.MIN_VALUE) {
088 assetTagPropertyImpl.setModifiedDate(null);
089 }
090 else {
091 assetTagPropertyImpl.setModifiedDate(new Date(modifiedDate));
092 }
093
094 assetTagPropertyImpl.setTagId(tagId);
095
096 if (key == null) {
097 assetTagPropertyImpl.setKey(StringPool.BLANK);
098 }
099 else {
100 assetTagPropertyImpl.setKey(key);
101 }
102
103 if (value == null) {
104 assetTagPropertyImpl.setValue(StringPool.BLANK);
105 }
106 else {
107 assetTagPropertyImpl.setValue(value);
108 }
109
110 assetTagPropertyImpl.resetOriginalValues();
111
112 return assetTagPropertyImpl;
113 }
114
115 public void readExternal(ObjectInput objectInput) throws IOException {
116 tagPropertyId = objectInput.readLong();
117 companyId = objectInput.readLong();
118 userId = objectInput.readLong();
119 userName = objectInput.readUTF();
120 createDate = objectInput.readLong();
121 modifiedDate = objectInput.readLong();
122 tagId = objectInput.readLong();
123 key = objectInput.readUTF();
124 value = objectInput.readUTF();
125 }
126
127 public void writeExternal(ObjectOutput objectOutput)
128 throws IOException {
129 objectOutput.writeLong(tagPropertyId);
130 objectOutput.writeLong(companyId);
131 objectOutput.writeLong(userId);
132
133 if (userName == null) {
134 objectOutput.writeUTF(StringPool.BLANK);
135 }
136 else {
137 objectOutput.writeUTF(userName);
138 }
139
140 objectOutput.writeLong(createDate);
141 objectOutput.writeLong(modifiedDate);
142 objectOutput.writeLong(tagId);
143
144 if (key == null) {
145 objectOutput.writeUTF(StringPool.BLANK);
146 }
147 else {
148 objectOutput.writeUTF(key);
149 }
150
151 if (value == null) {
152 objectOutput.writeUTF(StringPool.BLANK);
153 }
154 else {
155 objectOutput.writeUTF(value);
156 }
157 }
158
159 public long tagPropertyId;
160 public long companyId;
161 public long userId;
162 public String userName;
163 public long createDate;
164 public long modifiedDate;
165 public long tagId;
166 public String key;
167 public String value;
168 }