001
014
015 package com.liferay.portlet.documentlibrary.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.documentlibrary.model.DLFileEntryType;
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 DLFileEntryTypeCacheModel implements CacheModel<DLFileEntryType>,
038 Externalizable {
039 @Override
040 public String toString() {
041 StringBundler sb = new StringBundler(23);
042
043 sb.append("{uuid=");
044 sb.append(uuid);
045 sb.append(", fileEntryTypeId=");
046 sb.append(fileEntryTypeId);
047 sb.append(", groupId=");
048 sb.append(groupId);
049 sb.append(", companyId=");
050 sb.append(companyId);
051 sb.append(", userId=");
052 sb.append(userId);
053 sb.append(", userName=");
054 sb.append(userName);
055 sb.append(", createDate=");
056 sb.append(createDate);
057 sb.append(", modifiedDate=");
058 sb.append(modifiedDate);
059 sb.append(", fileEntryTypeKey=");
060 sb.append(fileEntryTypeKey);
061 sb.append(", name=");
062 sb.append(name);
063 sb.append(", description=");
064 sb.append(description);
065 sb.append("}");
066
067 return sb.toString();
068 }
069
070 @Override
071 public DLFileEntryType toEntityModel() {
072 DLFileEntryTypeImpl dlFileEntryTypeImpl = new DLFileEntryTypeImpl();
073
074 if (uuid == null) {
075 dlFileEntryTypeImpl.setUuid(StringPool.BLANK);
076 }
077 else {
078 dlFileEntryTypeImpl.setUuid(uuid);
079 }
080
081 dlFileEntryTypeImpl.setFileEntryTypeId(fileEntryTypeId);
082 dlFileEntryTypeImpl.setGroupId(groupId);
083 dlFileEntryTypeImpl.setCompanyId(companyId);
084 dlFileEntryTypeImpl.setUserId(userId);
085
086 if (userName == null) {
087 dlFileEntryTypeImpl.setUserName(StringPool.BLANK);
088 }
089 else {
090 dlFileEntryTypeImpl.setUserName(userName);
091 }
092
093 if (createDate == Long.MIN_VALUE) {
094 dlFileEntryTypeImpl.setCreateDate(null);
095 }
096 else {
097 dlFileEntryTypeImpl.setCreateDate(new Date(createDate));
098 }
099
100 if (modifiedDate == Long.MIN_VALUE) {
101 dlFileEntryTypeImpl.setModifiedDate(null);
102 }
103 else {
104 dlFileEntryTypeImpl.setModifiedDate(new Date(modifiedDate));
105 }
106
107 if (fileEntryTypeKey == null) {
108 dlFileEntryTypeImpl.setFileEntryTypeKey(StringPool.BLANK);
109 }
110 else {
111 dlFileEntryTypeImpl.setFileEntryTypeKey(fileEntryTypeKey);
112 }
113
114 if (name == null) {
115 dlFileEntryTypeImpl.setName(StringPool.BLANK);
116 }
117 else {
118 dlFileEntryTypeImpl.setName(name);
119 }
120
121 if (description == null) {
122 dlFileEntryTypeImpl.setDescription(StringPool.BLANK);
123 }
124 else {
125 dlFileEntryTypeImpl.setDescription(description);
126 }
127
128 dlFileEntryTypeImpl.resetOriginalValues();
129
130 return dlFileEntryTypeImpl;
131 }
132
133 @Override
134 public void readExternal(ObjectInput objectInput) throws IOException {
135 uuid = objectInput.readUTF();
136 fileEntryTypeId = objectInput.readLong();
137 groupId = objectInput.readLong();
138 companyId = objectInput.readLong();
139 userId = objectInput.readLong();
140 userName = objectInput.readUTF();
141 createDate = objectInput.readLong();
142 modifiedDate = objectInput.readLong();
143 fileEntryTypeKey = objectInput.readUTF();
144 name = objectInput.readUTF();
145 description = objectInput.readUTF();
146 }
147
148 @Override
149 public void writeExternal(ObjectOutput objectOutput)
150 throws IOException {
151 if (uuid == null) {
152 objectOutput.writeUTF(StringPool.BLANK);
153 }
154 else {
155 objectOutput.writeUTF(uuid);
156 }
157
158 objectOutput.writeLong(fileEntryTypeId);
159 objectOutput.writeLong(groupId);
160 objectOutput.writeLong(companyId);
161 objectOutput.writeLong(userId);
162
163 if (userName == null) {
164 objectOutput.writeUTF(StringPool.BLANK);
165 }
166 else {
167 objectOutput.writeUTF(userName);
168 }
169
170 objectOutput.writeLong(createDate);
171 objectOutput.writeLong(modifiedDate);
172
173 if (fileEntryTypeKey == null) {
174 objectOutput.writeUTF(StringPool.BLANK);
175 }
176 else {
177 objectOutput.writeUTF(fileEntryTypeKey);
178 }
179
180 if (name == null) {
181 objectOutput.writeUTF(StringPool.BLANK);
182 }
183 else {
184 objectOutput.writeUTF(name);
185 }
186
187 if (description == null) {
188 objectOutput.writeUTF(StringPool.BLANK);
189 }
190 else {
191 objectOutput.writeUTF(description);
192 }
193 }
194
195 public String uuid;
196 public long fileEntryTypeId;
197 public long groupId;
198 public long companyId;
199 public long userId;
200 public String userName;
201 public long createDate;
202 public long modifiedDate;
203 public String fileEntryTypeKey;
204 public String name;
205 public String description;
206 }