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 @Override
067 public AssetTagProperty toEntityModel() {
068 AssetTagPropertyImpl assetTagPropertyImpl = new AssetTagPropertyImpl();
069
070 assetTagPropertyImpl.setTagPropertyId(tagPropertyId);
071 assetTagPropertyImpl.setCompanyId(companyId);
072 assetTagPropertyImpl.setUserId(userId);
073
074 if (userName == null) {
075 assetTagPropertyImpl.setUserName(StringPool.BLANK);
076 }
077 else {
078 assetTagPropertyImpl.setUserName(userName);
079 }
080
081 if (createDate == Long.MIN_VALUE) {
082 assetTagPropertyImpl.setCreateDate(null);
083 }
084 else {
085 assetTagPropertyImpl.setCreateDate(new Date(createDate));
086 }
087
088 if (modifiedDate == Long.MIN_VALUE) {
089 assetTagPropertyImpl.setModifiedDate(null);
090 }
091 else {
092 assetTagPropertyImpl.setModifiedDate(new Date(modifiedDate));
093 }
094
095 assetTagPropertyImpl.setTagId(tagId);
096
097 if (key == null) {
098 assetTagPropertyImpl.setKey(StringPool.BLANK);
099 }
100 else {
101 assetTagPropertyImpl.setKey(key);
102 }
103
104 if (value == null) {
105 assetTagPropertyImpl.setValue(StringPool.BLANK);
106 }
107 else {
108 assetTagPropertyImpl.setValue(value);
109 }
110
111 assetTagPropertyImpl.resetOriginalValues();
112
113 return assetTagPropertyImpl;
114 }
115
116 @Override
117 public void readExternal(ObjectInput objectInput) throws IOException {
118 tagPropertyId = objectInput.readLong();
119 companyId = objectInput.readLong();
120 userId = objectInput.readLong();
121 userName = objectInput.readUTF();
122 createDate = objectInput.readLong();
123 modifiedDate = objectInput.readLong();
124 tagId = objectInput.readLong();
125 key = objectInput.readUTF();
126 value = objectInput.readUTF();
127 }
128
129 @Override
130 public void writeExternal(ObjectOutput objectOutput)
131 throws IOException {
132 objectOutput.writeLong(tagPropertyId);
133 objectOutput.writeLong(companyId);
134 objectOutput.writeLong(userId);
135
136 if (userName == null) {
137 objectOutput.writeUTF(StringPool.BLANK);
138 }
139 else {
140 objectOutput.writeUTF(userName);
141 }
142
143 objectOutput.writeLong(createDate);
144 objectOutput.writeLong(modifiedDate);
145 objectOutput.writeLong(tagId);
146
147 if (key == null) {
148 objectOutput.writeUTF(StringPool.BLANK);
149 }
150 else {
151 objectOutput.writeUTF(key);
152 }
153
154 if (value == null) {
155 objectOutput.writeUTF(StringPool.BLANK);
156 }
157 else {
158 objectOutput.writeUTF(value);
159 }
160 }
161
162 public long tagPropertyId;
163 public long companyId;
164 public long userId;
165 public String userName;
166 public long createDate;
167 public long modifiedDate;
168 public long tagId;
169 public String key;
170 public String value;
171 }