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