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.AssetCategoryProperty;
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 AssetCategoryPropertyCacheModel implements CacheModel<AssetCategoryProperty>,
038 Externalizable {
039 @Override
040 public String toString() {
041 StringBundler sb = new StringBundler(19);
042
043 sb.append("{categoryPropertyId=");
044 sb.append(categoryPropertyId);
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(", categoryId=");
056 sb.append(categoryId);
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 AssetCategoryProperty toEntityModel() {
068 AssetCategoryPropertyImpl assetCategoryPropertyImpl = new AssetCategoryPropertyImpl();
069
070 assetCategoryPropertyImpl.setCategoryPropertyId(categoryPropertyId);
071 assetCategoryPropertyImpl.setCompanyId(companyId);
072 assetCategoryPropertyImpl.setUserId(userId);
073
074 if (userName == null) {
075 assetCategoryPropertyImpl.setUserName(StringPool.BLANK);
076 }
077 else {
078 assetCategoryPropertyImpl.setUserName(userName);
079 }
080
081 if (createDate == Long.MIN_VALUE) {
082 assetCategoryPropertyImpl.setCreateDate(null);
083 }
084 else {
085 assetCategoryPropertyImpl.setCreateDate(new Date(createDate));
086 }
087
088 if (modifiedDate == Long.MIN_VALUE) {
089 assetCategoryPropertyImpl.setModifiedDate(null);
090 }
091 else {
092 assetCategoryPropertyImpl.setModifiedDate(new Date(modifiedDate));
093 }
094
095 assetCategoryPropertyImpl.setCategoryId(categoryId);
096
097 if (key == null) {
098 assetCategoryPropertyImpl.setKey(StringPool.BLANK);
099 }
100 else {
101 assetCategoryPropertyImpl.setKey(key);
102 }
103
104 if (value == null) {
105 assetCategoryPropertyImpl.setValue(StringPool.BLANK);
106 }
107 else {
108 assetCategoryPropertyImpl.setValue(value);
109 }
110
111 assetCategoryPropertyImpl.resetOriginalValues();
112
113 return assetCategoryPropertyImpl;
114 }
115
116 @Override
117 public void readExternal(ObjectInput objectInput) throws IOException {
118 categoryPropertyId = objectInput.readLong();
119 companyId = objectInput.readLong();
120 userId = objectInput.readLong();
121 userName = objectInput.readUTF();
122 createDate = objectInput.readLong();
123 modifiedDate = objectInput.readLong();
124 categoryId = 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(categoryPropertyId);
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(categoryId);
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 categoryPropertyId;
163 public long companyId;
164 public long userId;
165 public String userName;
166 public long createDate;
167 public long modifiedDate;
168 public long categoryId;
169 public String key;
170 public String value;
171 }