001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.documentlibrary.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.documentlibrary.model.DLFileEntryType;
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    /**
033     * The cache model class for representing DLFileEntryType in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see DLFileEntryType
037     * @generated
038     */
039    @ProviderType
040    public class DLFileEntryTypeCacheModel implements CacheModel<DLFileEntryType>,
041            Externalizable {
042            @Override
043            public String toString() {
044                    StringBundler sb = new StringBundler(23);
045    
046                    sb.append("{uuid=");
047                    sb.append(uuid);
048                    sb.append(", fileEntryTypeId=");
049                    sb.append(fileEntryTypeId);
050                    sb.append(", groupId=");
051                    sb.append(groupId);
052                    sb.append(", companyId=");
053                    sb.append(companyId);
054                    sb.append(", userId=");
055                    sb.append(userId);
056                    sb.append(", userName=");
057                    sb.append(userName);
058                    sb.append(", createDate=");
059                    sb.append(createDate);
060                    sb.append(", modifiedDate=");
061                    sb.append(modifiedDate);
062                    sb.append(", fileEntryTypeKey=");
063                    sb.append(fileEntryTypeKey);
064                    sb.append(", name=");
065                    sb.append(name);
066                    sb.append(", description=");
067                    sb.append(description);
068                    sb.append("}");
069    
070                    return sb.toString();
071            }
072    
073            @Override
074            public DLFileEntryType toEntityModel() {
075                    DLFileEntryTypeImpl dlFileEntryTypeImpl = new DLFileEntryTypeImpl();
076    
077                    if (uuid == null) {
078                            dlFileEntryTypeImpl.setUuid(StringPool.BLANK);
079                    }
080                    else {
081                            dlFileEntryTypeImpl.setUuid(uuid);
082                    }
083    
084                    dlFileEntryTypeImpl.setFileEntryTypeId(fileEntryTypeId);
085                    dlFileEntryTypeImpl.setGroupId(groupId);
086                    dlFileEntryTypeImpl.setCompanyId(companyId);
087                    dlFileEntryTypeImpl.setUserId(userId);
088    
089                    if (userName == null) {
090                            dlFileEntryTypeImpl.setUserName(StringPool.BLANK);
091                    }
092                    else {
093                            dlFileEntryTypeImpl.setUserName(userName);
094                    }
095    
096                    if (createDate == Long.MIN_VALUE) {
097                            dlFileEntryTypeImpl.setCreateDate(null);
098                    }
099                    else {
100                            dlFileEntryTypeImpl.setCreateDate(new Date(createDate));
101                    }
102    
103                    if (modifiedDate == Long.MIN_VALUE) {
104                            dlFileEntryTypeImpl.setModifiedDate(null);
105                    }
106                    else {
107                            dlFileEntryTypeImpl.setModifiedDate(new Date(modifiedDate));
108                    }
109    
110                    if (fileEntryTypeKey == null) {
111                            dlFileEntryTypeImpl.setFileEntryTypeKey(StringPool.BLANK);
112                    }
113                    else {
114                            dlFileEntryTypeImpl.setFileEntryTypeKey(fileEntryTypeKey);
115                    }
116    
117                    if (name == null) {
118                            dlFileEntryTypeImpl.setName(StringPool.BLANK);
119                    }
120                    else {
121                            dlFileEntryTypeImpl.setName(name);
122                    }
123    
124                    if (description == null) {
125                            dlFileEntryTypeImpl.setDescription(StringPool.BLANK);
126                    }
127                    else {
128                            dlFileEntryTypeImpl.setDescription(description);
129                    }
130    
131                    dlFileEntryTypeImpl.resetOriginalValues();
132    
133                    return dlFileEntryTypeImpl;
134            }
135    
136            @Override
137            public void readExternal(ObjectInput objectInput) throws IOException {
138                    uuid = objectInput.readUTF();
139                    fileEntryTypeId = objectInput.readLong();
140                    groupId = objectInput.readLong();
141                    companyId = objectInput.readLong();
142                    userId = objectInput.readLong();
143                    userName = objectInput.readUTF();
144                    createDate = objectInput.readLong();
145                    modifiedDate = objectInput.readLong();
146                    fileEntryTypeKey = objectInput.readUTF();
147                    name = objectInput.readUTF();
148                    description = objectInput.readUTF();
149            }
150    
151            @Override
152            public void writeExternal(ObjectOutput objectOutput)
153                    throws IOException {
154                    if (uuid == null) {
155                            objectOutput.writeUTF(StringPool.BLANK);
156                    }
157                    else {
158                            objectOutput.writeUTF(uuid);
159                    }
160    
161                    objectOutput.writeLong(fileEntryTypeId);
162                    objectOutput.writeLong(groupId);
163                    objectOutput.writeLong(companyId);
164                    objectOutput.writeLong(userId);
165    
166                    if (userName == null) {
167                            objectOutput.writeUTF(StringPool.BLANK);
168                    }
169                    else {
170                            objectOutput.writeUTF(userName);
171                    }
172    
173                    objectOutput.writeLong(createDate);
174                    objectOutput.writeLong(modifiedDate);
175    
176                    if (fileEntryTypeKey == null) {
177                            objectOutput.writeUTF(StringPool.BLANK);
178                    }
179                    else {
180                            objectOutput.writeUTF(fileEntryTypeKey);
181                    }
182    
183                    if (name == null) {
184                            objectOutput.writeUTF(StringPool.BLANK);
185                    }
186                    else {
187                            objectOutput.writeUTF(name);
188                    }
189    
190                    if (description == null) {
191                            objectOutput.writeUTF(StringPool.BLANK);
192                    }
193                    else {
194                            objectOutput.writeUTF(description);
195                    }
196            }
197    
198            public String uuid;
199            public long fileEntryTypeId;
200            public long groupId;
201            public long companyId;
202            public long userId;
203            public String userName;
204            public long createDate;
205            public long modifiedDate;
206            public String fileEntryTypeKey;
207            public String name;
208            public String description;
209    }