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