001    /**
002     * Copyright (c) 2000-2013 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.portal.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    import com.liferay.portal.model.Repository;
021    
022    import java.io.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    import java.util.Date;
028    
029    /**
030     * The cache model class for representing Repository in entity cache.
031     *
032     * @author Brian Wing Shun Chan
033     * @see Repository
034     * @generated
035     */
036    public class RepositoryCacheModel implements CacheModel<Repository>,
037            Externalizable {
038            @Override
039            public String toString() {
040                    StringBundler sb = new StringBundler(29);
041    
042                    sb.append("{uuid=");
043                    sb.append(uuid);
044                    sb.append(", repositoryId=");
045                    sb.append(repositoryId);
046                    sb.append(", groupId=");
047                    sb.append(groupId);
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(", classNameId=");
059                    sb.append(classNameId);
060                    sb.append(", name=");
061                    sb.append(name);
062                    sb.append(", description=");
063                    sb.append(description);
064                    sb.append(", portletId=");
065                    sb.append(portletId);
066                    sb.append(", typeSettings=");
067                    sb.append(typeSettings);
068                    sb.append(", dlFolderId=");
069                    sb.append(dlFolderId);
070                    sb.append("}");
071    
072                    return sb.toString();
073            }
074    
075            public Repository toEntityModel() {
076                    RepositoryImpl repositoryImpl = new RepositoryImpl();
077    
078                    if (uuid == null) {
079                            repositoryImpl.setUuid(StringPool.BLANK);
080                    }
081                    else {
082                            repositoryImpl.setUuid(uuid);
083                    }
084    
085                    repositoryImpl.setRepositoryId(repositoryId);
086                    repositoryImpl.setGroupId(groupId);
087                    repositoryImpl.setCompanyId(companyId);
088                    repositoryImpl.setUserId(userId);
089    
090                    if (userName == null) {
091                            repositoryImpl.setUserName(StringPool.BLANK);
092                    }
093                    else {
094                            repositoryImpl.setUserName(userName);
095                    }
096    
097                    if (createDate == Long.MIN_VALUE) {
098                            repositoryImpl.setCreateDate(null);
099                    }
100                    else {
101                            repositoryImpl.setCreateDate(new Date(createDate));
102                    }
103    
104                    if (modifiedDate == Long.MIN_VALUE) {
105                            repositoryImpl.setModifiedDate(null);
106                    }
107                    else {
108                            repositoryImpl.setModifiedDate(new Date(modifiedDate));
109                    }
110    
111                    repositoryImpl.setClassNameId(classNameId);
112    
113                    if (name == null) {
114                            repositoryImpl.setName(StringPool.BLANK);
115                    }
116                    else {
117                            repositoryImpl.setName(name);
118                    }
119    
120                    if (description == null) {
121                            repositoryImpl.setDescription(StringPool.BLANK);
122                    }
123                    else {
124                            repositoryImpl.setDescription(description);
125                    }
126    
127                    if (portletId == null) {
128                            repositoryImpl.setPortletId(StringPool.BLANK);
129                    }
130                    else {
131                            repositoryImpl.setPortletId(portletId);
132                    }
133    
134                    if (typeSettings == null) {
135                            repositoryImpl.setTypeSettings(StringPool.BLANK);
136                    }
137                    else {
138                            repositoryImpl.setTypeSettings(typeSettings);
139                    }
140    
141                    repositoryImpl.setDlFolderId(dlFolderId);
142    
143                    repositoryImpl.resetOriginalValues();
144    
145                    return repositoryImpl;
146            }
147    
148            public void readExternal(ObjectInput objectInput) throws IOException {
149                    uuid = objectInput.readUTF();
150                    repositoryId = objectInput.readLong();
151                    groupId = objectInput.readLong();
152                    companyId = objectInput.readLong();
153                    userId = objectInput.readLong();
154                    userName = objectInput.readUTF();
155                    createDate = objectInput.readLong();
156                    modifiedDate = objectInput.readLong();
157                    classNameId = objectInput.readLong();
158                    name = objectInput.readUTF();
159                    description = objectInput.readUTF();
160                    portletId = objectInput.readUTF();
161                    typeSettings = objectInput.readUTF();
162                    dlFolderId = objectInput.readLong();
163            }
164    
165            public void writeExternal(ObjectOutput objectOutput)
166                    throws IOException {
167                    if (uuid == null) {
168                            objectOutput.writeUTF(StringPool.BLANK);
169                    }
170                    else {
171                            objectOutput.writeUTF(uuid);
172                    }
173    
174                    objectOutput.writeLong(repositoryId);
175                    objectOutput.writeLong(groupId);
176                    objectOutput.writeLong(companyId);
177                    objectOutput.writeLong(userId);
178    
179                    if (userName == null) {
180                            objectOutput.writeUTF(StringPool.BLANK);
181                    }
182                    else {
183                            objectOutput.writeUTF(userName);
184                    }
185    
186                    objectOutput.writeLong(createDate);
187                    objectOutput.writeLong(modifiedDate);
188                    objectOutput.writeLong(classNameId);
189    
190                    if (name == null) {
191                            objectOutput.writeUTF(StringPool.BLANK);
192                    }
193                    else {
194                            objectOutput.writeUTF(name);
195                    }
196    
197                    if (description == null) {
198                            objectOutput.writeUTF(StringPool.BLANK);
199                    }
200                    else {
201                            objectOutput.writeUTF(description);
202                    }
203    
204                    if (portletId == null) {
205                            objectOutput.writeUTF(StringPool.BLANK);
206                    }
207                    else {
208                            objectOutput.writeUTF(portletId);
209                    }
210    
211                    if (typeSettings == null) {
212                            objectOutput.writeUTF(StringPool.BLANK);
213                    }
214                    else {
215                            objectOutput.writeUTF(typeSettings);
216                    }
217    
218                    objectOutput.writeLong(dlFolderId);
219            }
220    
221            public String uuid;
222            public long repositoryId;
223            public long groupId;
224            public long companyId;
225            public long userId;
226            public String userName;
227            public long createDate;
228            public long modifiedDate;
229            public long classNameId;
230            public String name;
231            public String description;
232            public String portletId;
233            public String typeSettings;
234            public long dlFolderId;
235    }