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.RepositoryEntry;
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 RepositoryEntry in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see RepositoryEntry
037     * @generated
038     */
039    @ProviderType
040    public class RepositoryEntryCacheModel implements CacheModel<RepositoryEntry>,
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(25);
055    
056                    sb.append("{mvccVersion=");
057                    sb.append(mvccVersion);
058                    sb.append(", uuid=");
059                    sb.append(uuid);
060                    sb.append(", repositoryEntryId=");
061                    sb.append(repositoryEntryId);
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(", repositoryId=");
075                    sb.append(repositoryId);
076                    sb.append(", mappedId=");
077                    sb.append(mappedId);
078                    sb.append(", manualCheckInRequired=");
079                    sb.append(manualCheckInRequired);
080                    sb.append("}");
081    
082                    return sb.toString();
083            }
084    
085            @Override
086            public RepositoryEntry toEntityModel() {
087                    RepositoryEntryImpl repositoryEntryImpl = new RepositoryEntryImpl();
088    
089                    repositoryEntryImpl.setMvccVersion(mvccVersion);
090    
091                    if (uuid == null) {
092                            repositoryEntryImpl.setUuid(StringPool.BLANK);
093                    }
094                    else {
095                            repositoryEntryImpl.setUuid(uuid);
096                    }
097    
098                    repositoryEntryImpl.setRepositoryEntryId(repositoryEntryId);
099                    repositoryEntryImpl.setGroupId(groupId);
100                    repositoryEntryImpl.setCompanyId(companyId);
101                    repositoryEntryImpl.setUserId(userId);
102    
103                    if (userName == null) {
104                            repositoryEntryImpl.setUserName(StringPool.BLANK);
105                    }
106                    else {
107                            repositoryEntryImpl.setUserName(userName);
108                    }
109    
110                    if (createDate == Long.MIN_VALUE) {
111                            repositoryEntryImpl.setCreateDate(null);
112                    }
113                    else {
114                            repositoryEntryImpl.setCreateDate(new Date(createDate));
115                    }
116    
117                    if (modifiedDate == Long.MIN_VALUE) {
118                            repositoryEntryImpl.setModifiedDate(null);
119                    }
120                    else {
121                            repositoryEntryImpl.setModifiedDate(new Date(modifiedDate));
122                    }
123    
124                    repositoryEntryImpl.setRepositoryId(repositoryId);
125    
126                    if (mappedId == null) {
127                            repositoryEntryImpl.setMappedId(StringPool.BLANK);
128                    }
129                    else {
130                            repositoryEntryImpl.setMappedId(mappedId);
131                    }
132    
133                    repositoryEntryImpl.setManualCheckInRequired(manualCheckInRequired);
134    
135                    repositoryEntryImpl.resetOriginalValues();
136    
137                    return repositoryEntryImpl;
138            }
139    
140            @Override
141            public void readExternal(ObjectInput objectInput) throws IOException {
142                    mvccVersion = objectInput.readLong();
143                    uuid = objectInput.readUTF();
144                    repositoryEntryId = objectInput.readLong();
145                    groupId = objectInput.readLong();
146                    companyId = objectInput.readLong();
147                    userId = objectInput.readLong();
148                    userName = objectInput.readUTF();
149                    createDate = objectInput.readLong();
150                    modifiedDate = objectInput.readLong();
151                    repositoryId = objectInput.readLong();
152                    mappedId = objectInput.readUTF();
153                    manualCheckInRequired = objectInput.readBoolean();
154            }
155    
156            @Override
157            public void writeExternal(ObjectOutput objectOutput)
158                    throws IOException {
159                    objectOutput.writeLong(mvccVersion);
160    
161                    if (uuid == null) {
162                            objectOutput.writeUTF(StringPool.BLANK);
163                    }
164                    else {
165                            objectOutput.writeUTF(uuid);
166                    }
167    
168                    objectOutput.writeLong(repositoryEntryId);
169                    objectOutput.writeLong(groupId);
170                    objectOutput.writeLong(companyId);
171                    objectOutput.writeLong(userId);
172    
173                    if (userName == null) {
174                            objectOutput.writeUTF(StringPool.BLANK);
175                    }
176                    else {
177                            objectOutput.writeUTF(userName);
178                    }
179    
180                    objectOutput.writeLong(createDate);
181                    objectOutput.writeLong(modifiedDate);
182                    objectOutput.writeLong(repositoryId);
183    
184                    if (mappedId == null) {
185                            objectOutput.writeUTF(StringPool.BLANK);
186                    }
187                    else {
188                            objectOutput.writeUTF(mappedId);
189                    }
190    
191                    objectOutput.writeBoolean(manualCheckInRequired);
192            }
193    
194            public long mvccVersion;
195            public String uuid;
196            public long repositoryEntryId;
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 long repositoryId;
204            public String mappedId;
205            public boolean manualCheckInRequired;
206    }