001    /**
002     * Copyright (c) 2000-2012 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 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.DLSync;
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    /**
031     * The cache model class for representing DLSync in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see DLSync
035     * @generated
036     */
037    public class DLSyncCacheModel implements CacheModel<DLSync>, Externalizable {
038            @Override
039            public String toString() {
040                    StringBundler sb = new StringBundler(27);
041    
042                    sb.append("{syncId=");
043                    sb.append(syncId);
044                    sb.append(", companyId=");
045                    sb.append(companyId);
046                    sb.append(", createDate=");
047                    sb.append(createDate);
048                    sb.append(", modifiedDate=");
049                    sb.append(modifiedDate);
050                    sb.append(", fileId=");
051                    sb.append(fileId);
052                    sb.append(", fileUuid=");
053                    sb.append(fileUuid);
054                    sb.append(", repositoryId=");
055                    sb.append(repositoryId);
056                    sb.append(", parentFolderId=");
057                    sb.append(parentFolderId);
058                    sb.append(", name=");
059                    sb.append(name);
060                    sb.append(", description=");
061                    sb.append(description);
062                    sb.append(", event=");
063                    sb.append(event);
064                    sb.append(", type=");
065                    sb.append(type);
066                    sb.append(", version=");
067                    sb.append(version);
068                    sb.append("}");
069    
070                    return sb.toString();
071            }
072    
073            public DLSync toEntityModel() {
074                    DLSyncImpl dlSyncImpl = new DLSyncImpl();
075    
076                    dlSyncImpl.setSyncId(syncId);
077                    dlSyncImpl.setCompanyId(companyId);
078    
079                    if (createDate == Long.MIN_VALUE) {
080                            dlSyncImpl.setCreateDate(null);
081                    }
082                    else {
083                            dlSyncImpl.setCreateDate(new Date(createDate));
084                    }
085    
086                    if (modifiedDate == Long.MIN_VALUE) {
087                            dlSyncImpl.setModifiedDate(null);
088                    }
089                    else {
090                            dlSyncImpl.setModifiedDate(new Date(modifiedDate));
091                    }
092    
093                    dlSyncImpl.setFileId(fileId);
094    
095                    if (fileUuid == null) {
096                            dlSyncImpl.setFileUuid(StringPool.BLANK);
097                    }
098                    else {
099                            dlSyncImpl.setFileUuid(fileUuid);
100                    }
101    
102                    dlSyncImpl.setRepositoryId(repositoryId);
103                    dlSyncImpl.setParentFolderId(parentFolderId);
104    
105                    if (name == null) {
106                            dlSyncImpl.setName(StringPool.BLANK);
107                    }
108                    else {
109                            dlSyncImpl.setName(name);
110                    }
111    
112                    if (description == null) {
113                            dlSyncImpl.setDescription(StringPool.BLANK);
114                    }
115                    else {
116                            dlSyncImpl.setDescription(description);
117                    }
118    
119                    if (event == null) {
120                            dlSyncImpl.setEvent(StringPool.BLANK);
121                    }
122                    else {
123                            dlSyncImpl.setEvent(event);
124                    }
125    
126                    if (type == null) {
127                            dlSyncImpl.setType(StringPool.BLANK);
128                    }
129                    else {
130                            dlSyncImpl.setType(type);
131                    }
132    
133                    if (version == null) {
134                            dlSyncImpl.setVersion(StringPool.BLANK);
135                    }
136                    else {
137                            dlSyncImpl.setVersion(version);
138                    }
139    
140                    dlSyncImpl.resetOriginalValues();
141    
142                    return dlSyncImpl;
143            }
144    
145            public void readExternal(ObjectInput objectInput) throws IOException {
146                    syncId = objectInput.readLong();
147                    companyId = objectInput.readLong();
148                    createDate = objectInput.readLong();
149                    modifiedDate = objectInput.readLong();
150                    fileId = objectInput.readLong();
151                    fileUuid = objectInput.readUTF();
152                    repositoryId = objectInput.readLong();
153                    parentFolderId = objectInput.readLong();
154                    name = objectInput.readUTF();
155                    description = objectInput.readUTF();
156                    event = objectInput.readUTF();
157                    type = objectInput.readUTF();
158                    version = objectInput.readUTF();
159            }
160    
161            public void writeExternal(ObjectOutput objectOutput)
162                    throws IOException {
163                    objectOutput.writeLong(syncId);
164                    objectOutput.writeLong(companyId);
165                    objectOutput.writeLong(createDate);
166                    objectOutput.writeLong(modifiedDate);
167                    objectOutput.writeLong(fileId);
168    
169                    if (fileUuid == null) {
170                            objectOutput.writeUTF(StringPool.BLANK);
171                    }
172                    else {
173                            objectOutput.writeUTF(fileUuid);
174                    }
175    
176                    objectOutput.writeLong(repositoryId);
177                    objectOutput.writeLong(parentFolderId);
178    
179                    if (name == null) {
180                            objectOutput.writeUTF(StringPool.BLANK);
181                    }
182                    else {
183                            objectOutput.writeUTF(name);
184                    }
185    
186                    if (description == null) {
187                            objectOutput.writeUTF(StringPool.BLANK);
188                    }
189                    else {
190                            objectOutput.writeUTF(description);
191                    }
192    
193                    if (event == null) {
194                            objectOutput.writeUTF(StringPool.BLANK);
195                    }
196                    else {
197                            objectOutput.writeUTF(event);
198                    }
199    
200                    if (type == null) {
201                            objectOutput.writeUTF(StringPool.BLANK);
202                    }
203                    else {
204                            objectOutput.writeUTF(type);
205                    }
206    
207                    if (version == null) {
208                            objectOutput.writeUTF(StringPool.BLANK);
209                    }
210                    else {
211                            objectOutput.writeUTF(version);
212                    }
213            }
214    
215            public long syncId;
216            public long companyId;
217            public long createDate;
218            public long modifiedDate;
219            public long fileId;
220            public String fileUuid;
221            public long repositoryId;
222            public long parentFolderId;
223            public String name;
224            public String description;
225            public String event;
226            public String type;
227            public String version;
228    }