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